@forge/teamwork-graph 1.2.0-next.4 → 1.2.0-next.5
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/out/__test__/entity-operations.test.js +76 -0
- package/out/types/entities/branch.d.ts +14 -0
- package/out/types/entities/branch.d.ts.map +1 -0
- package/out/types/entities/branch.js +2 -0
- package/out/types/entities/commit.d.ts +26 -0
- package/out/types/entities/commit.d.ts.map +1 -0
- package/out/types/entities/commit.js +2 -0
- package/out/types/entities/index.d.ts +4 -2
- package/out/types/entities/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -403,4 +403,80 @@ describe('TeamWorkGraphClient - deleteEntitiesByProperties', () => {
|
|
|
403
403
|
it('should throw error when properties object is empty', async () => {
|
|
404
404
|
await expect(graphClient.deleteEntitiesByProperties({})).rejects.toThrow('properties object cannot be empty');
|
|
405
405
|
});
|
|
406
|
+
it('posts branch entities to /api/v1/entities/bulk and returns response', async () => {
|
|
407
|
+
const branchEntity = {
|
|
408
|
+
schemaVersion: '2.0',
|
|
409
|
+
id: 'branch-1',
|
|
410
|
+
updateSequenceNumber: 1,
|
|
411
|
+
displayName: 'feature-branch',
|
|
412
|
+
url: 'https://github.com/org/repo/tree/feature-branch',
|
|
413
|
+
createdAt: '2024-07-09T14:27:37.000Z',
|
|
414
|
+
lastUpdatedAt: '2024-07-09T14:27:37.000Z',
|
|
415
|
+
permissions: {
|
|
416
|
+
accessControls: [
|
|
417
|
+
{
|
|
418
|
+
principals: [
|
|
419
|
+
{
|
|
420
|
+
type: 'EVERYONE'
|
|
421
|
+
}
|
|
422
|
+
]
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
},
|
|
426
|
+
'atlassian:branch': {}
|
|
427
|
+
};
|
|
428
|
+
const req = { entities: [branchEntity] };
|
|
429
|
+
const expected = { success: true, results: [{ entityId: 'branch-1', success: true }] };
|
|
430
|
+
mockFetch.mockResolvedValueOnce({
|
|
431
|
+
ok: true,
|
|
432
|
+
json: () => Promise.resolve(expected)
|
|
433
|
+
});
|
|
434
|
+
const result = await graphClient.setEntities(req);
|
|
435
|
+
expect(mockFetch).toHaveBeenCalledWith('/graph/connector/api/v1/entities/bulk', expect.objectContaining({ method: 'POST' }));
|
|
436
|
+
expect(result).toEqual(expected);
|
|
437
|
+
});
|
|
438
|
+
it('posts commit entities to /api/v1/entities/bulk and returns response', async () => {
|
|
439
|
+
const commitEntity = {
|
|
440
|
+
schemaVersion: '2.0',
|
|
441
|
+
id: 'commit-1',
|
|
442
|
+
updateSequenceNumber: 1,
|
|
443
|
+
displayName: 'abc123 - Add new feature',
|
|
444
|
+
url: 'https://github.com/org/repo/commit/abc123',
|
|
445
|
+
createdAt: '2024-07-09T14:27:37.000Z',
|
|
446
|
+
lastUpdatedAt: '2024-07-09T14:27:37.000Z',
|
|
447
|
+
permissions: {
|
|
448
|
+
accessControls: [
|
|
449
|
+
{
|
|
450
|
+
principals: [
|
|
451
|
+
{
|
|
452
|
+
type: 'EVERYONE'
|
|
453
|
+
}
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
]
|
|
457
|
+
},
|
|
458
|
+
'atlassian:commit': {
|
|
459
|
+
flags: ['flag1', 'flag2'],
|
|
460
|
+
fileCount: 10,
|
|
461
|
+
files: [
|
|
462
|
+
{
|
|
463
|
+
path: 'path/to/file.txt',
|
|
464
|
+
url: 'https://github.com/org/repo/blob/abc123/path/to/file.txt',
|
|
465
|
+
changeType: 'ADDED',
|
|
466
|
+
linesAdded: 10,
|
|
467
|
+
linesRemoved: 5
|
|
468
|
+
}
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
const req = { entities: [commitEntity] };
|
|
473
|
+
const expected = { success: true, results: [{ entityId: 'commit-1', success: true }] };
|
|
474
|
+
mockFetch.mockResolvedValueOnce({
|
|
475
|
+
ok: true,
|
|
476
|
+
json: () => Promise.resolve(expected)
|
|
477
|
+
});
|
|
478
|
+
const result = await graphClient.setEntities(req);
|
|
479
|
+
expect(mockFetch).toHaveBeenCalledWith('/graph/connector/api/v1/entities/bulk', expect.objectContaining({ method: 'POST' }));
|
|
480
|
+
expect(result).toEqual(expected);
|
|
481
|
+
});
|
|
406
482
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseEntityProperties } from '../common';
|
|
2
|
+
import { CommitEntity } from './commit';
|
|
3
|
+
export declare type BranchAttributes = {
|
|
4
|
+
name?: string;
|
|
5
|
+
lastCommit?: CommitEntity;
|
|
6
|
+
createPullRequestUrl?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare type BranchEntity = BaseEntityProperties & {
|
|
9
|
+
displayName: string;
|
|
10
|
+
lastUpdatedAt: string;
|
|
11
|
+
permissions: NonNullable<BaseEntityProperties['permissions']>;
|
|
12
|
+
'atlassian:branch': BranchAttributes;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=branch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/types/entities/branch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,oBAAY,YAAY,GAAG,oBAAoB,GAAG;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,CAAC;IAC9D,kBAAkB,EAAE,gBAAgB,CAAC;CACtC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseEntityProperties } from '../common';
|
|
2
|
+
import { User } from '../users';
|
|
3
|
+
export declare type FileInfo = {
|
|
4
|
+
path: string;
|
|
5
|
+
url: string;
|
|
6
|
+
changeType: string;
|
|
7
|
+
linesAdded: number;
|
|
8
|
+
linesRemoved: number;
|
|
9
|
+
};
|
|
10
|
+
export declare type CommitAttributes = {
|
|
11
|
+
hash?: string;
|
|
12
|
+
displayId?: string;
|
|
13
|
+
message?: string;
|
|
14
|
+
author?: User;
|
|
15
|
+
flags: string[];
|
|
16
|
+
fileCount: number;
|
|
17
|
+
files: FileInfo[];
|
|
18
|
+
authorTimestamp?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare type CommitEntity = BaseEntityProperties & {
|
|
21
|
+
displayName: string;
|
|
22
|
+
lastUpdatedAt: string;
|
|
23
|
+
permissions: NonNullable<BaseEntityProperties['permissions']>;
|
|
24
|
+
'atlassian:commit': CommitAttributes;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=commit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../../src/types/entities/commit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,oBAAY,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,oBAAY,YAAY,GAAG,oBAAoB,GAAG;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,CAAC;IAC9D,kBAAkB,EAAE,gBAAgB,CAAC;CACtC,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { BranchEntity } from './branch';
|
|
2
|
+
import { CommitEntity } from './commit';
|
|
1
3
|
import { DocumentEntity } from './document';
|
|
2
4
|
import { MessageEntity } from './message';
|
|
3
5
|
import { OrganisationEntity } from './organisation';
|
|
4
|
-
export { DocumentEntity, MessageEntity, OrganisationEntity };
|
|
5
|
-
export declare type Entity = DocumentEntity | MessageEntity | OrganisationEntity;
|
|
6
|
+
export { BranchEntity, CommitEntity, DocumentEntity, MessageEntity, OrganisationEntity };
|
|
7
|
+
export declare type Entity = BranchEntity | CommitEntity | DocumentEntity | MessageEntity | OrganisationEntity;
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;AAGzF,oBAAY,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,GAAG,kBAAkB,CAAC"}
|