@forge/teamwork-graph 2.3.0-next.2 → 2.3.0-next.3
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/README.md +1 -38
- package/out/__test__/error-handling.test.js +11 -7
- package/out/__test__/validators.test.js +0 -117
- package/out/graph.d.ts +1 -3
- package/out/graph.d.ts.map +1 -1
- package/out/graph.js +0 -38
- package/out/types/graph.d.ts +1 -3
- package/out/types/graph.d.ts.map +1 -1
- package/out/types/requests.d.ts +0 -24
- package/out/types/requests.d.ts.map +1 -1
- package/out/utils/error-handling.d.ts.map +1 -1
- package/out/utils/error-handling.js +1 -4
- package/out/utils/errors.d.ts +0 -6
- package/out/utils/errors.d.ts.map +1 -1
- package/out/utils/errors.js +1 -13
- package/out/utils/validators.d.ts +0 -2
- package/out/utils/validators.d.ts.map +1 -1
- package/out/utils/validators.js +1 -28
- package/package.json +1 -1
- package/out/__test__/graph-extended.test.d.ts +0 -2
- package/out/__test__/graph-extended.test.d.ts.map +0 -1
- package/out/__test__/graph-extended.test.js +0 -113
package/README.md
CHANGED
|
@@ -205,37 +205,6 @@ const deleteGroupsResult = await graph.deleteGroupsByExternalId({
|
|
|
205
205
|
});
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
### Data Operations
|
|
209
|
-
|
|
210
|
-
```typescript
|
|
211
|
-
import { graph } from '@forge/teamwork-graph';
|
|
212
|
-
|
|
213
|
-
// Fetch external data
|
|
214
|
-
const fetchResult = await graph.fetchData({
|
|
215
|
-
requestConfig: {
|
|
216
|
-
url: 'https://api.example.com/data',
|
|
217
|
-
method: 'GET',
|
|
218
|
-
headers: { 'Authorization': 'Bearer token' }
|
|
219
|
-
},
|
|
220
|
-
onResult: (data) => {
|
|
221
|
-
console.log('Data received:', data);
|
|
222
|
-
return data;
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
// Transform data
|
|
227
|
-
const transformResult = await graph.transformData({
|
|
228
|
-
data: { items: [{ id: 1, name: 'Item 1' }] },
|
|
229
|
-
transformMethod: (data) => {
|
|
230
|
-
return data.items.map(item => ({
|
|
231
|
-
id: `doc-${item.id}`,
|
|
232
|
-
displayName: item.name,
|
|
233
|
-
// Additional object properties would be added here
|
|
234
|
-
}));
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
```
|
|
238
|
-
|
|
239
208
|
## Error Handling
|
|
240
209
|
|
|
241
210
|
The SDK provides comprehensive error handling with consistent error responses and access to original error objects for debugging.
|
|
@@ -335,12 +304,6 @@ import type {
|
|
|
335
304
|
GetGroupByExternalIdRequest,
|
|
336
305
|
GetGroupByExternalIdResponse,
|
|
337
306
|
|
|
338
|
-
// Data operation types
|
|
339
|
-
FetchDataRequest,
|
|
340
|
-
FetchDataResponse,
|
|
341
|
-
TransformDataRequest,
|
|
342
|
-
TransformDataResponse,
|
|
343
|
-
|
|
344
307
|
// Common types
|
|
345
308
|
DeleteObjectsByExternalIdRequest,
|
|
346
309
|
DeleteObjectsByExternalIdResponse,
|
|
@@ -362,4 +325,4 @@ The SDK automatically handles authentication and configuration through the Forge
|
|
|
362
325
|
1. **Always check success flag**: Verify `result.success` before accessing response data
|
|
363
326
|
2. **Handle errors gracefully**: Use the `error` field for user-facing messages and `originalError` for debugging
|
|
364
327
|
3. **Validate input**: The SDK will throw validation errors for invalid input, so handle them appropriately
|
|
365
|
-
|
|
328
|
+
4. **Monitor rate limits**: The SDK handles rate limiting automatically, but monitor for `429` errors
|
|
@@ -12,6 +12,14 @@ describe('TeamWorkGraphClient - Error Handling Functions', () => {
|
|
|
12
12
|
expect(result.originalError).toBe(validationError);
|
|
13
13
|
expect(result.results).toBeUndefined();
|
|
14
14
|
});
|
|
15
|
+
test('should handle network errors correctly', () => {
|
|
16
|
+
const networkError = new errors_1.ForgeTeamWorkGraphNetworkError('Connection timeout');
|
|
17
|
+
const result = (0, error_handling_1.handleError)(networkError, 'set objects');
|
|
18
|
+
expect(result.success).toBe(false);
|
|
19
|
+
expect(result.error).toBe('Connection timeout');
|
|
20
|
+
expect(result.originalError).toBe(networkError);
|
|
21
|
+
expect(result.results).toBeUndefined();
|
|
22
|
+
});
|
|
15
23
|
test('should handle generic errors correctly', () => {
|
|
16
24
|
const genericError = new Error('Network timeout');
|
|
17
25
|
const result = (0, error_handling_1.handleError)(genericError, 'delete objects');
|
|
@@ -21,26 +29,22 @@ describe('TeamWorkGraphClient - Error Handling Functions', () => {
|
|
|
21
29
|
});
|
|
22
30
|
test('should handle unknown errors correctly', () => {
|
|
23
31
|
const unknownError = 'Something went wrong';
|
|
24
|
-
const result = (0, error_handling_1.handleError)(unknownError, '
|
|
32
|
+
const result = (0, error_handling_1.handleError)(unknownError, 'set objects');
|
|
25
33
|
expect(result.success).toBe(false);
|
|
26
|
-
expect(result.error).toBe('Failed to
|
|
34
|
+
expect(result.error).toBe('Failed to set objects: Unknown error');
|
|
27
35
|
expect(result.originalError).toBe(unknownError);
|
|
28
|
-
expect(result.
|
|
36
|
+
expect(result.results).toBeUndefined();
|
|
29
37
|
});
|
|
30
38
|
test('should work with different response types', () => {
|
|
31
39
|
const error = new Error('API rate limit exceeded');
|
|
32
40
|
const bulkResult = (0, error_handling_1.handleError)(error, 'set objects');
|
|
33
41
|
const deleteResult = (0, error_handling_1.handleError)(error, 'delete objects');
|
|
34
|
-
const fetchResult = (0, error_handling_1.handleError)(error, 'fetch data');
|
|
35
42
|
expect(bulkResult.success).toBe(false);
|
|
36
43
|
expect(deleteResult.success).toBe(false);
|
|
37
|
-
expect(fetchResult.success).toBe(false);
|
|
38
44
|
expect(bulkResult.error).toBe('Failed to set objects: API rate limit exceeded');
|
|
39
45
|
expect(deleteResult.error).toBe('Failed to delete objects: API rate limit exceeded');
|
|
40
|
-
expect(fetchResult.error).toBe('Failed to fetch data: API rate limit exceeded');
|
|
41
46
|
expect(bulkResult.originalError).toBe(error);
|
|
42
47
|
expect(deleteResult.originalError).toBe(error);
|
|
43
|
-
expect(fetchResult.originalError).toBe(error);
|
|
44
48
|
});
|
|
45
49
|
});
|
|
46
50
|
});
|
|
@@ -191,121 +191,4 @@ describe('TeamWorkGraphClient - Validators', () => {
|
|
|
191
191
|
expect(() => (0, validators_1.validateDeleteObjectsByPropertiesRequest)(properties)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
192
192
|
});
|
|
193
193
|
});
|
|
194
|
-
describe('validateFetchDataRequest', () => {
|
|
195
|
-
it('should pass with valid request', () => {
|
|
196
|
-
const request = {
|
|
197
|
-
requestConfig: {
|
|
198
|
-
url: 'https://api.example.com/data',
|
|
199
|
-
method: 'GET',
|
|
200
|
-
headers: {}
|
|
201
|
-
},
|
|
202
|
-
onResult: jest.fn()
|
|
203
|
-
};
|
|
204
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(request)).not.toThrow();
|
|
205
|
-
});
|
|
206
|
-
it('should throw validation error for non-object request', () => {
|
|
207
|
-
expect(() => (0, validators_1.validateFetchDataRequest)('invalid')).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
208
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(null)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
209
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(undefined)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
210
|
-
});
|
|
211
|
-
it('should throw validation error for missing requestConfig', () => {
|
|
212
|
-
const request = { onResult: jest.fn() };
|
|
213
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(request)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
214
|
-
});
|
|
215
|
-
it('should throw validation error for non-object requestConfig', () => {
|
|
216
|
-
const request = {
|
|
217
|
-
requestConfig: 'invalid',
|
|
218
|
-
onResult: jest.fn()
|
|
219
|
-
};
|
|
220
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(request)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
221
|
-
});
|
|
222
|
-
it('should throw validation error for missing url', () => {
|
|
223
|
-
const request = {
|
|
224
|
-
requestConfig: {
|
|
225
|
-
method: 'GET',
|
|
226
|
-
headers: {}
|
|
227
|
-
},
|
|
228
|
-
onResult: jest.fn()
|
|
229
|
-
};
|
|
230
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(request)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
231
|
-
});
|
|
232
|
-
it('should throw validation error for non-string url', () => {
|
|
233
|
-
const request = {
|
|
234
|
-
requestConfig: {
|
|
235
|
-
url: 123,
|
|
236
|
-
method: 'GET',
|
|
237
|
-
headers: {}
|
|
238
|
-
},
|
|
239
|
-
onResult: jest.fn()
|
|
240
|
-
};
|
|
241
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(request)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
242
|
-
});
|
|
243
|
-
it('should throw validation error for missing method', () => {
|
|
244
|
-
const request = {
|
|
245
|
-
requestConfig: {
|
|
246
|
-
url: 'https://api.example.com/data',
|
|
247
|
-
headers: {}
|
|
248
|
-
},
|
|
249
|
-
onResult: jest.fn()
|
|
250
|
-
};
|
|
251
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(request)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
252
|
-
});
|
|
253
|
-
it('should throw validation error for non-string method', () => {
|
|
254
|
-
const request = {
|
|
255
|
-
requestConfig: {
|
|
256
|
-
url: 'https://api.example.com/data',
|
|
257
|
-
method: 123,
|
|
258
|
-
headers: {}
|
|
259
|
-
},
|
|
260
|
-
onResult: jest.fn()
|
|
261
|
-
};
|
|
262
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(request)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
263
|
-
});
|
|
264
|
-
it('should throw validation error for missing onResult', () => {
|
|
265
|
-
const request = {
|
|
266
|
-
requestConfig: {
|
|
267
|
-
url: 'https://api.example.com/data',
|
|
268
|
-
method: 'GET',
|
|
269
|
-
headers: {}
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(request)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
273
|
-
});
|
|
274
|
-
it('should throw validation error for non-function onResult', () => {
|
|
275
|
-
const request = {
|
|
276
|
-
requestConfig: {
|
|
277
|
-
url: 'https://api.example.com/data',
|
|
278
|
-
method: 'GET',
|
|
279
|
-
headers: {}
|
|
280
|
-
},
|
|
281
|
-
onResult: 'not a function'
|
|
282
|
-
};
|
|
283
|
-
expect(() => (0, validators_1.validateFetchDataRequest)(request)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
describe('validateTransformDataRequest', () => {
|
|
287
|
-
it('should pass with valid request', () => {
|
|
288
|
-
const request = {
|
|
289
|
-
data: { key: 'value' },
|
|
290
|
-
transformMethod: jest.fn()
|
|
291
|
-
};
|
|
292
|
-
expect(() => (0, validators_1.validateTransformDataRequest)(request)).not.toThrow();
|
|
293
|
-
});
|
|
294
|
-
it('should throw validation error for non-object request', () => {
|
|
295
|
-
expect(() => (0, validators_1.validateTransformDataRequest)('invalid')).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
296
|
-
expect(() => (0, validators_1.validateTransformDataRequest)(null)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
297
|
-
expect(() => (0, validators_1.validateTransformDataRequest)(undefined)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
298
|
-
});
|
|
299
|
-
it('should throw validation error for missing transformMethod', () => {
|
|
300
|
-
const request = { data: { key: 'value' } };
|
|
301
|
-
expect(() => (0, validators_1.validateTransformDataRequest)(request)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
302
|
-
});
|
|
303
|
-
it('should throw validation error for non-function transformMethod', () => {
|
|
304
|
-
const request = {
|
|
305
|
-
data: { key: 'value' },
|
|
306
|
-
transformMethod: 'not a function'
|
|
307
|
-
};
|
|
308
|
-
expect(() => (0, validators_1.validateTransformDataRequest)(request)).toThrow(errors_1.ForgeTeamWorkGraphValidationError);
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
194
|
});
|
package/out/graph.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TeamWorkGraph, SetObjectsRequest, BulkObjectResponse, BulkUsersRequest, BulkUsersResponse, DeleteUsersByExternalIdRequest, DeleteUsersByExternalIdResponse, GetUserByExternalIdRequest, GetUserByExternalIdResponse, MapUsersRequest, MapUsersResponse, BulkGroupsRequest, BulkGroupsResponse, DeleteGroupsByExternalIdRequest, DeleteGroupsByExternalIdResponse, GetGroupByExternalIdRequest, GetGroupByExternalIdResponse, GetObjectByExternalIdRequest, GetObjectByExternalIdResponse, DeleteObjectsByExternalIdRequest, DeleteObjectsByExternalIdResponse, DeleteObjectsByPropertiesRequest, DeleteObjectsByPropertiesResponse
|
|
1
|
+
import { TeamWorkGraph, SetObjectsRequest, BulkObjectResponse, BulkUsersRequest, BulkUsersResponse, DeleteUsersByExternalIdRequest, DeleteUsersByExternalIdResponse, GetUserByExternalIdRequest, GetUserByExternalIdResponse, MapUsersRequest, MapUsersResponse, BulkGroupsRequest, BulkGroupsResponse, DeleteGroupsByExternalIdRequest, DeleteGroupsByExternalIdResponse, GetGroupByExternalIdRequest, GetGroupByExternalIdResponse, GetObjectByExternalIdRequest, GetObjectByExternalIdResponse, DeleteObjectsByExternalIdRequest, DeleteObjectsByExternalIdResponse, DeleteObjectsByPropertiesRequest, DeleteObjectsByPropertiesResponse } from './types';
|
|
2
2
|
export declare class TeamWorkGraphClient implements TeamWorkGraph {
|
|
3
3
|
setObjects: (request: SetObjectsRequest) => Promise<BulkObjectResponse>;
|
|
4
4
|
getObjectByExternalId: (request: GetObjectByExternalIdRequest) => Promise<GetObjectByExternalIdResponse>;
|
|
@@ -11,8 +11,6 @@ export declare class TeamWorkGraphClient implements TeamWorkGraph {
|
|
|
11
11
|
deleteUsersByExternalId: (request: DeleteUsersByExternalIdRequest) => Promise<DeleteUsersByExternalIdResponse>;
|
|
12
12
|
getUserByExternalId: (request: GetUserByExternalIdRequest) => Promise<GetUserByExternalIdResponse>;
|
|
13
13
|
mapUsers: (request: MapUsersRequest) => Promise<MapUsersResponse>;
|
|
14
|
-
fetchData: (request: FetchDataRequest) => Promise<FetchDataResponse>;
|
|
15
|
-
transformData: (request: TransformDataRequest) => Promise<TransformDataResponse>;
|
|
16
14
|
private sendRequest;
|
|
17
15
|
}
|
|
18
16
|
export declare const teamworkgraph: TeamWorkGraphClient;
|
package/out/graph.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,8BAA8B,EAC9B,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,+BAA+B,EAC/B,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,iCAAiC,EACjC,gCAAgC,EAChC,iCAAiC,EAClC,MAAM,SAAS,CAAC;AAEjB,qBAAa,mBAAoB,YAAW,aAAa;IACvD,UAAU,YAAmB,iBAAiB,KAAG,QAAQ,kBAAkB,CAAC,CAoB1E;IAKF,qBAAqB,YAAmB,4BAA4B,KAAG,QAAQ,6BAA6B,CAAC,CAoB3G;IAKF,yBAAyB,YACd,gCAAgC,KACxC,QAAQ,iCAAiC,CAAC,CAe3C;IAKF,yBAAyB,YACd,gCAAgC,KACxC,QAAQ,iCAAiC,CAAC,CAc3C;IAKF,SAAS,YAAmB,iBAAiB,KAAG,QAAQ,kBAAkB,CAAC,CAmBzE;IAKF,wBAAwB,YACb,+BAA+B,KACvC,QAAQ,gCAAgC,CAAC,CAgB1C;IAKF,oBAAoB,YAAmB,2BAA2B,KAAG,QAAQ,4BAA4B,CAAC,CAgBxG;IAEF,QAAQ,YAAmB,gBAAgB,KAAG,QAAQ,iBAAiB,CAAC,CAoBtE;IAEF,uBAAuB,YACZ,8BAA8B,KACtC,QAAQ,+BAA+B,CAAC,CAgBzC;IAEF,mBAAmB,YAAmB,0BAA0B,KAAG,QAAQ,2BAA2B,CAAC,CAgBrG;IAEF,QAAQ,YAAmB,eAAe,KAAG,QAAQ,gBAAgB,CAAC,CAapE;YAEY,WAAW;CA2B1B;AAED,eAAO,MAAM,aAAa,qBAA4B,CAAC"}
|
package/out/graph.js
CHANGED
|
@@ -202,44 +202,6 @@ class TeamWorkGraphClient {
|
|
|
202
202
|
return (0, error_handling_1.handleError)(error, 'map users');
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
|
-
fetchData = async (request) => {
|
|
206
|
-
(0, validators_1.validateFetchDataRequest)(request);
|
|
207
|
-
try {
|
|
208
|
-
const { requestConfig, onResult } = request;
|
|
209
|
-
const { url, method, headers } = requestConfig;
|
|
210
|
-
const res = await (0, api_1.fetch)(url, {
|
|
211
|
-
method: method,
|
|
212
|
-
headers: headers
|
|
213
|
-
});
|
|
214
|
-
if (!res.ok) {
|
|
215
|
-
throw new errors_1.ForgeTeamWorkGraphFetchError(`Remote call failed with status: ${res.status}`);
|
|
216
|
-
}
|
|
217
|
-
const data = await res.json();
|
|
218
|
-
onResult(data);
|
|
219
|
-
return {
|
|
220
|
-
success: true,
|
|
221
|
-
data: data
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
225
|
-
return (0, error_handling_1.handleError)(error, 'fetch data');
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
transformData = async (request) => {
|
|
229
|
-
(0, validators_1.validateTransformDataRequest)(request);
|
|
230
|
-
try {
|
|
231
|
-
const { data, transformMethod } = request;
|
|
232
|
-
const transformedData = transformMethod(data);
|
|
233
|
-
return {
|
|
234
|
-
success: true,
|
|
235
|
-
transformedData: transformedData
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
catch (error) {
|
|
239
|
-
const transformError = new errors_1.ForgeTeamWorkGraphTransformError('Transform failed', error instanceof Error ? error : undefined);
|
|
240
|
-
return (0, error_handling_1.handleError)(transformError, 'transform data');
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
205
|
async sendRequest(path, options) {
|
|
244
206
|
try {
|
|
245
207
|
const reqPath = (0, endpoints_1.getFullPath)(path);
|
package/out/types/graph.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { SetObjectsRequest, BulkObjectResponse, BulkUsersRequest, BulkUsersResponse, DeleteUsersByExternalIdRequest, DeleteUsersByExternalIdResponse, GetUserByExternalIdRequest, GetUserByExternalIdResponse, MapUsersRequest, MapUsersResponse, BulkGroupsRequest, BulkGroupsResponse, DeleteGroupsByExternalIdRequest, DeleteGroupsByExternalIdResponse, GetGroupByExternalIdRequest, GetGroupByExternalIdResponse, GetObjectByExternalIdRequest, GetObjectByExternalIdResponse, DeleteObjectsByExternalIdRequest, DeleteObjectsByExternalIdResponse, DeleteObjectsByPropertiesRequest, DeleteObjectsByPropertiesResponse
|
|
1
|
+
import { SetObjectsRequest, BulkObjectResponse, BulkUsersRequest, BulkUsersResponse, DeleteUsersByExternalIdRequest, DeleteUsersByExternalIdResponse, GetUserByExternalIdRequest, GetUserByExternalIdResponse, MapUsersRequest, MapUsersResponse, BulkGroupsRequest, BulkGroupsResponse, DeleteGroupsByExternalIdRequest, DeleteGroupsByExternalIdResponse, GetGroupByExternalIdRequest, GetGroupByExternalIdResponse, GetObjectByExternalIdRequest, GetObjectByExternalIdResponse, DeleteObjectsByExternalIdRequest, DeleteObjectsByExternalIdResponse, DeleteObjectsByPropertiesRequest, DeleteObjectsByPropertiesResponse } from './';
|
|
2
2
|
export interface TeamWorkGraph {
|
|
3
3
|
setObjects(request: SetObjectsRequest): Promise<BulkObjectResponse>;
|
|
4
4
|
getObjectByExternalId(request: GetObjectByExternalIdRequest): Promise<GetObjectByExternalIdResponse>;
|
|
5
5
|
deleteObjectsByExternalId(request: DeleteObjectsByExternalIdRequest): Promise<DeleteObjectsByExternalIdResponse>;
|
|
6
6
|
deleteObjectsByProperties(request: DeleteObjectsByPropertiesRequest): Promise<DeleteObjectsByPropertiesResponse>;
|
|
7
|
-
fetchData(request: FetchDataRequest): Promise<FetchDataResponse>;
|
|
8
|
-
transformData(request: TransformDataRequest): Promise<TransformDataResponse>;
|
|
9
7
|
setUsers(request: BulkUsersRequest): Promise<BulkUsersResponse>;
|
|
10
8
|
deleteUsersByExternalId(request: DeleteUsersByExternalIdRequest): Promise<DeleteUsersByExternalIdResponse>;
|
|
11
9
|
getUserByExternalId(request: GetUserByExternalIdRequest): Promise<GetUserByExternalIdResponse>;
|
package/out/types/graph.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/types/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,8BAA8B,EAC9B,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,+BAA+B,EAC/B,gCAAgC,EAChC,2BAA2B,EAC3B,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,iCAAiC,EACjC,gCAAgC,EAChC,iCAAiC,
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/types/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,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4 @@ export declare type GetGroupByExternalIdResponse = {
|
|
|
180
180
|
error?: string;
|
|
181
181
|
originalError?: unknown;
|
|
182
182
|
};
|
|
183
|
-
export declare type FetchDataRequest = {
|
|
184
|
-
requestConfig: {
|
|
185
|
-
url: string;
|
|
186
|
-
method: string;
|
|
187
|
-
headers?: Record<string, string>;
|
|
188
|
-
};
|
|
189
|
-
onResult: (data: any) => any;
|
|
190
|
-
};
|
|
191
|
-
export declare type FetchDataResponse = {
|
|
192
|
-
success: boolean;
|
|
193
|
-
data?: any;
|
|
194
|
-
error?: string;
|
|
195
|
-
originalError?: unknown;
|
|
196
|
-
};
|
|
197
|
-
export declare type TransformDataRequest = {
|
|
198
|
-
data: any;
|
|
199
|
-
transformMethod: (data: any) => any;
|
|
200
|
-
};
|
|
201
|
-
export declare type TransformDataResponse = {
|
|
202
|
-
success: boolean;
|
|
203
|
-
transformedData?: any;
|
|
204
|
-
error?: string;
|
|
205
|
-
originalError?: unknown;
|
|
206
|
-
};
|
|
207
183
|
//# sourceMappingURL=requests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/types/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAGpE,oBAAY,iBAAiB,GAAG;IAC9B,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAAC;AAEF,oBAAY,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C,oBAAY,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,oBAAY,cAAc,GAAG;IA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AY,4BAA4B,GAAG;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/utils/error-handling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/utils/error-handling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgBzC,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAoDhG;AAwBD,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,CAQnE"}
|
|
@@ -58,10 +58,7 @@ function createErrorMessage(error, operation) {
|
|
|
58
58
|
if (error instanceof errors_1.ForgeTeamWorkGraphAPIError) {
|
|
59
59
|
return `Failed to ${operation}: ${error.message}`;
|
|
60
60
|
}
|
|
61
|
-
if (error instanceof errors_1.
|
|
62
|
-
return error.message;
|
|
63
|
-
}
|
|
64
|
-
if (error instanceof errors_1.ForgeTeamWorkGraphTransformError) {
|
|
61
|
+
if (error instanceof errors_1.ForgeTeamWorkGraphNetworkError) {
|
|
65
62
|
return error.message;
|
|
66
63
|
}
|
|
67
64
|
return `Failed to ${operation}: ${error instanceof Error ? error.message : 'Unknown error'}`;
|
package/out/utils/errors.d.ts
CHANGED
|
@@ -15,10 +15,4 @@ export declare class ForgeTeamWorkGraphAPIError extends ForgeTeamWorkGraphError
|
|
|
15
15
|
readonly responseBody?: any;
|
|
16
16
|
constructor(message: string, status: number, responseBody?: any);
|
|
17
17
|
}
|
|
18
|
-
export declare class ForgeTeamWorkGraphFetchError extends ForgeTeamWorkGraphError {
|
|
19
|
-
constructor(message: string, cause?: Error);
|
|
20
|
-
}
|
|
21
|
-
export declare class ForgeTeamWorkGraphTransformError extends ForgeTeamWorkGraphError {
|
|
22
|
-
constructor(message: string, cause?: Error);
|
|
23
|
-
}
|
|
24
18
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAGA,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,KAAK,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAgB,OAAO,CAAC,EAAE,GAAG,CAAC;gBAElB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;CAOzE;AAKD,qBAAa,iCAAkC,SAAQ,uBAAuB;gBAChE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;CAG3D;AAKD,qBAAa,8BAA+B,SAAQ,uBAAuB;gBAC7D,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAG3C;AAKD,qBAAa,0BAA2B,SAAQ,uBAAuB;IACrE,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,YAAY,CAAC,EAAE,GAAG,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,GAAG;CAKhE
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAGA,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,KAAK,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAgB,OAAO,CAAC,EAAE,GAAG,CAAC;gBAElB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;CAOzE;AAKD,qBAAa,iCAAkC,SAAQ,uBAAuB;gBAChE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;CAG3D;AAKD,qBAAa,8BAA+B,SAAQ,uBAAuB;gBAC7D,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAG3C;AAKD,qBAAa,0BAA2B,SAAQ,uBAAuB;IACrE,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,YAAY,CAAC,EAAE,GAAG,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,GAAG;CAKhE"}
|
package/out/utils/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ForgeTeamWorkGraphAPIError = exports.ForgeTeamWorkGraphNetworkError = exports.ForgeTeamWorkGraphValidationError = exports.ForgeTeamWorkGraphError = void 0;
|
|
4
4
|
class ForgeTeamWorkGraphError extends Error {
|
|
5
5
|
code;
|
|
6
6
|
field;
|
|
@@ -36,15 +36,3 @@ class ForgeTeamWorkGraphAPIError extends ForgeTeamWorkGraphError {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
exports.ForgeTeamWorkGraphAPIError = ForgeTeamWorkGraphAPIError;
|
|
39
|
-
class ForgeTeamWorkGraphFetchError extends ForgeTeamWorkGraphError {
|
|
40
|
-
constructor(message, cause) {
|
|
41
|
-
super(message, 'FETCH_ERROR', undefined, { cause: cause?.message });
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.ForgeTeamWorkGraphFetchError = ForgeTeamWorkGraphFetchError;
|
|
45
|
-
class ForgeTeamWorkGraphTransformError extends ForgeTeamWorkGraphError {
|
|
46
|
-
constructor(message, cause) {
|
|
47
|
-
super(message, 'TRANSFORM_ERROR', undefined, { cause: cause?.message });
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.ForgeTeamWorkGraphTransformError = ForgeTeamWorkGraphTransformError;
|
|
@@ -23,6 +23,4 @@ export declare function validateGetUserByExternalIdRequest(externalId: string):
|
|
|
23
23
|
export declare function validateGetGroupByExternalIdRequest(externalId: string): void;
|
|
24
24
|
export declare function validateMapUsersRequest(directMappings: any[]): void;
|
|
25
25
|
export declare function validateDeleteObjectsByPropertiesRequest(properties: Record<string, string>): void;
|
|
26
|
-
export declare function validateFetchDataRequest(request: any): void;
|
|
27
|
-
export declare function validateTransformDataRequest(request: any): void;
|
|
28
26
|
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAKvC,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAOjE;AASD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,GAAG,EA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uBAAuB,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAG1D;AAKD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAG5D;AAKD,wBAAgB,wCAAwC,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAIxG;AAKD,wBAAgB,sCAAsC,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAGlF;AAKD,wBAAgB,uCAAuC,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAGnF;AAKD,wBAAgB,oCAAoC,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAGjG;AAKD,wBAAgB,kCAAkC,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAE3E;AAKD,wBAAgB,mCAAmC,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAE5E;AAKD,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAmBnE;AAKD,wBAAgB,wCAAwC,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAGjG"}
|
package/out/utils/validators.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.validateDeleteObjectsByPropertiesRequest = exports.validateMapUsersRequest = exports.validateGetGroupByExternalIdRequest = exports.validateGetUserByExternalIdRequest = exports.validateGetObjectByExternalIdRequest = exports.validateDeleteGroupsByExternalIdRequest = exports.validateDeleteUsersByExternalIdRequest = exports.validateDeleteObjectsByExternalIdRequest = exports.validateSetGroupsRequest = exports.validateSetUsersRequest = exports.validateSetObjectsRequest = exports.validatePropertyCount = exports.validateObject = exports.validateRequiredString = exports.validateArrayMaxLength = exports.validateArray = exports.MAX_PROPERTIES_DELETE = exports.MAX_BULK_GROUPS_DELETE = exports.MAX_BULK_USERS_DELETE = exports.MAX_PROPERTIES = exports.MAX_USER_MAPPINGS = exports.MAX_BULK_OBJECTS_DELETE = exports.MAX_BULK_GROUPS = exports.MAX_BULK_USERS = exports.MAX_BULK_OBJECTS = void 0;
|
|
4
4
|
const errors_1 = require("./errors");
|
|
5
5
|
exports.MAX_BULK_OBJECTS = 100;
|
|
6
6
|
exports.MAX_BULK_USERS = 100;
|
|
@@ -120,30 +120,3 @@ function validateDeleteObjectsByPropertiesRequest(properties) {
|
|
|
120
120
|
validatePropertyCount(properties, 'properties', exports.MAX_PROPERTIES_DELETE);
|
|
121
121
|
}
|
|
122
122
|
exports.validateDeleteObjectsByPropertiesRequest = validateDeleteObjectsByPropertiesRequest;
|
|
123
|
-
function validateFetchDataRequest(request) {
|
|
124
|
-
if (!request || typeof request !== 'object') {
|
|
125
|
-
throw new errors_1.ForgeTeamWorkGraphValidationError('request must be an object', 'request');
|
|
126
|
-
}
|
|
127
|
-
if (!request.requestConfig || typeof request.requestConfig !== 'object') {
|
|
128
|
-
throw new errors_1.ForgeTeamWorkGraphValidationError('requestConfig is required and must be an object', 'requestConfig');
|
|
129
|
-
}
|
|
130
|
-
if (!request.requestConfig.url || typeof request.requestConfig.url !== 'string') {
|
|
131
|
-
throw new errors_1.ForgeTeamWorkGraphValidationError('requestConfig.url is required and must be a string', 'requestConfig.url');
|
|
132
|
-
}
|
|
133
|
-
if (!request.requestConfig.method || typeof request.requestConfig.method !== 'string') {
|
|
134
|
-
throw new errors_1.ForgeTeamWorkGraphValidationError('requestConfig.method is required and must be a string', 'requestConfig.method');
|
|
135
|
-
}
|
|
136
|
-
if (!request.onResult || typeof request.onResult !== 'function') {
|
|
137
|
-
throw new errors_1.ForgeTeamWorkGraphValidationError('onResult is required and must be a function', 'onResult');
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
exports.validateFetchDataRequest = validateFetchDataRequest;
|
|
141
|
-
function validateTransformDataRequest(request) {
|
|
142
|
-
if (!request || typeof request !== 'object') {
|
|
143
|
-
throw new errors_1.ForgeTeamWorkGraphValidationError('request must be an object', 'request');
|
|
144
|
-
}
|
|
145
|
-
if (!request.transformMethod || typeof request.transformMethod !== 'function') {
|
|
146
|
-
throw new errors_1.ForgeTeamWorkGraphValidationError('transformMethod is required and must be a function', 'transformMethod');
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
exports.validateTransformDataRequest = validateTransformDataRequest;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-extended.test.d.ts","sourceRoot":"","sources":["../../src/__test__/graph-extended.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const api_1 = require("@forge/api");
|
|
4
|
-
const graph_1 = require("../graph");
|
|
5
|
-
jest.mock('@forge/api', () => ({
|
|
6
|
-
__fetchProduct: jest.fn(),
|
|
7
|
-
fetch: jest.fn()
|
|
8
|
-
}));
|
|
9
|
-
describe('TeamWorkGraphClient - Extended Features', () => {
|
|
10
|
-
let graphClient;
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
graphClient = new graph_1.TeamWorkGraphClient();
|
|
13
|
-
jest.clearAllMocks();
|
|
14
|
-
});
|
|
15
|
-
describe('fetchData', () => {
|
|
16
|
-
it('should successfully fetch and process external data', async () => {
|
|
17
|
-
const mockData = { items: [{ id: 1, name: 'Task 1' }] };
|
|
18
|
-
const mockResponse = {
|
|
19
|
-
ok: true,
|
|
20
|
-
status: 200,
|
|
21
|
-
json: jest.fn().mockResolvedValue(mockData)
|
|
22
|
-
};
|
|
23
|
-
api_1.fetch.mockResolvedValue(mockResponse);
|
|
24
|
-
const request = {
|
|
25
|
-
requestConfig: {
|
|
26
|
-
url: 'https://api.gitbook.com/api/tasks',
|
|
27
|
-
method: 'GET',
|
|
28
|
-
headers: { Authorization: 'Bearer token' }
|
|
29
|
-
},
|
|
30
|
-
onResult: jest.fn()
|
|
31
|
-
};
|
|
32
|
-
const result = await graphClient.fetchData(request);
|
|
33
|
-
expect(api_1.fetch).toHaveBeenCalledWith('https://api.gitbook.com/api/tasks', {
|
|
34
|
-
method: 'GET',
|
|
35
|
-
headers: { Authorization: 'Bearer token' }
|
|
36
|
-
});
|
|
37
|
-
expect(request.onResult).toHaveBeenCalledWith(mockData);
|
|
38
|
-
expect(result).toEqual({
|
|
39
|
-
success: true,
|
|
40
|
-
data: mockData
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
it('should return error response when fetch fails', async () => {
|
|
44
|
-
const mockResponse = {
|
|
45
|
-
ok: false,
|
|
46
|
-
status: 401
|
|
47
|
-
};
|
|
48
|
-
api_1.fetch.mockResolvedValue(mockResponse);
|
|
49
|
-
const request = {
|
|
50
|
-
requestConfig: {
|
|
51
|
-
url: 'https://api.gitbook.com/api/tasks',
|
|
52
|
-
method: 'GET'
|
|
53
|
-
},
|
|
54
|
-
onResult: jest.fn()
|
|
55
|
-
};
|
|
56
|
-
const result = await graphClient.fetchData(request);
|
|
57
|
-
expect(result).toEqual({
|
|
58
|
-
success: false,
|
|
59
|
-
error: 'Remote call failed with status: 401',
|
|
60
|
-
originalError: expect.any(Error)
|
|
61
|
-
});
|
|
62
|
-
expect(request.onResult).not.toHaveBeenCalled();
|
|
63
|
-
});
|
|
64
|
-
it('should throw error for validation errors', async () => {
|
|
65
|
-
const request = {};
|
|
66
|
-
await expect(graphClient.fetchData(request)).rejects.toThrow('requestConfig is required and must be an object');
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
describe('transformData', () => {
|
|
70
|
-
it('should transform data using the provided transform method', async () => {
|
|
71
|
-
const inputData = { items: [{ id: 1, name: 'Task 1' }] };
|
|
72
|
-
const transformMethod = jest.fn().mockImplementation((data) => ({
|
|
73
|
-
entities: data.items.map((item) => ({
|
|
74
|
-
id: `task-${item.id}`,
|
|
75
|
-
name: item.name,
|
|
76
|
-
type: 'task'
|
|
77
|
-
}))
|
|
78
|
-
}));
|
|
79
|
-
const request = {
|
|
80
|
-
data: inputData,
|
|
81
|
-
transformMethod
|
|
82
|
-
};
|
|
83
|
-
const result = await graphClient.transformData(request);
|
|
84
|
-
expect(transformMethod).toHaveBeenCalledWith(inputData);
|
|
85
|
-
expect(result).toEqual({
|
|
86
|
-
success: true,
|
|
87
|
-
transformedData: {
|
|
88
|
-
entities: [{ id: 'task-1', name: 'Task 1', type: 'task' }]
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
it('should return error response when transform method throws', async () => {
|
|
93
|
-
const inputData = { items: [{ id: 1, name: 'Task 1' }] };
|
|
94
|
-
const transformMethod = jest.fn().mockImplementation(() => {
|
|
95
|
-
throw new Error('Transform failed');
|
|
96
|
-
});
|
|
97
|
-
const request = {
|
|
98
|
-
data: inputData,
|
|
99
|
-
transformMethod
|
|
100
|
-
};
|
|
101
|
-
const result = await graphClient.transformData(request);
|
|
102
|
-
expect(result).toEqual({
|
|
103
|
-
success: false,
|
|
104
|
-
error: 'Transform failed',
|
|
105
|
-
originalError: expect.any(Error)
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
it('should throw error for validation errors', async () => {
|
|
109
|
-
const request = {};
|
|
110
|
-
await expect(graphClient.transformData(request)).rejects.toThrow('transformMethod is required and must be a function');
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
});
|