@forge/teamwork-graph 1.2.0-next.1 → 1.2.0-next.2
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__/entities.test.js +38 -0
- package/out/types/entities/index.d.ts +3 -2
- package/out/types/entities/index.d.ts.map +1 -1
- package/out/types/entities/organisation.d.ts +9 -0
- package/out/types/entities/organisation.d.ts.map +1 -0
- package/out/types/entities/organisation.js +2 -0
- package/package.json +1 -1
|
@@ -146,4 +146,42 @@ describe('TeamWorkGraphClient - setEntities', () => {
|
|
|
146
146
|
const req = { entities: null };
|
|
147
147
|
await expect(graphClient.setEntities(req)).rejects.toThrow('entities must be an array');
|
|
148
148
|
});
|
|
149
|
+
it('posts organisation entities to /api/v1/entities/bulk and returns response', async () => {
|
|
150
|
+
const organisationEntity = {
|
|
151
|
+
schemaVersion: '2.0',
|
|
152
|
+
id: 'org-1',
|
|
153
|
+
updateSequenceNumber: 2,
|
|
154
|
+
displayName: 'pos 2',
|
|
155
|
+
url: 'https://workday.atlassian.com/path-to-org',
|
|
156
|
+
createdAt: '2024-07-09T14:27:37.000Z',
|
|
157
|
+
lastUpdatedAt: '2024-07-09T14:27:37.000Z',
|
|
158
|
+
permissions: {
|
|
159
|
+
accessControls: [
|
|
160
|
+
{
|
|
161
|
+
principals: [
|
|
162
|
+
{
|
|
163
|
+
type: 'EVERYONE'
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
parentKey: {
|
|
170
|
+
type: 'atlassian:organisation',
|
|
171
|
+
value: {
|
|
172
|
+
entityId: 'id of the parent org of this org'
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
'atlassian:organisation': {}
|
|
176
|
+
};
|
|
177
|
+
const req = { entities: [organisationEntity] };
|
|
178
|
+
const expected = { success: false, results: [{ entityId: 'org-1', success: true }] };
|
|
179
|
+
mockFetch.mockResolvedValueOnce({
|
|
180
|
+
ok: true,
|
|
181
|
+
json: () => Promise.resolve(expected)
|
|
182
|
+
});
|
|
183
|
+
const result = await graphClient.setEntities(req);
|
|
184
|
+
expect(mockFetch).toHaveBeenCalledWith('/graph/connector/api/v1/entities/bulk', expect.objectContaining({ method: 'POST' }));
|
|
185
|
+
expect(result).toEqual(expected);
|
|
186
|
+
});
|
|
149
187
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DocumentEntity } from './document';
|
|
2
2
|
import { MessageEntity } from './message';
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
import { OrganisationEntity } from './organisation';
|
|
4
|
+
export { DocumentEntity, MessageEntity, OrganisationEntity };
|
|
5
|
+
export declare type Entity = DocumentEntity | MessageEntity | OrganisationEntity;
|
|
5
6
|
//# 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;
|
|
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;AAG7D,oBAAY,MAAM,GAAG,cAAc,GAAG,aAAa,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseEntityProperties } from '../common';
|
|
2
|
+
export declare type OrganisationAttributes = {};
|
|
3
|
+
export declare type OrganisationEntity = BaseEntityProperties & {
|
|
4
|
+
displayName: string;
|
|
5
|
+
lastUpdatedAt: string;
|
|
6
|
+
permissions: NonNullable<BaseEntityProperties['permissions']>;
|
|
7
|
+
'atlassian:organisation': OrganisationAttributes;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=organisation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organisation.d.ts","sourceRoot":"","sources":["../../../src/types/entities/organisation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,oBAAY,sBAAsB,GAAG,EAAE,CAAC;AAExC,oBAAY,kBAAkB,GAAG,oBAAoB,GAAG;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,CAAC;IAC9D,wBAAwB,EAAE,sBAAsB,CAAC;CAClD,CAAC"}
|