@atlaskit/link-client-extension 1.7.2 → 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 +31 -25
- 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 +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +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
|
+
|
|
3
9
|
## 1.7.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
6
12
|
|
|
7
|
-
- [`1fedffbd64b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1fedffbd64b) - Update json-ld-types dependencies to be compatible with version
|
|
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
|
|
8
14
|
|
|
9
15
|
## 1.7.1
|
|
10
16
|
|
|
11
17
|
### Patch Changes
|
|
12
18
|
|
|
13
|
-
- [`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
|
|
14
20
|
|
|
15
21
|
## 1.7.0
|
|
16
22
|
|
|
17
23
|
### Minor Changes
|
|
18
24
|
|
|
19
|
-
- [`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.
|
|
20
26
|
|
|
21
27
|
### Patch Changes
|
|
22
28
|
|
|
@@ -26,26 +32,26 @@
|
|
|
26
32
|
|
|
27
33
|
### Patch Changes
|
|
28
34
|
|
|
29
|
-
- [`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
|
|
30
36
|
|
|
31
37
|
## 1.6.0
|
|
32
38
|
|
|
33
39
|
### Minor Changes
|
|
34
40
|
|
|
35
|
-
- [`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`
|
|
36
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.
|
|
37
43
|
|
|
38
44
|
## 1.5.4
|
|
39
45
|
|
|
40
46
|
### Patch Changes
|
|
41
47
|
|
|
42
|
-
- [`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
|
|
43
49
|
|
|
44
50
|
## 1.5.3
|
|
45
51
|
|
|
46
52
|
### Patch Changes
|
|
47
53
|
|
|
48
|
-
- [`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
|
|
49
55
|
|
|
50
56
|
## 1.5.2
|
|
51
57
|
|
|
@@ -57,13 +63,13 @@
|
|
|
57
63
|
|
|
58
64
|
### Patch Changes
|
|
59
65
|
|
|
60
|
-
- [`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
|
|
61
67
|
|
|
62
68
|
## 1.5.0
|
|
63
69
|
|
|
64
70
|
### Minor Changes
|
|
65
71
|
|
|
66
|
-
- [`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
|
|
67
73
|
|
|
68
74
|
### Patch Changes
|
|
69
75
|
|
|
@@ -73,7 +79,7 @@
|
|
|
73
79
|
|
|
74
80
|
### Minor Changes
|
|
75
81
|
|
|
76
|
-
- [`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
|
|
77
83
|
|
|
78
84
|
### Patch Changes
|
|
79
85
|
|
|
@@ -83,7 +89,7 @@
|
|
|
83
89
|
|
|
84
90
|
### Minor Changes
|
|
85
91
|
|
|
86
|
-
- [`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
|
|
87
93
|
|
|
88
94
|
### Patch Changes
|
|
89
95
|
|
|
@@ -105,13 +111,13 @@
|
|
|
105
111
|
|
|
106
112
|
### Minor Changes
|
|
107
113
|
|
|
108
|
-
- [`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
|
|
109
115
|
|
|
110
116
|
## 1.1.7
|
|
111
117
|
|
|
112
118
|
### Patch Changes
|
|
113
119
|
|
|
114
|
-
- [`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
|
|
115
121
|
- Updated dependencies
|
|
116
122
|
|
|
117
123
|
## 1.1.6
|
|
@@ -130,35 +136,35 @@
|
|
|
130
136
|
|
|
131
137
|
### Patch Changes
|
|
132
138
|
|
|
133
|
-
- [`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
|
|
134
140
|
- Updated dependencies
|
|
135
141
|
|
|
136
142
|
## 1.1.3
|
|
137
143
|
|
|
138
144
|
### Patch Changes
|
|
139
145
|
|
|
140
|
-
- [`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
|
|
141
147
|
- Updated dependencies
|
|
142
148
|
|
|
143
149
|
## 1.1.2
|
|
144
150
|
|
|
145
151
|
### Patch Changes
|
|
146
152
|
|
|
147
|
-
- [`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
|
|
148
154
|
- Updated dependencies
|
|
149
155
|
|
|
150
156
|
## 1.1.1
|
|
151
157
|
|
|
152
158
|
### Patch Changes
|
|
153
159
|
|
|
154
|
-
- [`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`
|
|
155
161
|
- Updated dependencies
|
|
156
162
|
|
|
157
163
|
## 1.1.0
|
|
158
164
|
|
|
159
165
|
### Minor Changes
|
|
160
166
|
|
|
161
|
-
- [`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
|
|
162
168
|
|
|
163
169
|
### Patch Changes
|
|
164
170
|
|
|
@@ -168,7 +174,7 @@
|
|
|
168
174
|
|
|
169
175
|
### Minor Changes
|
|
170
176
|
|
|
171
|
-
- [`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
|
|
172
178
|
|
|
173
179
|
### Patch Changes
|
|
174
180
|
|
|
@@ -178,7 +184,7 @@
|
|
|
178
184
|
|
|
179
185
|
### Minor Changes
|
|
180
186
|
|
|
181
|
-
- [`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
|
|
182
188
|
|
|
183
189
|
### Patch Changes
|
|
184
190
|
|
|
@@ -188,7 +194,7 @@
|
|
|
188
194
|
|
|
189
195
|
### Patch Changes
|
|
190
196
|
|
|
191
|
-
- [`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
|
|
192
198
|
- Updated dependencies
|
|
193
199
|
|
|
194
200
|
## 0.4.2
|
|
@@ -201,14 +207,14 @@
|
|
|
201
207
|
|
|
202
208
|
### Patch Changes
|
|
203
209
|
|
|
204
|
-
- [`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
|
|
205
211
|
- Updated dependencies
|
|
206
212
|
|
|
207
213
|
## 0.4.0
|
|
208
214
|
|
|
209
215
|
### Minor Changes
|
|
210
216
|
|
|
211
|
-
- [`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
|
|
212
218
|
|
|
213
219
|
### Patch Changes
|
|
214
220
|
|
|
@@ -218,13 +224,13 @@
|
|
|
218
224
|
|
|
219
225
|
### Minor Changes
|
|
220
226
|
|
|
221
|
-
- [`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
|
|
222
228
|
|
|
223
229
|
## 0.2.0
|
|
224
230
|
|
|
225
231
|
### Minor Changes
|
|
226
232
|
|
|
227
|
-
- [`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
|
|
228
234
|
|
|
229
235
|
### Patch Changes
|
|
230
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,8 +34,8 @@
|
|
|
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
40
|
"json-ld-types": "^3.9.1",
|
|
41
41
|
"lru_map": "^0.4.1"
|