@forge/teamwork-graph 3.1.0-next.3-experimental-f76634b → 3.1.0-next.4
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 +38 -16
- package/out/__test__/entity-operations.test.js +87 -144
- package/out/__test__/group-operations.test.js +41 -46
- package/out/__test__/user-operations.test.js +61 -48
- package/out/graph.d.ts.map +1 -1
- package/out/graph.js +31 -33
- package/out/types/requests.d.ts +11 -11
- package/out/types/requests.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -49,7 +49,10 @@ const document: DocumentObject = {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
const result = await graph.setObjects({
|
|
52
|
+
const result = await graph.setObjects({
|
|
53
|
+
objects: [document],
|
|
54
|
+
connectionId: 'data-source:connection-123'
|
|
55
|
+
});
|
|
53
56
|
|
|
54
57
|
if (result.success) {
|
|
55
58
|
console.log('Document created successfully:', result.results);
|
|
@@ -103,13 +106,15 @@ const document: DocumentObject = {
|
|
|
103
106
|
};
|
|
104
107
|
|
|
105
108
|
const bulkResult = await graph.setObjects({
|
|
106
|
-
objects: [document]
|
|
109
|
+
objects: [document],
|
|
110
|
+
connectionId: 'data-source:connection-123'
|
|
107
111
|
});
|
|
108
112
|
|
|
109
113
|
// Get object by external ID
|
|
110
114
|
const objectResult = await graph.getObjectByExternalId({
|
|
111
115
|
objectType: 'atlassian:document',
|
|
112
|
-
externalId: 'doc-123'
|
|
116
|
+
externalId: 'doc-123',
|
|
117
|
+
connectionId: 'data-source:connection-123'
|
|
113
118
|
});
|
|
114
119
|
|
|
115
120
|
if (objectResult.success) {
|
|
@@ -121,13 +126,18 @@ if (objectResult.success) {
|
|
|
121
126
|
// Delete objects by external IDs
|
|
122
127
|
const deleteResult = await graph.deleteObjectsByExternalId({
|
|
123
128
|
objectType: 'atlassian:document',
|
|
124
|
-
externalIds: ['doc-123', 'doc-456']
|
|
129
|
+
externalIds: ['doc-123', 'doc-456'],
|
|
130
|
+
connectionId: 'data-source:connection-123'
|
|
125
131
|
});
|
|
126
132
|
|
|
127
133
|
// Delete objects by properties
|
|
128
134
|
const deleteByPropsResult = await graph.deleteObjectsByProperties({
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
objectType: 'atlassian:document',
|
|
136
|
+
properties: {
|
|
137
|
+
environment: 'staging',
|
|
138
|
+
status: 'completed'
|
|
139
|
+
},
|
|
140
|
+
connectionId: 'data-source:connection-123'
|
|
131
141
|
});
|
|
132
142
|
```
|
|
133
143
|
|
|
@@ -147,17 +157,20 @@ const usersResult = await graph.setUsers({
|
|
|
147
157
|
],
|
|
148
158
|
updateSequenceNumber: 1
|
|
149
159
|
}
|
|
150
|
-
]
|
|
160
|
+
],
|
|
161
|
+
connectionId: 'data-source:connection-123'
|
|
151
162
|
});
|
|
152
163
|
|
|
153
164
|
// Get user by external ID
|
|
154
165
|
const userResult = await graph.getUserByExternalId({
|
|
155
|
-
externalId: 'user-123'
|
|
166
|
+
externalId: 'user-123',
|
|
167
|
+
connectionId: 'data-source:connection-123'
|
|
156
168
|
});
|
|
157
169
|
|
|
158
170
|
// Delete users by external IDs
|
|
159
171
|
const deleteUsersResult = await graph.deleteUsersByExternalId({
|
|
160
|
-
externalIds: ['user-123', 'user-456']
|
|
172
|
+
externalIds: ['user-123', 'user-456'],
|
|
173
|
+
connectionId: 'data-source:connection-123'
|
|
161
174
|
});
|
|
162
175
|
|
|
163
176
|
// Map users to Atlassian accounts
|
|
@@ -169,7 +182,8 @@ const mapResult = await graph.mapUsers({
|
|
|
169
182
|
updatedAt: Date.now(),
|
|
170
183
|
accountId: 'acc-123'
|
|
171
184
|
}
|
|
172
|
-
]
|
|
185
|
+
],
|
|
186
|
+
connectionId: 'data-source:connection-123'
|
|
173
187
|
});
|
|
174
188
|
```
|
|
175
189
|
|
|
@@ -186,17 +200,20 @@ const groupsResult = await graph.setGroups({
|
|
|
186
200
|
displayName: 'Developers',
|
|
187
201
|
description: 'Development team'
|
|
188
202
|
}
|
|
189
|
-
]
|
|
203
|
+
],
|
|
204
|
+
connectionId: 'data-source:connection-123'
|
|
190
205
|
});
|
|
191
206
|
|
|
192
207
|
// Get group by external ID
|
|
193
208
|
const groupResult = await graph.getGroupByExternalId({
|
|
194
|
-
externalId: 'group-123'
|
|
209
|
+
externalId: 'group-123',
|
|
210
|
+
connectionId: 'data-source:connection-123'
|
|
195
211
|
});
|
|
196
212
|
|
|
197
213
|
// Delete groups by external IDs
|
|
198
214
|
const deleteGroupsResult = await graph.deleteGroupsByExternalId({
|
|
199
|
-
externalIds: ['group-123', 'group-456']
|
|
215
|
+
externalIds: ['group-123', 'group-456'],
|
|
216
|
+
connectionId: 'data-source:connection-123'
|
|
200
217
|
});
|
|
201
218
|
```
|
|
202
219
|
|
|
@@ -299,7 +316,10 @@ The SDK uses specific error classes for different types of failures:
|
|
|
299
316
|
// The SDK handles errors internally and returns them in the response
|
|
300
317
|
// You can access error information through the response object:
|
|
301
318
|
|
|
302
|
-
const result = await graph.setObjects({
|
|
319
|
+
const result = await graph.setObjects({
|
|
320
|
+
objects: [],
|
|
321
|
+
connectionId: 'data-source:connection-123'
|
|
322
|
+
});
|
|
303
323
|
|
|
304
324
|
if (!result.success) {
|
|
305
325
|
console.error('Operation failed:', result.error);
|
|
@@ -317,7 +337,8 @@ if (!result.success) {
|
|
|
317
337
|
// Handle object operations
|
|
318
338
|
const result = await graph.getObjectByExternalId({
|
|
319
339
|
objectType: 'atlassian:document',
|
|
320
|
-
externalId: 'nonexistent'
|
|
340
|
+
externalId: 'nonexistent',
|
|
341
|
+
connectionId: 'data-source:connection-123'
|
|
321
342
|
});
|
|
322
343
|
|
|
323
344
|
if (!result.success) {
|
|
@@ -331,7 +352,8 @@ if (result.originalError) {
|
|
|
331
352
|
|
|
332
353
|
// Handle validation errors (these are returned in the response)
|
|
333
354
|
const result = await graph.setObjects({
|
|
334
|
-
objects: [] // Empty array will return error in response
|
|
355
|
+
objects: [], // Empty array will return error in response
|
|
356
|
+
connectionId: 'data-source:connection-123'
|
|
335
357
|
});
|
|
336
358
|
|
|
337
359
|
if (!result.success) {
|