@forge/teamwork-graph 5.3.3-next.0-experimental-1e95696 → 5.4.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/CHANGELOG.md +9 -3
- package/README.md +19 -3
- package/out/__test__/entity-operations.test.js +27 -0
- package/out/__test__/principal-types.test.d.ts +2 -0
- package/out/__test__/principal-types.test.d.ts.map +1 -0
- package/out/__test__/principal-types.test.js +17 -0
- package/out/types/objects/common.d.ts +1 -0
- package/out/types/objects/common.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
# @forge/teamwork-graph
|
|
2
2
|
|
|
3
|
-
## 5.
|
|
3
|
+
## 5.4.0-next.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Updated dependencies [
|
|
8
|
-
- @forge/api@8.
|
|
7
|
+
- Updated dependencies [8bb2533]
|
|
8
|
+
- @forge/api@8.5.0-next.3
|
|
9
|
+
|
|
10
|
+
## 5.4.0-next.1
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- e89e40b: Expose native Atlassian USER permissions through atlassianAccountId and document its mutual exclusivity with external id.
|
|
9
15
|
|
|
10
16
|
## 5.3.3-next.0
|
|
11
17
|
|
package/README.md
CHANGED
|
@@ -29,9 +29,7 @@ const document: DocumentObject = {
|
|
|
29
29
|
accessControls: [
|
|
30
30
|
{
|
|
31
31
|
principals: [
|
|
32
|
-
{
|
|
33
|
-
{ type: 'USER', id: 'user-123' }
|
|
34
|
-
}
|
|
32
|
+
{ type: 'USER', id: 'user-123' }
|
|
35
33
|
]
|
|
36
34
|
}
|
|
37
35
|
]
|
|
@@ -63,6 +61,24 @@ if (result.success) {
|
|
|
63
61
|
}
|
|
64
62
|
```
|
|
65
63
|
|
|
64
|
+
### User permissions
|
|
65
|
+
|
|
66
|
+
For a native Atlassian user, use their Atlassian account ID and omit `id`:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { types } from '@forge/teamwork-graph';
|
|
70
|
+
|
|
71
|
+
const permissions: types.Permissions = {
|
|
72
|
+
accessControls: [{ principals: [{ type: 'USER', atlassianAccountId: 'account-123' }] }]
|
|
73
|
+
};
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
For an external provider user, keep using `{ type: 'USER', id: 'external-user-123' }`
|
|
77
|
+
and the existing user mapping APIs. A `USER` principal requires exactly one non-empty
|
|
78
|
+
identifier: `id` or `atlassianAccountId`, never both. `atlassianAccountId` is only
|
|
79
|
+
supported for `USER`. Native user ACLs do not require an external user mapping;
|
|
80
|
+
normal connection, ingestion and read authorization checks still apply.
|
|
81
|
+
|
|
66
82
|
## Core Operations
|
|
67
83
|
|
|
68
84
|
### Object Management
|
|
@@ -114,6 +114,33 @@ describe('TeamWorkGraphClient - setObjects', () => {
|
|
|
114
114
|
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
115
115
|
expect(result).toEqual(expected);
|
|
116
116
|
});
|
|
117
|
+
it.each([
|
|
118
|
+
{ type: 'USER', atlassianAccountId: 'native-account-123' },
|
|
119
|
+
{ type: 'USER', id: 'external-user-123' }
|
|
120
|
+
])('retains the USER principal %j in the Forge HTTP body', async (principal) => {
|
|
121
|
+
const permissions = { accessControls: [{ principals: [principal] }] };
|
|
122
|
+
const document = {
|
|
123
|
+
schemaVersion: '1.0',
|
|
124
|
+
id: 'acl-document',
|
|
125
|
+
displayName: 'ACL document',
|
|
126
|
+
updateSequenceNumber: 1,
|
|
127
|
+
url: 'https://example.com/acl-document',
|
|
128
|
+
createdAt: '2026-11-03T00:00:00Z',
|
|
129
|
+
lastUpdatedAt: '2026-11-03T00:00:00Z',
|
|
130
|
+
permissions,
|
|
131
|
+
'atlassian:document': { type: { category: 'DOCUMENT' }, content: { mimeType: 'text/plain', text: 'ACL fixture' } }
|
|
132
|
+
};
|
|
133
|
+
mockFetch.mockResolvedValueOnce({ ok: true, json: async () => ({ accepted: [] }) });
|
|
134
|
+
await graphClient.setObjects({ objects: [document], connectionId: TEST_CONNECTION_ID });
|
|
135
|
+
expect(api_1.__fetchProduct).toHaveBeenCalledWith({ provider: 'app', remote: 'stargate', type: 'fpp' });
|
|
136
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({
|
|
137
|
+
method: 'POST',
|
|
138
|
+
headers: expect.objectContaining({ 'Atl-Connection-Id': TEST_CONNECTION_ID }),
|
|
139
|
+
body: JSON.stringify({ entities: [document] })
|
|
140
|
+
}));
|
|
141
|
+
const body = JSON.parse(mockFetch.mock.calls[0][1].body);
|
|
142
|
+
expect(body.entities[0].permissions.accessControls[0].principals).toEqual([principal]);
|
|
143
|
+
});
|
|
117
144
|
it('posts message entities to /api/v1/entities/bulk and returns response', async () => {
|
|
118
145
|
const messageObject = {
|
|
119
146
|
schemaVersion: '2.0',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principal-types.test.d.ts","sourceRoot":"","sources":["../../src/__test__/principal-types.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const expect_type_1 = require("expect-type");
|
|
4
|
+
describe('Principal contract', () => {
|
|
5
|
+
it('accepts native Atlassian users and existing external principals', () => {
|
|
6
|
+
(0, expect_type_1.expectTypeOf)().toMatchTypeOf();
|
|
7
|
+
(0, expect_type_1.expectTypeOf)().toMatchTypeOf();
|
|
8
|
+
(0, expect_type_1.expectTypeOf)().toMatchTypeOf();
|
|
9
|
+
(0, expect_type_1.expectTypeOf)().toMatchTypeOf();
|
|
10
|
+
(0, expect_type_1.expectTypeOf)().toMatchTypeOf();
|
|
11
|
+
});
|
|
12
|
+
it('rejects non-string identity values', () => {
|
|
13
|
+
(0, expect_type_1.expectTypeOf)().not.toMatchTypeOf();
|
|
14
|
+
(0, expect_type_1.expectTypeOf)().not.toMatchTypeOf();
|
|
15
|
+
(0, expect_type_1.expectTypeOf)().not.toMatchTypeOf();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -5,6 +5,7 @@ export type Action = 'READ' | 'SEARCH';
|
|
|
5
5
|
export type Principal = {
|
|
6
6
|
type: 'USER' | 'GROUP' | 'EVERYONE' | 'ATLASSIAN_WORKSPACE' | 'CONTAINER';
|
|
7
7
|
id?: string | null;
|
|
8
|
+
atlassianAccountId?: string | null;
|
|
8
9
|
};
|
|
9
10
|
export type AccessControl = {
|
|
10
11
|
principals: Principal[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/objects/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,qBAAqB,GAAG,WAAW,CAAC;IAC1E,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/objects/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvC,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,qBAAqB,GAAG,WAAW,CAAC;IAC1E,EAAE,CAA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6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/teamwork-graph",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0-next.2",
|
|
4
4
|
"description": "Forge TeamworkGraph SDK",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"typescript": "5.9.2"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@forge/api": "^8.
|
|
23
|
+
"@forge/api": "^8.5.0-next.3"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"registry": "https://packages.atlassian.com/api/npm/npm-public/"
|