@atlaskit/link-datasource 3.0.1 → 3.0.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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 3.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#141472](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141472)
8
+ [`fa7d87963ed8a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fa7d87963ed8a) -
9
+ Uses `objectTypesEntity` when available in DS data response as the Actions `entityType`. When
10
+ `entityType` is undefined it will not make request to `discoverActions`.
11
+ - Updated dependencies
12
+
3
13
  ## 3.0.1
4
14
 
5
15
  ### Patch Changes
@@ -226,6 +226,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
226
226
  _extensionKey,
227
227
  auth,
228
228
  _providerName,
229
+ objectTypesEntity,
229
230
  _yield$getDatasourceD5,
230
231
  items,
231
232
  nextPageCursor,
@@ -280,27 +281,28 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
280
281
  _extensionKey = _yield$getDatasourceD4.extensionKey;
281
282
  auth = _yield$getDatasourceD4.auth;
282
283
  _providerName = _yield$getDatasourceD4.providerName;
284
+ objectTypesEntity = _yield$getDatasourceD4.objectTypesEntity;
283
285
  _yield$getDatasourceD5 = _yield$getDatasourceD3.data;
284
286
  items = _yield$getDatasourceD5.items;
285
287
  nextPageCursor = _yield$getDatasourceD5.nextPageCursor;
286
288
  _totalCount = _yield$getDatasourceD5.totalCount;
287
289
  schema = _yield$getDatasourceD5.schema;
288
290
  if (!((_currentAbortControll = currentAbortController) !== null && _currentAbortControll !== void 0 && _currentAbortControll.signal.aborted)) {
289
- _context2.next = 28;
291
+ _context2.next = 29;
290
292
  break;
291
293
  }
292
294
  throw new Error('Aborted');
293
- case 28:
295
+ case 29:
294
296
  setExtensionKey(_extensionKey);
295
297
  setProviderName(_providerName);
296
298
  if (!(access === 'unauthorized' || access === 'forbidden')) {
297
- _context2.next = 34;
299
+ _context2.next = 35;
298
300
  break;
299
301
  }
300
302
  setStatus(access);
301
303
  setAuthDetails(auth || initialEmptyArray);
302
304
  return _context2.abrupt("return");
303
- case 34:
305
+ case 35:
304
306
  setDestinationObjectTypes(_destinationObjectTypes);
305
307
  setTotalCount(_totalCount);
306
308
  setNextCursor(nextPageCursor);
@@ -315,7 +317,10 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
315
317
  * Product is typed as any.
316
318
  */
317
319
  integrationKey = product;
318
- entityType = _destinationObjectTypes !== null && _destinationObjectTypes !== void 0 && _destinationObjectTypes.length ? _destinationObjectTypes[0] : undefined;
320
+ /**
321
+ * When `entityType` is undefined, we should not discover actions it prevents unnecessary requests to Actions service
322
+ */
323
+ entityType = objectTypesEntity;
319
324
  newIds = onAddItems(items, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
320
325
  setResponseItemIds(function (currentIds) {
321
326
  return [].concat((0, _toConsumableArray2.default)(currentIds), (0, _toConsumableArray2.default)(newIds));
@@ -357,38 +362,38 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
357
362
  });
358
363
  }
359
364
  setStatus('resolved');
360
- _context2.next = 59;
365
+ _context2.next = 60;
361
366
  break;
362
- case 47:
363
- _context2.prev = 47;
367
+ case 48:
368
+ _context2.prev = 48;
364
369
  _context2.t0 = _context2["catch"](10);
365
370
  if (!(_context2.t0.message === 'Aborted')) {
366
- _context2.next = 51;
371
+ _context2.next = 52;
367
372
  break;
368
373
  }
369
374
  return _context2.abrupt("return");
370
- case 51:
375
+ case 52:
371
376
  captureError('onNextPage', _context2.t0);
372
377
  if (!(_context2.t0 instanceof Response && _context2.t0.status === 401)) {
373
- _context2.next = 55;
378
+ _context2.next = 56;
374
379
  break;
375
380
  }
376
381
  setStatus('unauthorized');
377
382
  return _context2.abrupt("return");
378
- case 55:
383
+ case 56:
379
384
  if (!(_context2.t0 instanceof Response && _context2.t0.status === 403)) {
380
- _context2.next = 58;
385
+ _context2.next = 59;
381
386
  break;
382
387
  }
383
388
  setStatus('forbidden');
384
389
  return _context2.abrupt("return");
385
- case 58:
386
- setStatus('rejected');
387
390
  case 59:
391
+ setStatus('rejected');
392
+ case 60:
388
393
  case "end":
389
394
  return _context2.stop();
390
395
  }
391
- }, _callee2, null, [[10, 47]]);
396
+ }, _callee2, null, [[10, 48]]);
392
397
  })), [captureError, parameters, fieldKeys, nextCursor, responseItems, setResponseItemIds, onAddItems, getDatasourceData, datasourceId, applySchemaProperties, fireEvent, fullSchema, initialEmptyArray, discoverActions]);
393
398
  var reset = (0, _react.useCallback)(function (options) {
394
399
  setResponseItems(initialEmptyArray);
@@ -163,7 +163,8 @@ export const useDatasourceTableState = ({
163
163
  product,
164
164
  extensionKey,
165
165
  auth,
166
- providerName
166
+ providerName,
167
+ objectTypesEntity
167
168
  },
168
169
  data: {
169
170
  items,
@@ -199,7 +200,11 @@ export const useDatasourceTableState = ({
199
200
  * Product is typed as any.
200
201
  */
201
202
  const integrationKey = product;
202
- const entityType = destinationObjectTypes !== null && destinationObjectTypes !== void 0 && destinationObjectTypes.length ? destinationObjectTypes[0] : undefined;
203
+
204
+ /**
205
+ * When `entityType` is undefined, we should not discover actions it prevents unnecessary requests to Actions service
206
+ */
207
+ const entityType = objectTypesEntity;
203
208
  const newIds = onAddItems(items, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
204
209
  setResponseItemIds(currentIds => [...currentIds, ...newIds]);
205
210
  if (fg('platform-datasources-enable-two-way-sync')) {
@@ -219,6 +219,7 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
219
219
  _extensionKey,
220
220
  auth,
221
221
  _providerName,
222
+ objectTypesEntity,
222
223
  _yield$getDatasourceD5,
223
224
  items,
224
225
  nextPageCursor,
@@ -273,27 +274,28 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
273
274
  _extensionKey = _yield$getDatasourceD4.extensionKey;
274
275
  auth = _yield$getDatasourceD4.auth;
275
276
  _providerName = _yield$getDatasourceD4.providerName;
277
+ objectTypesEntity = _yield$getDatasourceD4.objectTypesEntity;
276
278
  _yield$getDatasourceD5 = _yield$getDatasourceD3.data;
277
279
  items = _yield$getDatasourceD5.items;
278
280
  nextPageCursor = _yield$getDatasourceD5.nextPageCursor;
279
281
  _totalCount = _yield$getDatasourceD5.totalCount;
280
282
  schema = _yield$getDatasourceD5.schema;
281
283
  if (!((_currentAbortControll = currentAbortController) !== null && _currentAbortControll !== void 0 && _currentAbortControll.signal.aborted)) {
282
- _context2.next = 28;
284
+ _context2.next = 29;
283
285
  break;
284
286
  }
285
287
  throw new Error('Aborted');
286
- case 28:
288
+ case 29:
287
289
  setExtensionKey(_extensionKey);
288
290
  setProviderName(_providerName);
289
291
  if (!(access === 'unauthorized' || access === 'forbidden')) {
290
- _context2.next = 34;
292
+ _context2.next = 35;
291
293
  break;
292
294
  }
293
295
  setStatus(access);
294
296
  setAuthDetails(auth || initialEmptyArray);
295
297
  return _context2.abrupt("return");
296
- case 34:
298
+ case 35:
297
299
  setDestinationObjectTypes(_destinationObjectTypes);
298
300
  setTotalCount(_totalCount);
299
301
  setNextCursor(nextPageCursor);
@@ -308,7 +310,10 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
308
310
  * Product is typed as any.
309
311
  */
310
312
  integrationKey = product;
311
- entityType = _destinationObjectTypes !== null && _destinationObjectTypes !== void 0 && _destinationObjectTypes.length ? _destinationObjectTypes[0] : undefined;
313
+ /**
314
+ * When `entityType` is undefined, we should not discover actions it prevents unnecessary requests to Actions service
315
+ */
316
+ entityType = objectTypesEntity;
312
317
  newIds = onAddItems(items, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
313
318
  setResponseItemIds(function (currentIds) {
314
319
  return [].concat(_toConsumableArray(currentIds), _toConsumableArray(newIds));
@@ -350,38 +355,38 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
350
355
  });
351
356
  }
352
357
  setStatus('resolved');
353
- _context2.next = 59;
358
+ _context2.next = 60;
354
359
  break;
355
- case 47:
356
- _context2.prev = 47;
360
+ case 48:
361
+ _context2.prev = 48;
357
362
  _context2.t0 = _context2["catch"](10);
358
363
  if (!(_context2.t0.message === 'Aborted')) {
359
- _context2.next = 51;
364
+ _context2.next = 52;
360
365
  break;
361
366
  }
362
367
  return _context2.abrupt("return");
363
- case 51:
368
+ case 52:
364
369
  captureError('onNextPage', _context2.t0);
365
370
  if (!(_context2.t0 instanceof Response && _context2.t0.status === 401)) {
366
- _context2.next = 55;
371
+ _context2.next = 56;
367
372
  break;
368
373
  }
369
374
  setStatus('unauthorized');
370
375
  return _context2.abrupt("return");
371
- case 55:
376
+ case 56:
372
377
  if (!(_context2.t0 instanceof Response && _context2.t0.status === 403)) {
373
- _context2.next = 58;
378
+ _context2.next = 59;
374
379
  break;
375
380
  }
376
381
  setStatus('forbidden');
377
382
  return _context2.abrupt("return");
378
- case 58:
379
- setStatus('rejected');
380
383
  case 59:
384
+ setStatus('rejected');
385
+ case 60:
381
386
  case "end":
382
387
  return _context2.stop();
383
388
  }
384
- }, _callee2, null, [[10, 47]]);
389
+ }, _callee2, null, [[10, 48]]);
385
390
  })), [captureError, parameters, fieldKeys, nextCursor, responseItems, setResponseItemIds, onAddItems, getDatasourceData, datasourceId, applySchemaProperties, fireEvent, fullSchema, initialEmptyArray, discoverActions]);
386
391
  var reset = useCallback(function (options) {
387
392
  setResponseItems(initialEmptyArray);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/flag": "^15.8.0",
49
49
  "@atlaskit/form": "^10.5.0",
50
50
  "@atlaskit/heading": "^2.4.0",
51
- "@atlaskit/icon": "^22.17.0",
51
+ "@atlaskit/icon": "^22.18.0",
52
52
  "@atlaskit/icon-object": "^6.5.0",
53
53
  "@atlaskit/image": "^1.3.0",
54
54
  "@atlaskit/inline-edit": "^13.7.0",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/jql-editor": "^4.7.0",
58
58
  "@atlaskit/jql-editor-autocomplete-rest": "^2.1.0",
59
59
  "@atlaskit/layering": "^0.4.0",
60
- "@atlaskit/link-client-extension": "^2.3.0",
60
+ "@atlaskit/link-client-extension": "^2.4.0",
61
61
  "@atlaskit/linking-common": "^5.11.0",
62
62
  "@atlaskit/linking-types": "^9.0.0",
63
63
  "@atlaskit/logo": "^14.2.0",
@@ -71,14 +71,14 @@
71
71
  "@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^1.2.0",
72
72
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
73
73
  "@atlaskit/primitives": "^12.1.0",
74
- "@atlaskit/select": "^17.17.0",
74
+ "@atlaskit/select": "^17.19.0",
75
75
  "@atlaskit/smart-card": "^28.1.0",
76
76
  "@atlaskit/smart-user-picker": "6.10.2",
77
77
  "@atlaskit/spinner": "^16.3.0",
78
78
  "@atlaskit/tag": "^12.6.0",
79
79
  "@atlaskit/textfield": "6.5.1",
80
80
  "@atlaskit/theme": "^13.0.0",
81
- "@atlaskit/tokens": "^1.59.0",
81
+ "@atlaskit/tokens": "^1.60.0",
82
82
  "@atlaskit/tooltip": "^18.7.0",
83
83
  "@atlaskit/ufo": "^0.3.0",
84
84
  "@atlaskit/width-detector": "^4.3.0",
@@ -100,7 +100,7 @@
100
100
  "devDependencies": {
101
101
  "@af/integration-testing": "*",
102
102
  "@af/visual-regression": "*",
103
- "@atlaskit/link-provider": "^1.15.0",
103
+ "@atlaskit/link-provider": "^1.16.0",
104
104
  "@atlaskit/link-test-helpers": "^7.5.0",
105
105
  "@atlaskit/ssr": "*",
106
106
  "@atlaskit/visual-regression": "*",