@atlaskit/link-client-extension 1.7.1 → 1.7.3
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 +36 -24
- package/dist/cjs/services/use-data-source-client-extension/index.js +24 -21
- package/dist/cjs/services/use-data-source-client-extension/mocks.js +4 -7
- package/dist/cjs/services/use-resolver-url/index.js +2 -3
- package/dist/cjs/services/use-smart-link-client-extension/index.js +2 -3
- package/dist/es2019/services/use-data-source-client-extension/index.js +8 -1
- package/dist/esm/services/use-data-source-client-extension/index.js +19 -12
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
# @atlaskit/link-client-extension
|
|
2
2
|
|
|
3
|
+
## 1.7.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#41377](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41377) [`6191c789222`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6191c789222) - Fix bug where on next page load sorts the column in alphabetical order.
|
|
8
|
+
|
|
9
|
+
## 1.7.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#40491](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40491) [`1fedffbd64b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1fedffbd64b) - Update json-ld-types dependencies to be compatible with version
|
|
14
|
+
|
|
3
15
|
## 1.7.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
6
18
|
|
|
7
|
-
- [`2cd7af71b63`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2cd7af71b63) - Bump json-ld-types 3.8.0 -> 3.9.1
|
|
19
|
+
- [#40127](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40127) [`2cd7af71b63`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2cd7af71b63) - Bump json-ld-types 3.8.0 -> 3.9.1
|
|
8
20
|
|
|
9
21
|
## 1.7.0
|
|
10
22
|
|
|
11
23
|
### Minor Changes
|
|
12
24
|
|
|
13
|
-
- [`8b8a309cb62`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8b8a309cb62) - Added a `DEFAULT_GET_DATA_PAGE_SIZE` constant for default page size on data calls.
|
|
25
|
+
- [#39265](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39265) [`8b8a309cb62`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8b8a309cb62) - Added a `DEFAULT_GET_DATA_PAGE_SIZE` constant for default page size on data calls.
|
|
14
26
|
|
|
15
27
|
### Patch Changes
|
|
16
28
|
|
|
@@ -20,26 +32,26 @@
|
|
|
20
32
|
|
|
21
33
|
### Patch Changes
|
|
22
34
|
|
|
23
|
-
- [`a21cffb7b23`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a21cffb7b23) - Extended mock response returned for datasources
|
|
35
|
+
- [#39465](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39465) [`a21cffb7b23`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a21cffb7b23) - Extended mock response returned for datasources
|
|
24
36
|
|
|
25
37
|
## 1.6.0
|
|
26
38
|
|
|
27
39
|
### Minor Changes
|
|
28
40
|
|
|
29
|
-
- [`5bc0af1de85`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5bc0af1de85) - Introduce caching layer for both `getDatasourceDetails` and `getDatasourceData` calls. Export new member - `mockDatasourceDetailsResponse` that has same value as previously exported `mockDatasourceResponse`
|
|
41
|
+
- [#38189](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/38189) [`5bc0af1de85`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5bc0af1de85) - Introduce caching layer for both `getDatasourceDetails` and `getDatasourceData` calls. Export new member - `mockDatasourceDetailsResponse` that has same value as previously exported `mockDatasourceResponse`
|
|
30
42
|
- [`b3b6782c3a0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b3b6782c3a0) - Add new member `mockDatasourceDetailsResponse` that has same value as existing `mockDatasourceResponse`; Add third optional boolean argument to `getDatasourceDetails` and `getDatasourceData` from `useDatasourceClientExtension` hook called `force` — when it is false (Default) cached version of response promise will be returned (in case request with same parameters has been made), when true new request will be made regardless of cache state.
|
|
31
43
|
|
|
32
44
|
## 1.5.4
|
|
33
45
|
|
|
34
46
|
### Patch Changes
|
|
35
47
|
|
|
36
|
-
- [`e74ae7f06d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e74ae7f06d4) - Update dependency json-ld-types@3.8.0
|
|
48
|
+
- [#37720](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/37720) [`e74ae7f06d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e74ae7f06d4) - Update dependency json-ld-types@3.8.0
|
|
37
49
|
|
|
38
50
|
## 1.5.3
|
|
39
51
|
|
|
40
52
|
### Patch Changes
|
|
41
53
|
|
|
42
|
-
- [`b9355830504`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b9355830504) - Opt out of peer dependency enforcement
|
|
54
|
+
- [#37340](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/37340) [`b9355830504`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b9355830504) - Opt out of peer dependency enforcement
|
|
43
55
|
|
|
44
56
|
## 1.5.2
|
|
45
57
|
|
|
@@ -51,13 +63,13 @@
|
|
|
51
63
|
|
|
52
64
|
### Patch Changes
|
|
53
65
|
|
|
54
|
-
- [`3fb20c4aeba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3fb20c4aeba) - Add postinstall check to enforce internal peer dependencies
|
|
66
|
+
- [#36757](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/36757) [`3fb20c4aeba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3fb20c4aeba) - Add postinstall check to enforce internal peer dependencies
|
|
55
67
|
|
|
56
68
|
## 1.5.0
|
|
57
69
|
|
|
58
70
|
### Minor Changes
|
|
59
71
|
|
|
60
|
-
- [`12411d70076`](https://bitbucket.org/atlassian/atlassian-frontend/commits/12411d70076) - export more datasource types in the linking-type index and remove the defaultProperties in the datasourceDataResponse
|
|
72
|
+
- [#36138](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/36138) [`12411d70076`](https://bitbucket.org/atlassian/atlassian-frontend/commits/12411d70076) - export more datasource types in the linking-type index and remove the defaultProperties in the datasourceDataResponse
|
|
61
73
|
|
|
62
74
|
### Patch Changes
|
|
63
75
|
|
|
@@ -67,7 +79,7 @@
|
|
|
67
79
|
|
|
68
80
|
### Minor Changes
|
|
69
81
|
|
|
70
|
-
- [`04295e9d5bc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/04295e9d5bc) - [ux] Updating ORS response to include datasources and facilitating pasting JQL links turning into datasource tables
|
|
82
|
+
- [#35032](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/35032) [`04295e9d5bc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/04295e9d5bc) - [ux] Updating ORS response to include datasources and facilitating pasting JQL links turning into datasource tables
|
|
71
83
|
|
|
72
84
|
### Patch Changes
|
|
73
85
|
|
|
@@ -77,7 +89,7 @@
|
|
|
77
89
|
|
|
78
90
|
### Minor Changes
|
|
79
91
|
|
|
80
|
-
- [`f427908df3d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f427908df3d) - change the datasource response type to include the meta data section and the data response will wrap in the data section
|
|
92
|
+
- [#35861](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/35861) [`f427908df3d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f427908df3d) - change the datasource response type to include the meta data section and the data response will wrap in the data section
|
|
81
93
|
|
|
82
94
|
### Patch Changes
|
|
83
95
|
|
|
@@ -99,13 +111,13 @@
|
|
|
99
111
|
|
|
100
112
|
### Minor Changes
|
|
101
113
|
|
|
102
|
-
- [`b508cc26473`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b508cc26473) - Updated getDatasourceDetails request body to be `DatasourceDetailsRequest` type
|
|
114
|
+
- [#34180](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/34180) [`b508cc26473`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b508cc26473) - Updated getDatasourceDetails request body to be `DatasourceDetailsRequest` type
|
|
103
115
|
|
|
104
116
|
## 1.1.7
|
|
105
117
|
|
|
106
118
|
### Patch Changes
|
|
107
119
|
|
|
108
|
-
- [`61cb5313358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/61cb5313358) - Removing unused dependencies and dev dependencies
|
|
120
|
+
- [#34443](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/34443) [`61cb5313358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/61cb5313358) - Removing unused dependencies and dev dependencies
|
|
109
121
|
- Updated dependencies
|
|
110
122
|
|
|
111
123
|
## 1.1.6
|
|
@@ -124,35 +136,35 @@
|
|
|
124
136
|
|
|
125
137
|
### Patch Changes
|
|
126
138
|
|
|
127
|
-
- [`43ad059dcc5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/43ad059dcc5) - Updated mock response to the new `DatasourceDataResponseItem` format
|
|
139
|
+
- [#34035](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/34035) [`43ad059dcc5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/43ad059dcc5) - Updated mock response to the new `DatasourceDataResponseItem` format
|
|
128
140
|
- Updated dependencies
|
|
129
141
|
|
|
130
142
|
## 1.1.3
|
|
131
143
|
|
|
132
144
|
### Patch Changes
|
|
133
145
|
|
|
134
|
-
- [`e9ad7ee17bb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e9ad7ee17bb) - Updated mock response to the new `DatasourceType` value format
|
|
146
|
+
- [#33917](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33917) [`e9ad7ee17bb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e9ad7ee17bb) - Updated mock response to the new `DatasourceType` value format
|
|
135
147
|
- Updated dependencies
|
|
136
148
|
|
|
137
149
|
## 1.1.2
|
|
138
150
|
|
|
139
151
|
### Patch Changes
|
|
140
152
|
|
|
141
|
-
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
153
|
+
- [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793) [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
142
154
|
- Updated dependencies
|
|
143
155
|
|
|
144
156
|
## 1.1.1
|
|
145
157
|
|
|
146
158
|
### Patch Changes
|
|
147
159
|
|
|
148
|
-
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
160
|
+
- [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649) [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
149
161
|
- Updated dependencies
|
|
150
162
|
|
|
151
163
|
## 1.1.0
|
|
152
164
|
|
|
153
165
|
### Minor Changes
|
|
154
166
|
|
|
155
|
-
- [`670454dc4a0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/670454dc4a0) - Add totalIssues to mock/types
|
|
167
|
+
- [#33177](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33177) [`670454dc4a0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/670454dc4a0) - Add totalIssues to mock/types
|
|
156
168
|
|
|
157
169
|
### Patch Changes
|
|
158
170
|
|
|
@@ -162,7 +174,7 @@
|
|
|
162
174
|
|
|
163
175
|
### Minor Changes
|
|
164
176
|
|
|
165
|
-
- [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
177
|
+
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258) [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
166
178
|
|
|
167
179
|
### Patch Changes
|
|
168
180
|
|
|
@@ -172,7 +184,7 @@
|
|
|
172
184
|
|
|
173
185
|
### Minor Changes
|
|
174
186
|
|
|
175
|
-
- [`5f0b51cb0e9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f0b51cb0e9) - Updated `useDatasourceClientExtension` hook to use `useSmartLinkContext` for creating smart-card client
|
|
187
|
+
- [#32751](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32751) [`5f0b51cb0e9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f0b51cb0e9) - Updated `useDatasourceClientExtension` hook to use `useSmartLinkContext` for creating smart-card client
|
|
176
188
|
|
|
177
189
|
### Patch Changes
|
|
178
190
|
|
|
@@ -182,7 +194,7 @@
|
|
|
182
194
|
|
|
183
195
|
### Patch Changes
|
|
184
196
|
|
|
185
|
-
- [`f1b712482b1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f1b712482b1) - Fixed error handling inside of invoke function
|
|
197
|
+
- [#32589](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32589) [`f1b712482b1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f1b712482b1) - Fixed error handling inside of invoke function
|
|
186
198
|
- Updated dependencies
|
|
187
199
|
|
|
188
200
|
## 0.4.2
|
|
@@ -195,14 +207,14 @@
|
|
|
195
207
|
|
|
196
208
|
### Patch Changes
|
|
197
209
|
|
|
198
|
-
- [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY remove before merging to master; dupe adf-schema via adf-utils
|
|
210
|
+
- [#32424](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32424) [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY remove before merging to master; dupe adf-schema via adf-utils
|
|
199
211
|
- Updated dependencies
|
|
200
212
|
|
|
201
213
|
## 0.4.0
|
|
202
214
|
|
|
203
215
|
### Minor Changes
|
|
204
216
|
|
|
205
|
-
- [`d19a6e77d60`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d19a6e77d60) - Adds new hook useDatasourceClientExtension to fetch data for link datasources
|
|
217
|
+
- [#32368](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32368) [`d19a6e77d60`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d19a6e77d60) - Adds new hook useDatasourceClientExtension to fetch data for link datasources
|
|
206
218
|
|
|
207
219
|
### Patch Changes
|
|
208
220
|
|
|
@@ -212,13 +224,13 @@
|
|
|
212
224
|
|
|
213
225
|
### Minor Changes
|
|
214
226
|
|
|
215
|
-
- [`7297fb71759`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7297fb71759) - Update response type for useSmartLinkClientExtension
|
|
227
|
+
- [#31900](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31900) [`7297fb71759`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7297fb71759) - Update response type for useSmartLinkClientExtension
|
|
216
228
|
|
|
217
229
|
## 0.2.0
|
|
218
230
|
|
|
219
231
|
### Minor Changes
|
|
220
232
|
|
|
221
|
-
- [`f32cef73d0f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f32cef73d0f) - use new types from smart link types
|
|
233
|
+
- [#31905](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31905) [`f32cef73d0f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f32cef73d0f) - use new types from smart link types
|
|
222
234
|
|
|
223
235
|
### Patch Changes
|
|
224
236
|
|
|
@@ -6,60 +6,64 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useDatasourceClientExtension = exports.datasourceDetailsResponsePromiseCache = exports.datasourceDataResponsePromiseCache = exports.DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
12
|
var _react = require("react");
|
|
11
13
|
var _lru_map = require("lru_map");
|
|
12
14
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
13
15
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
14
16
|
var _useResolverUrl = require("../use-resolver-url");
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
15
19
|
var URL_RESPONSE_CACHE_SIZE = 50;
|
|
16
|
-
var datasourceDetailsResponsePromiseCache = new _lru_map.LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
17
|
-
exports.
|
|
18
|
-
var
|
|
19
|
-
exports.
|
|
20
|
-
var DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = 20;
|
|
21
|
-
exports.DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE;
|
|
22
|
-
var useDatasourceClientExtension = function useDatasourceClientExtension() {
|
|
20
|
+
var datasourceDetailsResponsePromiseCache = exports.datasourceDetailsResponsePromiseCache = new _lru_map.LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
21
|
+
var datasourceDataResponsePromiseCache = exports.datasourceDataResponsePromiseCache = new _lru_map.LRUMap(URL_RESPONSE_CACHE_SIZE);
|
|
22
|
+
var DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = exports.DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE = 20;
|
|
23
|
+
var useDatasourceClientExtension = exports.useDatasourceClientExtension = function useDatasourceClientExtension() {
|
|
23
24
|
var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
|
|
24
25
|
client = _useSmartLinkContext.connections.client;
|
|
25
26
|
var resolverUrl = (0, _useResolverUrl.useResolverUrl)(client);
|
|
26
27
|
var cachedRequest = /*#__PURE__*/function () {
|
|
27
28
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(datasourceId, data, url, lruMap, force) {
|
|
28
|
-
var cacheKey, responsePromise;
|
|
29
|
+
var dataWithSortedFields, cacheKey, responsePromise;
|
|
29
30
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
30
31
|
while (1) switch (_context.prev = _context.next) {
|
|
31
32
|
case 0:
|
|
33
|
+
dataWithSortedFields = _objectSpread(_objectSpread({}, data), data.fields && {
|
|
34
|
+
fields: (0, _toConsumableArray2.default)(data.fields || []).sort()
|
|
35
|
+
});
|
|
32
36
|
cacheKey = JSON.stringify({
|
|
33
37
|
datasourceId: datasourceId,
|
|
34
|
-
|
|
38
|
+
dataWithSortedFields: dataWithSortedFields
|
|
35
39
|
});
|
|
36
40
|
if (force) {
|
|
37
41
|
lruMap.delete(cacheKey);
|
|
38
42
|
}
|
|
39
43
|
responsePromise = lruMap.get(cacheKey);
|
|
40
44
|
if (!responsePromise) {
|
|
41
|
-
_context.next =
|
|
45
|
+
_context.next = 6;
|
|
42
46
|
break;
|
|
43
47
|
}
|
|
44
48
|
return _context.abrupt("return", responsePromise);
|
|
45
|
-
case
|
|
46
|
-
_context.prev =
|
|
49
|
+
case 6:
|
|
50
|
+
_context.prev = 6;
|
|
47
51
|
responsePromise = (0, _linkingCommon.request)('post', url, data, undefined, [200, 201, 202, 203, 204]);
|
|
48
52
|
lruMap.set(cacheKey, responsePromise);
|
|
49
|
-
_context.next =
|
|
53
|
+
_context.next = 11;
|
|
50
54
|
return responsePromise;
|
|
51
|
-
case
|
|
55
|
+
case 11:
|
|
52
56
|
return _context.abrupt("return", _context.sent);
|
|
53
|
-
case
|
|
54
|
-
_context.prev =
|
|
55
|
-
_context.t0 = _context["catch"](
|
|
57
|
+
case 14:
|
|
58
|
+
_context.prev = 14;
|
|
59
|
+
_context.t0 = _context["catch"](6);
|
|
56
60
|
lruMap.delete(cacheKey);
|
|
57
61
|
throw _context.t0;
|
|
58
|
-
case
|
|
62
|
+
case 18:
|
|
59
63
|
case "end":
|
|
60
64
|
return _context.stop();
|
|
61
65
|
}
|
|
62
|
-
}, _callee, null, [[
|
|
66
|
+
}, _callee, null, [[6, 14]]);
|
|
63
67
|
}));
|
|
64
68
|
return function cachedRequest(_x, _x2, _x3, _x4, _x5) {
|
|
65
69
|
return _ref.apply(this, arguments);
|
|
@@ -109,5 +113,4 @@ var useDatasourceClientExtension = function useDatasourceClientExtension() {
|
|
|
109
113
|
getDatasourceData: getDatasourceData
|
|
110
114
|
};
|
|
111
115
|
}, [getDatasourceDetails, getDatasourceData]);
|
|
112
|
-
};
|
|
113
|
-
exports.useDatasourceClientExtension = useDatasourceClientExtension;
|
|
116
|
+
};
|
|
@@ -8,7 +8,7 @@ exports.mockDatasourceDetailsResponse = exports.mockDatasourceDataResponseWithSc
|
|
|
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; }
|
|
11
|
-
var mockDatasourceDataResponse = {
|
|
11
|
+
var mockDatasourceDataResponse = exports.mockDatasourceDataResponse = {
|
|
12
12
|
meta: {
|
|
13
13
|
key: 'jira-object-provider',
|
|
14
14
|
access: 'granted',
|
|
@@ -114,8 +114,7 @@ var mockDatasourceDataResponse = {
|
|
|
114
114
|
nextPageCursor: 'c3RhcnRBdD01'
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
|
-
exports.
|
|
118
|
-
var mockDatasourceDetailsResponse = {
|
|
117
|
+
var mockDatasourceDetailsResponse = exports.mockDatasourceDetailsResponse = {
|
|
119
118
|
meta: {
|
|
120
119
|
key: 'jira-object-provider',
|
|
121
120
|
access: 'granted',
|
|
@@ -187,12 +186,10 @@ var mockDatasourceDetailsResponse = {
|
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
};
|
|
190
|
-
exports.
|
|
191
|
-
var mockDatasourceDataResponseWithSchema = _objectSpread(_objectSpread({}, mockDatasourceDataResponse), {}, {
|
|
189
|
+
var mockDatasourceDataResponseWithSchema = exports.mockDatasourceDataResponseWithSchema = _objectSpread(_objectSpread({}, mockDatasourceDataResponse), {}, {
|
|
192
190
|
data: _objectSpread(_objectSpread({}, mockDatasourceDataResponse.data), {}, {
|
|
193
191
|
schema: {
|
|
194
192
|
properties: mockDatasourceDetailsResponse.data.schema.properties
|
|
195
193
|
}
|
|
196
194
|
})
|
|
197
|
-
});
|
|
198
|
-
exports.mockDatasourceDataResponseWithSchema = mockDatasourceDataResponseWithSchema;
|
|
195
|
+
});
|
|
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useResolverUrl = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
9
|
-
var useResolverUrl = function useResolverUrl(cardClient) {
|
|
9
|
+
var useResolverUrl = exports.useResolverUrl = function useResolverUrl(cardClient) {
|
|
10
10
|
return (0, _react.useMemo)(function () {
|
|
11
11
|
return (0, _linkingCommon.getResolverUrl)(cardClient === null || cardClient === void 0 ? void 0 : cardClient.envKey, cardClient === null || cardClient === void 0 ? void 0 : cardClient.baseUrlOverride);
|
|
12
12
|
}, [cardClient === null || cardClient === void 0 ? void 0 : cardClient.baseUrlOverride, cardClient === null || cardClient === void 0 ? void 0 : cardClient.envKey]);
|
|
13
|
-
};
|
|
14
|
-
exports.useResolverUrl = useResolverUrl;
|
|
13
|
+
};
|
|
@@ -19,7 +19,7 @@ var _useResolverUrl = require("../use-resolver-url");
|
|
|
19
19
|
*
|
|
20
20
|
* @param cardClient
|
|
21
21
|
*/
|
|
22
|
-
var useSmartLinkClientExtension = function useSmartLinkClientExtension(cardClient) {
|
|
22
|
+
var useSmartLinkClientExtension = exports.useSmartLinkClientExtension = function useSmartLinkClientExtension(cardClient) {
|
|
23
23
|
var resolvedUrl = (0, _useResolverUrl.useResolverUrl)(cardClient);
|
|
24
24
|
var invoke = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
25
25
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(data) {
|
|
@@ -65,5 +65,4 @@ var useSmartLinkClientExtension = function useSmartLinkClientExtension(cardClien
|
|
|
65
65
|
invoke: invoke
|
|
66
66
|
};
|
|
67
67
|
}, [invoke]);
|
|
68
|
-
};
|
|
69
|
-
exports.useSmartLinkClientExtension = useSmartLinkClientExtension;
|
|
68
|
+
};
|
|
@@ -15,9 +15,16 @@ export const useDatasourceClientExtension = () => {
|
|
|
15
15
|
} = useSmartLinkContext();
|
|
16
16
|
const resolverUrl = useResolverUrl(client);
|
|
17
17
|
const cachedRequest = async (datasourceId, data, url, lruMap, force) => {
|
|
18
|
+
const dataWithSortedFields = {
|
|
19
|
+
...data,
|
|
20
|
+
// Sort fields to use cached version of response regardless of the order
|
|
21
|
+
...(data.fields && {
|
|
22
|
+
fields: [...(data.fields || [])].sort()
|
|
23
|
+
})
|
|
24
|
+
};
|
|
18
25
|
const cacheKey = JSON.stringify({
|
|
19
26
|
datasourceId,
|
|
20
|
-
|
|
27
|
+
dataWithSortedFields
|
|
21
28
|
});
|
|
22
29
|
if (force) {
|
|
23
30
|
lruMap.delete(cacheKey);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
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; }
|
|
6
|
+
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) { _defineProperty(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; }
|
|
3
7
|
import { useCallback, useMemo } from 'react';
|
|
4
8
|
import { LRUMap } from 'lru_map';
|
|
5
9
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
@@ -15,41 +19,44 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
|
|
|
15
19
|
var resolverUrl = useResolverUrl(client);
|
|
16
20
|
var cachedRequest = /*#__PURE__*/function () {
|
|
17
21
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(datasourceId, data, url, lruMap, force) {
|
|
18
|
-
var cacheKey, responsePromise;
|
|
22
|
+
var dataWithSortedFields, cacheKey, responsePromise;
|
|
19
23
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
20
24
|
while (1) switch (_context.prev = _context.next) {
|
|
21
25
|
case 0:
|
|
26
|
+
dataWithSortedFields = _objectSpread(_objectSpread({}, data), data.fields && {
|
|
27
|
+
fields: _toConsumableArray(data.fields || []).sort()
|
|
28
|
+
});
|
|
22
29
|
cacheKey = JSON.stringify({
|
|
23
30
|
datasourceId: datasourceId,
|
|
24
|
-
|
|
31
|
+
dataWithSortedFields: dataWithSortedFields
|
|
25
32
|
});
|
|
26
33
|
if (force) {
|
|
27
34
|
lruMap.delete(cacheKey);
|
|
28
35
|
}
|
|
29
36
|
responsePromise = lruMap.get(cacheKey);
|
|
30
37
|
if (!responsePromise) {
|
|
31
|
-
_context.next =
|
|
38
|
+
_context.next = 6;
|
|
32
39
|
break;
|
|
33
40
|
}
|
|
34
41
|
return _context.abrupt("return", responsePromise);
|
|
35
|
-
case
|
|
36
|
-
_context.prev =
|
|
42
|
+
case 6:
|
|
43
|
+
_context.prev = 6;
|
|
37
44
|
responsePromise = request('post', url, data, undefined, [200, 201, 202, 203, 204]);
|
|
38
45
|
lruMap.set(cacheKey, responsePromise);
|
|
39
|
-
_context.next =
|
|
46
|
+
_context.next = 11;
|
|
40
47
|
return responsePromise;
|
|
41
|
-
case
|
|
48
|
+
case 11:
|
|
42
49
|
return _context.abrupt("return", _context.sent);
|
|
43
|
-
case
|
|
44
|
-
_context.prev =
|
|
45
|
-
_context.t0 = _context["catch"](
|
|
50
|
+
case 14:
|
|
51
|
+
_context.prev = 14;
|
|
52
|
+
_context.t0 = _context["catch"](6);
|
|
46
53
|
lruMap.delete(cacheKey);
|
|
47
54
|
throw _context.t0;
|
|
48
|
-
case
|
|
55
|
+
case 18:
|
|
49
56
|
case "end":
|
|
50
57
|
return _context.stop();
|
|
51
58
|
}
|
|
52
|
-
}, _callee, null, [[
|
|
59
|
+
}, _callee, null, [[6, 14]]);
|
|
53
60
|
}));
|
|
54
61
|
return function cachedRequest(_x, _x2, _x3, _x4, _x5) {
|
|
55
62
|
return _ref.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-client-extension",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "Extension methods for linking platform client",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
".": "./src/index.ts"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@atlaskit/linking-common": "^4.
|
|
38
|
-
"@atlaskit/linking-types": "^8.
|
|
37
|
+
"@atlaskit/linking-common": "^4.11.0",
|
|
38
|
+
"@atlaskit/linking-types": "^8.4.0",
|
|
39
39
|
"@babel/runtime": "^7.0.0",
|
|
40
|
-
"json-ld-types": "3.9.1",
|
|
40
|
+
"json-ld-types": "^3.9.1",
|
|
41
41
|
"lru_map": "^0.4.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|