@atlaskit/link-client-extension 1.9.1 → 1.10.0
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 +19 -0
- package/dist/cjs/services/use-data-source-client-extension/index.js +38 -7
- package/dist/cjs/services/use-data-source-client-extension/mocks.js +22 -2
- package/dist/es2019/services/use-data-source-client-extension/index.js +19 -6
- package/dist/es2019/services/use-data-source-client-extension/mocks.js +20 -0
- package/dist/esm/services/use-data-source-client-extension/index.js +38 -7
- package/dist/esm/services/use-data-source-client-extension/mocks.js +21 -1
- package/dist/types/services/use-data-source-client-extension/index.d.ts +5 -3
- package/dist/types/services/use-data-source-client-extension/mocks.d.ts +2 -1
- package/dist/types-ts4.5/services/use-data-source-client-extension/index.d.ts +5 -3
- package/dist/types-ts4.5/services/use-data-source-client-extension/mocks.d.ts +2 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/link-client-extension
|
|
2
2
|
|
|
3
|
+
## 1.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#123151](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/123151)
|
|
8
|
+
[`15b8082f63c21`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/15b8082f63c21) -
|
|
9
|
+
Adds the getDatasourceActionsAndPermissions function to fetch actions and permissions in
|
|
10
|
+
useDatasourceClientExtension
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 1.9.2
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 1.9.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useDatasourceClientExtension = exports.datasourceDetailsResponsePromiseCache = exports.datasourceDataResponsePromiseCache = exports.DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = void 0;
|
|
7
|
+
exports.useDatasourceClientExtension = exports.datasourceDetailsResponsePromiseCache = exports.datasourceDataResponsePromiseCache = exports.datasourceActionsPermissionsPromiseCache = exports.DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -20,23 +20,26 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
20
20
|
var URL_RESPONSE_CACHE_SIZE = 50;
|
|
21
21
|
var datasourceDetailsResponsePromiseCache = exports.datasourceDetailsResponsePromiseCache = new _lru_map.LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
22
22
|
var datasourceDataResponsePromiseCache = exports.datasourceDataResponsePromiseCache = new _lru_map.LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
23
|
+
var datasourceActionsPermissionsPromiseCache = exports.datasourceActionsPermissionsPromiseCache = new _lru_map.LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
23
24
|
var DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = exports.DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = 20;
|
|
24
25
|
var useDatasourceClientExtension = exports.useDatasourceClientExtension = function useDatasourceClientExtension() {
|
|
25
26
|
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
|
26
27
|
client = _useSmartLinkContext.connections.client;
|
|
27
28
|
var resolverUrl = (0, _useResolverUrl.useResolverUrl)(client);
|
|
28
29
|
var cachedRequest = /*#__PURE__*/function () {
|
|
29
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(
|
|
30
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(cacheKeyId, data, url, lruMap, force) {
|
|
30
31
|
var _Intl;
|
|
31
32
|
var cacheKeyData, cacheKey, responsePromise, headers;
|
|
32
33
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
33
34
|
while (1) switch (_context.prev = _context.next) {
|
|
34
35
|
case 0:
|
|
35
|
-
cacheKeyData = _objectSpread(_objectSpread({}, data), 'fields' in data ? {
|
|
36
|
+
cacheKeyData = _objectSpread(_objectSpread(_objectSpread({}, data), 'fields' in data ? {
|
|
36
37
|
fields: (0, _toConsumableArray2.default)(data.fields || []).sort()
|
|
38
|
+
} : {}), 'fieldKeys' in data ? {
|
|
39
|
+
fieldKeys: (0, _toConsumableArray2.default)(data.fieldKeys || []).sort()
|
|
37
40
|
} : {});
|
|
38
41
|
cacheKey = JSON.stringify({
|
|
39
|
-
|
|
42
|
+
cacheKeyId: cacheKeyId,
|
|
40
43
|
cacheKeyData: cacheKeyData
|
|
41
44
|
});
|
|
42
45
|
if (force) {
|
|
@@ -49,7 +52,7 @@ var useDatasourceClientExtension = exports.useDatasourceClientExtension = functi
|
|
|
49
52
|
}
|
|
50
53
|
return _context.abrupt("return", responsePromise);
|
|
51
54
|
case 6:
|
|
52
|
-
headers = (0, _platformFeatureFlags.
|
|
55
|
+
headers = (0, _platformFeatureFlags.fg)('platform.linking-platform.datasource.add-timezone-header') ? {
|
|
53
56
|
/**
|
|
54
57
|
* This header exist to enable the backend to process relative time, eg: "today", with respect to user timezone.
|
|
55
58
|
* eg: used in "confluence-object-provider" to process confluence SLLV requests to filter data for relative time.
|
|
@@ -116,10 +119,38 @@ var useDatasourceClientExtension = exports.useDatasourceClientExtension = functi
|
|
|
116
119
|
return _ref3.apply(this, arguments);
|
|
117
120
|
};
|
|
118
121
|
}(), [resolverUrl]);
|
|
122
|
+
var getDatasourceActionsAndPermissions = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
123
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(data) {
|
|
124
|
+
var force,
|
|
125
|
+
resolvedCacheIdKey,
|
|
126
|
+
_args4 = arguments;
|
|
127
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
128
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
129
|
+
case 0:
|
|
130
|
+
force = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : false;
|
|
131
|
+
resolvedCacheIdKey = 'datasourceId' in data ? data.datasourceId : data.integrationKey; // This is just to prevent empty string being passed up to ORS and causing issues.
|
|
132
|
+
if (resolvedCacheIdKey) {
|
|
133
|
+
_context4.next = 4;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
throw new Error('No target was supplied to retrieve actions for');
|
|
137
|
+
case 4:
|
|
138
|
+
return _context4.abrupt("return", cachedRequest(resolvedCacheIdKey, data, "".concat(resolverUrl, "/actions"), datasourceActionsPermissionsPromiseCache, force));
|
|
139
|
+
case 5:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context4.stop();
|
|
142
|
+
}
|
|
143
|
+
}, _callee4);
|
|
144
|
+
}));
|
|
145
|
+
return function (_x10) {
|
|
146
|
+
return _ref4.apply(this, arguments);
|
|
147
|
+
};
|
|
148
|
+
}(), [resolverUrl]);
|
|
119
149
|
return (0, _react.useMemo)(function () {
|
|
120
150
|
return {
|
|
121
151
|
getDatasourceDetails: getDatasourceDetails,
|
|
122
|
-
getDatasourceData: getDatasourceData
|
|
152
|
+
getDatasourceData: getDatasourceData,
|
|
153
|
+
getDatasourceActionsAndPermissions: getDatasourceActionsAndPermissions
|
|
123
154
|
};
|
|
124
|
-
}, [getDatasourceDetails, getDatasourceData]);
|
|
155
|
+
}, [getDatasourceDetails, getDatasourceData, getDatasourceActionsAndPermissions]);
|
|
125
156
|
};
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.mockDatasourceDetailsResponse = exports.mockDatasourceDataResponseWithSchema = exports.mockDatasourceDataResponse = void 0;
|
|
7
|
+
exports.mockDatasourceDetailsResponse = exports.mockDatasourceDataResponseWithSchema = exports.mockDatasourceDataResponse = exports.mockActionsDiscoveryResponse = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -194,4 +194,24 @@ var mockDatasourceDataResponseWithSchema = exports.mockDatasourceDataResponseWit
|
|
|
194
194
|
properties: mockDatasourceDetailsResponse.data.schema.properties
|
|
195
195
|
}
|
|
196
196
|
})
|
|
197
|
-
});
|
|
197
|
+
});
|
|
198
|
+
var mockActionsDiscoveryResponse = exports.mockActionsDiscoveryResponse = {
|
|
199
|
+
actions: [{
|
|
200
|
+
actionKey: 'atlassian:issue:update:summary',
|
|
201
|
+
description: 'Updates issue summary',
|
|
202
|
+
fieldKey: 'summary',
|
|
203
|
+
integrationKey: 'jira',
|
|
204
|
+
type: 'string'
|
|
205
|
+
}],
|
|
206
|
+
permissions: {
|
|
207
|
+
data: [{
|
|
208
|
+
ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025',
|
|
209
|
+
fieldKey: 'summary',
|
|
210
|
+
isEditable: true
|
|
211
|
+
}, {
|
|
212
|
+
ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10030',
|
|
213
|
+
fieldKey: 'summary',
|
|
214
|
+
isEditable: true
|
|
215
|
+
}]
|
|
216
|
+
}
|
|
217
|
+
};
|
|
@@ -2,11 +2,12 @@ import { useCallback, useMemo } from 'react';
|
|
|
2
2
|
import { LRUMap } from 'lru_map';
|
|
3
3
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
4
4
|
import { request } from '@atlaskit/linking-common';
|
|
5
|
-
import {
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { useResolverUrl } from '../use-resolver-url';
|
|
7
7
|
const URL_RESPONSE_CACHE_SIZE = 50;
|
|
8
8
|
export const datasourceDetailsResponsePromiseCache = new LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
9
9
|
export const datasourceDataResponsePromiseCache = new LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
10
|
+
export const datasourceActionsPermissionsPromiseCache = new LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
10
11
|
export const DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = 20;
|
|
11
12
|
export const useDatasourceClientExtension = () => {
|
|
12
13
|
const {
|
|
@@ -15,17 +16,20 @@ export const useDatasourceClientExtension = () => {
|
|
|
15
16
|
}
|
|
16
17
|
} = useSmartLinkContext();
|
|
17
18
|
const resolverUrl = useResolverUrl(client);
|
|
18
|
-
const cachedRequest = async (
|
|
19
|
+
const cachedRequest = async (cacheKeyId, data, url, lruMap, force) => {
|
|
19
20
|
var _Intl;
|
|
20
21
|
const cacheKeyData = {
|
|
21
22
|
...data,
|
|
22
23
|
// Sort fields to use cached version of response regardless of the order
|
|
23
24
|
...('fields' in data ? {
|
|
24
25
|
fields: [...(data.fields || [])].sort()
|
|
26
|
+
} : {}),
|
|
27
|
+
...('fieldKeys' in data ? {
|
|
28
|
+
fieldKeys: [...(data.fieldKeys || [])].sort()
|
|
25
29
|
} : {})
|
|
26
30
|
};
|
|
27
31
|
const cacheKey = JSON.stringify({
|
|
28
|
-
|
|
32
|
+
cacheKeyId,
|
|
29
33
|
cacheKeyData
|
|
30
34
|
});
|
|
31
35
|
if (force) {
|
|
@@ -35,7 +39,7 @@ export const useDatasourceClientExtension = () => {
|
|
|
35
39
|
if (responsePromise) {
|
|
36
40
|
return responsePromise;
|
|
37
41
|
}
|
|
38
|
-
const headers =
|
|
42
|
+
const headers = fg('platform.linking-platform.datasource.add-timezone-header') ? {
|
|
39
43
|
/**
|
|
40
44
|
* This header exist to enable the backend to process relative time, eg: "today", with respect to user timezone.
|
|
41
45
|
* eg: used in "confluence-object-provider" to process confluence SLLV requests to filter data for relative time.
|
|
@@ -53,8 +57,17 @@ export const useDatasourceClientExtension = () => {
|
|
|
53
57
|
};
|
|
54
58
|
const getDatasourceDetails = useCallback(async (datasourceId, data, force = false) => cachedRequest(datasourceId, data, `${resolverUrl}/datasource/${datasourceId}/fetch/details`, datasourceDetailsResponsePromiseCache, force), [resolverUrl]);
|
|
55
59
|
const getDatasourceData = useCallback(async (datasourceId, data, force = false) => cachedRequest(datasourceId, data, `${resolverUrl}/datasource/${datasourceId}/fetch/data`, datasourceDataResponsePromiseCache, force), [resolverUrl]);
|
|
60
|
+
const getDatasourceActionsAndPermissions = useCallback(async (data, force = false) => {
|
|
61
|
+
const resolvedCacheIdKey = 'datasourceId' in data ? data.datasourceId : data.integrationKey;
|
|
62
|
+
// This is just to prevent empty string being passed up to ORS and causing issues.
|
|
63
|
+
if (!resolvedCacheIdKey) {
|
|
64
|
+
throw new Error('No target was supplied to retrieve actions for');
|
|
65
|
+
}
|
|
66
|
+
return cachedRequest(resolvedCacheIdKey, data, `${resolverUrl}/actions`, datasourceActionsPermissionsPromiseCache, force);
|
|
67
|
+
}, [resolverUrl]);
|
|
56
68
|
return useMemo(() => ({
|
|
57
69
|
getDatasourceDetails,
|
|
58
|
-
getDatasourceData
|
|
59
|
-
|
|
70
|
+
getDatasourceData,
|
|
71
|
+
getDatasourceActionsAndPermissions
|
|
72
|
+
}), [getDatasourceDetails, getDatasourceData, getDatasourceActionsAndPermissions]);
|
|
60
73
|
};
|
|
@@ -186,4 +186,24 @@ export const mockDatasourceDataResponseWithSchema = {
|
|
|
186
186
|
properties: mockDatasourceDetailsResponse.data.schema.properties
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
+
};
|
|
190
|
+
export const mockActionsDiscoveryResponse = {
|
|
191
|
+
actions: [{
|
|
192
|
+
actionKey: 'atlassian:issue:update:summary',
|
|
193
|
+
description: 'Updates issue summary',
|
|
194
|
+
fieldKey: 'summary',
|
|
195
|
+
integrationKey: 'jira',
|
|
196
|
+
type: 'string'
|
|
197
|
+
}],
|
|
198
|
+
permissions: {
|
|
199
|
+
data: [{
|
|
200
|
+
ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025',
|
|
201
|
+
fieldKey: 'summary',
|
|
202
|
+
isEditable: true
|
|
203
|
+
}, {
|
|
204
|
+
ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10030',
|
|
205
|
+
fieldKey: 'summary',
|
|
206
|
+
isEditable: true
|
|
207
|
+
}]
|
|
208
|
+
}
|
|
189
209
|
};
|
|
@@ -8,28 +8,31 @@ import { useCallback, useMemo } from 'react';
|
|
|
8
8
|
import { LRUMap } from 'lru_map';
|
|
9
9
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
10
10
|
import { request } from '@atlaskit/linking-common';
|
|
11
|
-
import {
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { useResolverUrl } from '../use-resolver-url';
|
|
13
13
|
var URL_RESPONSE_CACHE_SIZE = 50;
|
|
14
14
|
export var datasourceDetailsResponsePromiseCache = new LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
15
15
|
export var datasourceDataResponsePromiseCache = new LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
16
|
+
export var datasourceActionsPermissionsPromiseCache = new LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
16
17
|
export var DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = 20;
|
|
17
18
|
export var useDatasourceClientExtension = function useDatasourceClientExtension() {
|
|
18
19
|
var _useSmartLinkContext = useSmartLinkContext(),
|
|
19
20
|
client = _useSmartLinkContext.connections.client;
|
|
20
21
|
var resolverUrl = useResolverUrl(client);
|
|
21
22
|
var cachedRequest = /*#__PURE__*/function () {
|
|
22
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(
|
|
23
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(cacheKeyId, data, url, lruMap, force) {
|
|
23
24
|
var _Intl;
|
|
24
25
|
var cacheKeyData, cacheKey, responsePromise, headers;
|
|
25
26
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
26
27
|
while (1) switch (_context.prev = _context.next) {
|
|
27
28
|
case 0:
|
|
28
|
-
cacheKeyData = _objectSpread(_objectSpread({}, data), 'fields' in data ? {
|
|
29
|
+
cacheKeyData = _objectSpread(_objectSpread(_objectSpread({}, data), 'fields' in data ? {
|
|
29
30
|
fields: _toConsumableArray(data.fields || []).sort()
|
|
31
|
+
} : {}), 'fieldKeys' in data ? {
|
|
32
|
+
fieldKeys: _toConsumableArray(data.fieldKeys || []).sort()
|
|
30
33
|
} : {});
|
|
31
34
|
cacheKey = JSON.stringify({
|
|
32
|
-
|
|
35
|
+
cacheKeyId: cacheKeyId,
|
|
33
36
|
cacheKeyData: cacheKeyData
|
|
34
37
|
});
|
|
35
38
|
if (force) {
|
|
@@ -42,7 +45,7 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
|
|
|
42
45
|
}
|
|
43
46
|
return _context.abrupt("return", responsePromise);
|
|
44
47
|
case 6:
|
|
45
|
-
headers =
|
|
48
|
+
headers = fg('platform.linking-platform.datasource.add-timezone-header') ? {
|
|
46
49
|
/**
|
|
47
50
|
* This header exist to enable the backend to process relative time, eg: "today", with respect to user timezone.
|
|
48
51
|
* eg: used in "confluence-object-provider" to process confluence SLLV requests to filter data for relative time.
|
|
@@ -109,10 +112,38 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
|
|
|
109
112
|
return _ref3.apply(this, arguments);
|
|
110
113
|
};
|
|
111
114
|
}(), [resolverUrl]);
|
|
115
|
+
var getDatasourceActionsAndPermissions = useCallback( /*#__PURE__*/function () {
|
|
116
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
|
|
117
|
+
var force,
|
|
118
|
+
resolvedCacheIdKey,
|
|
119
|
+
_args4 = arguments;
|
|
120
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
121
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
122
|
+
case 0:
|
|
123
|
+
force = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : false;
|
|
124
|
+
resolvedCacheIdKey = 'datasourceId' in data ? data.datasourceId : data.integrationKey; // This is just to prevent empty string being passed up to ORS and causing issues.
|
|
125
|
+
if (resolvedCacheIdKey) {
|
|
126
|
+
_context4.next = 4;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
throw new Error('No target was supplied to retrieve actions for');
|
|
130
|
+
case 4:
|
|
131
|
+
return _context4.abrupt("return", cachedRequest(resolvedCacheIdKey, data, "".concat(resolverUrl, "/actions"), datasourceActionsPermissionsPromiseCache, force));
|
|
132
|
+
case 5:
|
|
133
|
+
case "end":
|
|
134
|
+
return _context4.stop();
|
|
135
|
+
}
|
|
136
|
+
}, _callee4);
|
|
137
|
+
}));
|
|
138
|
+
return function (_x10) {
|
|
139
|
+
return _ref4.apply(this, arguments);
|
|
140
|
+
};
|
|
141
|
+
}(), [resolverUrl]);
|
|
112
142
|
return useMemo(function () {
|
|
113
143
|
return {
|
|
114
144
|
getDatasourceDetails: getDatasourceDetails,
|
|
115
|
-
getDatasourceData: getDatasourceData
|
|
145
|
+
getDatasourceData: getDatasourceData,
|
|
146
|
+
getDatasourceActionsAndPermissions: getDatasourceActionsAndPermissions
|
|
116
147
|
};
|
|
117
|
-
}, [getDatasourceDetails, getDatasourceData]);
|
|
148
|
+
}, [getDatasourceDetails, getDatasourceData, getDatasourceActionsAndPermissions]);
|
|
118
149
|
};
|
|
@@ -187,4 +187,24 @@ export var mockDatasourceDataResponseWithSchema = _objectSpread(_objectSpread({}
|
|
|
187
187
|
properties: mockDatasourceDetailsResponse.data.schema.properties
|
|
188
188
|
}
|
|
189
189
|
})
|
|
190
|
-
});
|
|
190
|
+
});
|
|
191
|
+
export var mockActionsDiscoveryResponse = {
|
|
192
|
+
actions: [{
|
|
193
|
+
actionKey: 'atlassian:issue:update:summary',
|
|
194
|
+
description: 'Updates issue summary',
|
|
195
|
+
fieldKey: 'summary',
|
|
196
|
+
integrationKey: 'jira',
|
|
197
|
+
type: 'string'
|
|
198
|
+
}],
|
|
199
|
+
permissions: {
|
|
200
|
+
data: [{
|
|
201
|
+
ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025',
|
|
202
|
+
fieldKey: 'summary',
|
|
203
|
+
isEditable: true
|
|
204
|
+
}, {
|
|
205
|
+
ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10030',
|
|
206
|
+
fieldKey: 'summary',
|
|
207
|
+
isEditable: true
|
|
208
|
+
}]
|
|
209
|
+
}
|
|
210
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { LRUMap } from 'lru_map';
|
|
2
|
-
import type { DatasourceDataRequest, DatasourceDataResponse, DatasourceDetailsRequest, DatasourceDetailsResponse } from '@atlaskit/linking-types';
|
|
2
|
+
import type { ActionsDiscoveryRequest, ActionsServiceDiscoveryResponse, DatasourceDataRequest, DatasourceDataResponse, DatasourceDetailsRequest, DatasourceDetailsResponse } from '@atlaskit/linking-types';
|
|
3
3
|
export declare const datasourceDetailsResponsePromiseCache: LRUMap<string, Promise<DatasourceDetailsResponse>>;
|
|
4
4
|
export declare const datasourceDataResponsePromiseCache: LRUMap<string, Promise<DatasourceDataResponse>>;
|
|
5
|
+
export declare const datasourceActionsPermissionsPromiseCache: LRUMap<string, Promise<ActionsServiceDiscoveryResponse>>;
|
|
5
6
|
export declare const DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = 20;
|
|
6
7
|
export declare const useDatasourceClientExtension: () => {
|
|
7
|
-
getDatasourceDetails: (datasourceId: string, data: DatasourceDetailsRequest, force?:
|
|
8
|
-
getDatasourceData: (datasourceId: string, data: DatasourceDataRequest, force?:
|
|
8
|
+
getDatasourceDetails: (datasourceId: string, data: DatasourceDetailsRequest, force?: boolean) => Promise<DatasourceDetailsResponse>;
|
|
9
|
+
getDatasourceData: (datasourceId: string, data: DatasourceDataRequest, force?: boolean) => Promise<DatasourceDataResponse>;
|
|
10
|
+
getDatasourceActionsAndPermissions: (data: ActionsDiscoveryRequest, force?: boolean) => Promise<ActionsServiceDiscoveryResponse>;
|
|
9
11
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { DatasourceDataResponse, DatasourceDetailsResponse } from '@atlaskit/linking-types';
|
|
1
|
+
import type { ActionsDiscoveryResponse, DatasourceDataResponse, DatasourceDetailsResponse } from '@atlaskit/linking-types';
|
|
2
2
|
export declare const mockDatasourceDataResponse: DatasourceDataResponse;
|
|
3
3
|
export declare const mockDatasourceDetailsResponse: DatasourceDetailsResponse;
|
|
4
4
|
export declare const mockDatasourceDataResponseWithSchema: DatasourceDataResponse;
|
|
5
|
+
export declare const mockActionsDiscoveryResponse: ActionsDiscoveryResponse;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { LRUMap } from 'lru_map';
|
|
2
|
-
import type { DatasourceDataRequest, DatasourceDataResponse, DatasourceDetailsRequest, DatasourceDetailsResponse } from '@atlaskit/linking-types';
|
|
2
|
+
import type { ActionsDiscoveryRequest, ActionsServiceDiscoveryResponse, DatasourceDataRequest, DatasourceDataResponse, DatasourceDetailsRequest, DatasourceDetailsResponse } from '@atlaskit/linking-types';
|
|
3
3
|
export declare const datasourceDetailsResponsePromiseCache: LRUMap<string, Promise<DatasourceDetailsResponse>>;
|
|
4
4
|
export declare const datasourceDataResponsePromiseCache: LRUMap<string, Promise<DatasourceDataResponse>>;
|
|
5
|
+
export declare const datasourceActionsPermissionsPromiseCache: LRUMap<string, Promise<ActionsServiceDiscoveryResponse>>;
|
|
5
6
|
export declare const DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = 20;
|
|
6
7
|
export declare const useDatasourceClientExtension: () => {
|
|
7
|
-
getDatasourceDetails: (datasourceId: string, data: DatasourceDetailsRequest, force?:
|
|
8
|
-
getDatasourceData: (datasourceId: string, data: DatasourceDataRequest, force?:
|
|
8
|
+
getDatasourceDetails: (datasourceId: string, data: DatasourceDetailsRequest, force?: boolean) => Promise<DatasourceDetailsResponse>;
|
|
9
|
+
getDatasourceData: (datasourceId: string, data: DatasourceDataRequest, force?: boolean) => Promise<DatasourceDataResponse>;
|
|
10
|
+
getDatasourceActionsAndPermissions: (data: ActionsDiscoveryRequest, force?: boolean) => Promise<ActionsServiceDiscoveryResponse>;
|
|
9
11
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { DatasourceDataResponse, DatasourceDetailsResponse } from '@atlaskit/linking-types';
|
|
1
|
+
import type { ActionsDiscoveryResponse, DatasourceDataResponse, DatasourceDetailsResponse } from '@atlaskit/linking-types';
|
|
2
2
|
export declare const mockDatasourceDataResponse: DatasourceDataResponse;
|
|
3
3
|
export declare const mockDatasourceDetailsResponse: DatasourceDetailsResponse;
|
|
4
4
|
export declare const mockDatasourceDataResponseWithSchema: DatasourceDataResponse;
|
|
5
|
+
export declare const mockActionsDiscoveryResponse: ActionsDiscoveryResponse;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-client-extension",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Extension methods for linking platform client",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/linking-common": "^5.7.0",
|
|
38
|
-
"@atlaskit/linking-types": "^8.
|
|
39
|
-
"@atlaskit/platform-feature-flags": "0.
|
|
38
|
+
"@atlaskit/linking-types": "^8.12.0",
|
|
39
|
+
"@atlaskit/platform-feature-flags": "0.3.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0",
|
|
41
41
|
"json-ld-types": "^4.1.0",
|
|
42
42
|
"lru_map": "^0.4.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@atlaskit/link-provider": "^1.
|
|
45
|
+
"@atlaskit/link-provider": "^1.13.0",
|
|
46
46
|
"react": "^16.8.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@atlassian/feature-flags-test-utils": "0.2.
|
|
49
|
+
"@atlassian/feature-flags-test-utils": "0.2.3",
|
|
50
50
|
"@testing-library/react": "^12.1.5",
|
|
51
51
|
"@testing-library/react-hooks": "^8.0.1",
|
|
52
52
|
"react-dom": "^16.8.0",
|