@atlaskit/link-client-extension 2.2.0 → 2.4.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 +16 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/services/use-data-source-client-extension/index.js +32 -2
- package/dist/cjs/services/use-data-source-client-extension/mocks.js +121 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/services/use-data-source-client-extension/index.js +15 -2
- package/dist/es2019/services/use-data-source-client-extension/mocks.js +120 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/services/use-data-source-client-extension/index.js +32 -2
- package/dist/esm/services/use-data-source-client-extension/mocks.js +120 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/services/use-data-source-client-extension/index.d.ts +1 -0
- package/dist/types/services/use-data-source-client-extension/mocks.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/services/use-data-source-client-extension/index.d.ts +1 -0
- package/dist/types-ts4.5/services/use-data-source-client-extension/mocks.d.ts +1 -0
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/link-client-extension
|
|
2
2
|
|
|
3
|
+
## 2.4.0
|
|
4
|
+
|
|
5
|
+
### Minor 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
|
+
Export new mock `mockDatasourceDataNoActionsResponse` for DS without actions
|
|
10
|
+
|
|
11
|
+
## 2.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#134332](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134332)
|
|
16
|
+
[`ba2a672c564ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ba2a672c564ec) -
|
|
17
|
+
Expose new method removeDataCacheWithAri to clear cache conditionally
|
|
18
|
+
|
|
3
19
|
## 2.2.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "mockActionsDiscoveryResponse", {
|
|
|
21
21
|
return _mocks.mockActionsDiscoveryResponse;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "mockDatasourceDataNoActionsResponse", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _mocks.mockDatasourceDataNoActionsResponse;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "mockDatasourceDataResponse", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function get() {
|
|
@@ -180,12 +180,42 @@ var useDatasourceClientExtension = exports.useDatasourceClientExtension = functi
|
|
|
180
180
|
return _ref6.apply(this, arguments);
|
|
181
181
|
};
|
|
182
182
|
}(), [resolverUrl]);
|
|
183
|
+
var invalidateDatasourceDataCacheByAri = (0, _react.useCallback)(function (ari) {
|
|
184
|
+
datasourceDataResponsePromiseCache.forEach( /*#__PURE__*/function () {
|
|
185
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(value, key) {
|
|
186
|
+
var response, targetFound;
|
|
187
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
188
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
189
|
+
case 0:
|
|
190
|
+
_context7.next = 2;
|
|
191
|
+
return value;
|
|
192
|
+
case 2:
|
|
193
|
+
response = _context7.sent;
|
|
194
|
+
targetFound = response.data.items.some(function (item) {
|
|
195
|
+
var _item$ari;
|
|
196
|
+
return ((_item$ari = item['ari']) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === ari;
|
|
197
|
+
});
|
|
198
|
+
if (targetFound) {
|
|
199
|
+
datasourceDataResponsePromiseCache.delete(key);
|
|
200
|
+
}
|
|
201
|
+
case 5:
|
|
202
|
+
case "end":
|
|
203
|
+
return _context7.stop();
|
|
204
|
+
}
|
|
205
|
+
}, _callee7);
|
|
206
|
+
}));
|
|
207
|
+
return function (_x14, _x15) {
|
|
208
|
+
return _ref7.apply(this, arguments);
|
|
209
|
+
};
|
|
210
|
+
}());
|
|
211
|
+
}, []);
|
|
183
212
|
return (0, _react.useMemo)(function () {
|
|
184
213
|
return {
|
|
185
214
|
getDatasourceDetails: getDatasourceDetails,
|
|
186
215
|
getDatasourceData: getDatasourceData,
|
|
187
216
|
getDatasourceActionsAndPermissions: getDatasourceActionsAndPermissions,
|
|
188
|
-
executeAtomicAction: executeAtomicAction
|
|
217
|
+
executeAtomicAction: executeAtomicAction,
|
|
218
|
+
invalidateDatasourceDataCacheByAri: invalidateDatasourceDataCacheByAri
|
|
189
219
|
};
|
|
190
|
-
}, [getDatasourceDetails, getDatasourceData, getDatasourceActionsAndPermissions, executeAtomicAction]);
|
|
220
|
+
}, [getDatasourceDetails, getDatasourceData, getDatasourceActionsAndPermissions, executeAtomicAction, invalidateDatasourceDataCacheByAri]);
|
|
191
221
|
};
|
|
@@ -4,12 +4,132 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.mockExecuteActionResponseFailure = exports.mockExecuteActionResponse = exports.mockDatasourceDetailsResponse = exports.mockDatasourceDataResponseWithSchema = exports.mockDatasourceDataResponse = exports.mockActionsDiscoveryResponse = exports.mockActionsDiscoveryEmptyResponse = void 0;
|
|
7
|
+
exports.mockExecuteActionResponseFailure = exports.mockExecuteActionResponse = exports.mockDatasourceDetailsResponse = exports.mockDatasourceDataResponseWithSchema = exports.mockDatasourceDataResponse = exports.mockDatasourceDataNoActionsResponse = exports.mockActionsDiscoveryResponse = exports.mockActionsDiscoveryEmptyResponse = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _linkingTypes = require("@atlaskit/linking-types");
|
|
10
10
|
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; }
|
|
11
11
|
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; }
|
|
12
12
|
var mockDatasourceDataResponse = exports.mockDatasourceDataResponse = {
|
|
13
|
+
meta: {
|
|
14
|
+
key: 'jira-object-provider',
|
|
15
|
+
access: 'granted',
|
|
16
|
+
auth: [],
|
|
17
|
+
definitionId: 'object-resolver-service',
|
|
18
|
+
product: 'jira',
|
|
19
|
+
visibility: 'restricted',
|
|
20
|
+
extensionKey: 'jira-object-provider',
|
|
21
|
+
providerName: 'Jira',
|
|
22
|
+
destinationObjectTypes: ['issue'],
|
|
23
|
+
objectTypesEntity: 'work-item'
|
|
24
|
+
},
|
|
25
|
+
data: {
|
|
26
|
+
totalCount: 1234,
|
|
27
|
+
items: [{
|
|
28
|
+
ari: {
|
|
29
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025'
|
|
30
|
+
},
|
|
31
|
+
id: {
|
|
32
|
+
data: 'EDM-12'
|
|
33
|
+
},
|
|
34
|
+
description: {
|
|
35
|
+
data: 'Design datasource feature'
|
|
36
|
+
},
|
|
37
|
+
createdAt: {
|
|
38
|
+
data: '2023-01-22T01:30:00.000-05:00'
|
|
39
|
+
},
|
|
40
|
+
assigned: {
|
|
41
|
+
data: {
|
|
42
|
+
displayName: 'Sasha'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
status: {
|
|
46
|
+
data: {
|
|
47
|
+
text: 'In Progress',
|
|
48
|
+
style: {
|
|
49
|
+
appearance: 'inprogress'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
ari: {
|
|
55
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10026'
|
|
56
|
+
},
|
|
57
|
+
id: {
|
|
58
|
+
data: 'EDM-14'
|
|
59
|
+
},
|
|
60
|
+
description: {
|
|
61
|
+
data: 'Implement datasource feature'
|
|
62
|
+
},
|
|
63
|
+
createdAt: {
|
|
64
|
+
data: '2023-03-01T01:30:00.000-05:00'
|
|
65
|
+
},
|
|
66
|
+
assigned: {
|
|
67
|
+
data: {
|
|
68
|
+
displayName: 'Hana'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
status: {
|
|
72
|
+
data: {
|
|
73
|
+
text: 'To Do',
|
|
74
|
+
style: {
|
|
75
|
+
appearance: 'new'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
ari: {
|
|
81
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10027'
|
|
82
|
+
},
|
|
83
|
+
id: {
|
|
84
|
+
data: 'EDM-15'
|
|
85
|
+
},
|
|
86
|
+
description: {
|
|
87
|
+
data: 'Add Jira Provider'
|
|
88
|
+
},
|
|
89
|
+
createdAt: {
|
|
90
|
+
data: '2023-03-31T01:30:00.000-05:00'
|
|
91
|
+
},
|
|
92
|
+
assigned: {
|
|
93
|
+
data: {
|
|
94
|
+
displayName: 'Princey'
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
status: {
|
|
98
|
+
data: {
|
|
99
|
+
text: 'To Do'
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
ari: {
|
|
104
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10028'
|
|
105
|
+
},
|
|
106
|
+
id: {
|
|
107
|
+
data: 'EDM-16'
|
|
108
|
+
},
|
|
109
|
+
description: {
|
|
110
|
+
data: 'Plan team party'
|
|
111
|
+
},
|
|
112
|
+
createdAt: {
|
|
113
|
+
data: '2023-05-01T01:30:00.000-05:00'
|
|
114
|
+
},
|
|
115
|
+
assigned: {
|
|
116
|
+
data: {
|
|
117
|
+
displayName: 'Nidhin'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
status: {
|
|
121
|
+
data: {
|
|
122
|
+
text: 'Done',
|
|
123
|
+
style: {
|
|
124
|
+
appearance: 'success'
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}],
|
|
129
|
+
nextPageCursor: 'c3RhcnRBdD01'
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
var mockDatasourceDataNoActionsResponse = exports.mockDatasourceDataNoActionsResponse = {
|
|
13
133
|
meta: {
|
|
14
134
|
key: 'jira-object-provider',
|
|
15
135
|
access: 'granted',
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { useSmartLinkClientExtension } from './services/use-smart-link-client-extension';
|
|
2
2
|
export { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension } from './services/use-data-source-client-extension';
|
|
3
|
-
export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse, mockDatasourceDataResponse, mockDatasourceDataResponseWithSchema, mockActionsDiscoveryResponse, mockActionsDiscoveryEmptyResponse } from './services/use-data-source-client-extension/mocks';
|
|
3
|
+
export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse, mockDatasourceDataResponse, mockDatasourceDataNoActionsResponse, mockDatasourceDataResponseWithSchema, mockActionsDiscoveryResponse, mockActionsDiscoveryEmptyResponse } from './services/use-data-source-client-extension/mocks';
|
|
@@ -70,10 +70,23 @@ export const useDatasourceClientExtension = () => {
|
|
|
70
70
|
return cachedRequest(resolvedCacheIdKey, data, `${resolverUrl}/actions`, datasourceActionsPermissionsPromiseCache, force);
|
|
71
71
|
}, [resolverUrl]);
|
|
72
72
|
const executeAtomicAction = useCallback(async data => uncachedRequest(data, `${resolverUrl}/actions/execute`), [resolverUrl]);
|
|
73
|
+
const invalidateDatasourceDataCacheByAri = useCallback(ari => {
|
|
74
|
+
datasourceDataResponsePromiseCache.forEach(async (value, key) => {
|
|
75
|
+
const response = await value;
|
|
76
|
+
const targetFound = response.data.items.some(item => {
|
|
77
|
+
var _item$ari;
|
|
78
|
+
return ((_item$ari = item['ari']) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === ari;
|
|
79
|
+
});
|
|
80
|
+
if (targetFound) {
|
|
81
|
+
datasourceDataResponsePromiseCache.delete(key);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}, []);
|
|
73
85
|
return useMemo(() => ({
|
|
74
86
|
getDatasourceDetails,
|
|
75
87
|
getDatasourceData,
|
|
76
88
|
getDatasourceActionsAndPermissions,
|
|
77
|
-
executeAtomicAction
|
|
78
|
-
|
|
89
|
+
executeAtomicAction,
|
|
90
|
+
invalidateDatasourceDataCacheByAri
|
|
91
|
+
}), [getDatasourceDetails, getDatasourceData, getDatasourceActionsAndPermissions, executeAtomicAction, invalidateDatasourceDataCacheByAri]);
|
|
79
92
|
};
|
|
@@ -1,5 +1,125 @@
|
|
|
1
1
|
import { ActionOperationStatus } from '@atlaskit/linking-types';
|
|
2
2
|
export const mockDatasourceDataResponse = {
|
|
3
|
+
meta: {
|
|
4
|
+
key: 'jira-object-provider',
|
|
5
|
+
access: 'granted',
|
|
6
|
+
auth: [],
|
|
7
|
+
definitionId: 'object-resolver-service',
|
|
8
|
+
product: 'jira',
|
|
9
|
+
visibility: 'restricted',
|
|
10
|
+
extensionKey: 'jira-object-provider',
|
|
11
|
+
providerName: 'Jira',
|
|
12
|
+
destinationObjectTypes: ['issue'],
|
|
13
|
+
objectTypesEntity: 'work-item'
|
|
14
|
+
},
|
|
15
|
+
data: {
|
|
16
|
+
totalCount: 1234,
|
|
17
|
+
items: [{
|
|
18
|
+
ari: {
|
|
19
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025'
|
|
20
|
+
},
|
|
21
|
+
id: {
|
|
22
|
+
data: 'EDM-12'
|
|
23
|
+
},
|
|
24
|
+
description: {
|
|
25
|
+
data: 'Design datasource feature'
|
|
26
|
+
},
|
|
27
|
+
createdAt: {
|
|
28
|
+
data: '2023-01-22T01:30:00.000-05:00'
|
|
29
|
+
},
|
|
30
|
+
assigned: {
|
|
31
|
+
data: {
|
|
32
|
+
displayName: 'Sasha'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
status: {
|
|
36
|
+
data: {
|
|
37
|
+
text: 'In Progress',
|
|
38
|
+
style: {
|
|
39
|
+
appearance: 'inprogress'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
ari: {
|
|
45
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10026'
|
|
46
|
+
},
|
|
47
|
+
id: {
|
|
48
|
+
data: 'EDM-14'
|
|
49
|
+
},
|
|
50
|
+
description: {
|
|
51
|
+
data: 'Implement datasource feature'
|
|
52
|
+
},
|
|
53
|
+
createdAt: {
|
|
54
|
+
data: '2023-03-01T01:30:00.000-05:00'
|
|
55
|
+
},
|
|
56
|
+
assigned: {
|
|
57
|
+
data: {
|
|
58
|
+
displayName: 'Hana'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
status: {
|
|
62
|
+
data: {
|
|
63
|
+
text: 'To Do',
|
|
64
|
+
style: {
|
|
65
|
+
appearance: 'new'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
ari: {
|
|
71
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10027'
|
|
72
|
+
},
|
|
73
|
+
id: {
|
|
74
|
+
data: 'EDM-15'
|
|
75
|
+
},
|
|
76
|
+
description: {
|
|
77
|
+
data: 'Add Jira Provider'
|
|
78
|
+
},
|
|
79
|
+
createdAt: {
|
|
80
|
+
data: '2023-03-31T01:30:00.000-05:00'
|
|
81
|
+
},
|
|
82
|
+
assigned: {
|
|
83
|
+
data: {
|
|
84
|
+
displayName: 'Princey'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
status: {
|
|
88
|
+
data: {
|
|
89
|
+
text: 'To Do'
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, {
|
|
93
|
+
ari: {
|
|
94
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10028'
|
|
95
|
+
},
|
|
96
|
+
id: {
|
|
97
|
+
data: 'EDM-16'
|
|
98
|
+
},
|
|
99
|
+
description: {
|
|
100
|
+
data: 'Plan team party'
|
|
101
|
+
},
|
|
102
|
+
createdAt: {
|
|
103
|
+
data: '2023-05-01T01:30:00.000-05:00'
|
|
104
|
+
},
|
|
105
|
+
assigned: {
|
|
106
|
+
data: {
|
|
107
|
+
displayName: 'Nidhin'
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
status: {
|
|
111
|
+
data: {
|
|
112
|
+
text: 'Done',
|
|
113
|
+
style: {
|
|
114
|
+
appearance: 'success'
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}],
|
|
119
|
+
nextPageCursor: 'c3RhcnRBdD01'
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
export const mockDatasourceDataNoActionsResponse = {
|
|
3
123
|
meta: {
|
|
4
124
|
key: 'jira-object-provider',
|
|
5
125
|
access: 'granted',
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { useSmartLinkClientExtension } from './services/use-smart-link-client-extension';
|
|
2
2
|
export { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension } from './services/use-data-source-client-extension';
|
|
3
|
-
export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse, mockDatasourceDataResponse, mockDatasourceDataResponseWithSchema, mockActionsDiscoveryResponse, mockActionsDiscoveryEmptyResponse } from './services/use-data-source-client-extension/mocks';
|
|
3
|
+
export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse, mockDatasourceDataResponse, mockDatasourceDataNoActionsResponse, mockDatasourceDataResponseWithSchema, mockActionsDiscoveryResponse, mockActionsDiscoveryEmptyResponse } from './services/use-data-source-client-extension/mocks';
|
|
@@ -173,12 +173,42 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
|
|
|
173
173
|
return _ref6.apply(this, arguments);
|
|
174
174
|
};
|
|
175
175
|
}(), [resolverUrl]);
|
|
176
|
+
var invalidateDatasourceDataCacheByAri = useCallback(function (ari) {
|
|
177
|
+
datasourceDataResponsePromiseCache.forEach( /*#__PURE__*/function () {
|
|
178
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(value, key) {
|
|
179
|
+
var response, targetFound;
|
|
180
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
181
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
182
|
+
case 0:
|
|
183
|
+
_context7.next = 2;
|
|
184
|
+
return value;
|
|
185
|
+
case 2:
|
|
186
|
+
response = _context7.sent;
|
|
187
|
+
targetFound = response.data.items.some(function (item) {
|
|
188
|
+
var _item$ari;
|
|
189
|
+
return ((_item$ari = item['ari']) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === ari;
|
|
190
|
+
});
|
|
191
|
+
if (targetFound) {
|
|
192
|
+
datasourceDataResponsePromiseCache.delete(key);
|
|
193
|
+
}
|
|
194
|
+
case 5:
|
|
195
|
+
case "end":
|
|
196
|
+
return _context7.stop();
|
|
197
|
+
}
|
|
198
|
+
}, _callee7);
|
|
199
|
+
}));
|
|
200
|
+
return function (_x14, _x15) {
|
|
201
|
+
return _ref7.apply(this, arguments);
|
|
202
|
+
};
|
|
203
|
+
}());
|
|
204
|
+
}, []);
|
|
176
205
|
return useMemo(function () {
|
|
177
206
|
return {
|
|
178
207
|
getDatasourceDetails: getDatasourceDetails,
|
|
179
208
|
getDatasourceData: getDatasourceData,
|
|
180
209
|
getDatasourceActionsAndPermissions: getDatasourceActionsAndPermissions,
|
|
181
|
-
executeAtomicAction: executeAtomicAction
|
|
210
|
+
executeAtomicAction: executeAtomicAction,
|
|
211
|
+
invalidateDatasourceDataCacheByAri: invalidateDatasourceDataCacheByAri
|
|
182
212
|
};
|
|
183
|
-
}, [getDatasourceDetails, getDatasourceData, getDatasourceActionsAndPermissions, executeAtomicAction]);
|
|
213
|
+
}, [getDatasourceDetails, getDatasourceData, getDatasourceActionsAndPermissions, executeAtomicAction, invalidateDatasourceDataCacheByAri]);
|
|
184
214
|
};
|
|
@@ -3,6 +3,126 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
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; }
|
|
4
4
|
import { ActionOperationStatus } from '@atlaskit/linking-types';
|
|
5
5
|
export var mockDatasourceDataResponse = {
|
|
6
|
+
meta: {
|
|
7
|
+
key: 'jira-object-provider',
|
|
8
|
+
access: 'granted',
|
|
9
|
+
auth: [],
|
|
10
|
+
definitionId: 'object-resolver-service',
|
|
11
|
+
product: 'jira',
|
|
12
|
+
visibility: 'restricted',
|
|
13
|
+
extensionKey: 'jira-object-provider',
|
|
14
|
+
providerName: 'Jira',
|
|
15
|
+
destinationObjectTypes: ['issue'],
|
|
16
|
+
objectTypesEntity: 'work-item'
|
|
17
|
+
},
|
|
18
|
+
data: {
|
|
19
|
+
totalCount: 1234,
|
|
20
|
+
items: [{
|
|
21
|
+
ari: {
|
|
22
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025'
|
|
23
|
+
},
|
|
24
|
+
id: {
|
|
25
|
+
data: 'EDM-12'
|
|
26
|
+
},
|
|
27
|
+
description: {
|
|
28
|
+
data: 'Design datasource feature'
|
|
29
|
+
},
|
|
30
|
+
createdAt: {
|
|
31
|
+
data: '2023-01-22T01:30:00.000-05:00'
|
|
32
|
+
},
|
|
33
|
+
assigned: {
|
|
34
|
+
data: {
|
|
35
|
+
displayName: 'Sasha'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
status: {
|
|
39
|
+
data: {
|
|
40
|
+
text: 'In Progress',
|
|
41
|
+
style: {
|
|
42
|
+
appearance: 'inprogress'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
ari: {
|
|
48
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10026'
|
|
49
|
+
},
|
|
50
|
+
id: {
|
|
51
|
+
data: 'EDM-14'
|
|
52
|
+
},
|
|
53
|
+
description: {
|
|
54
|
+
data: 'Implement datasource feature'
|
|
55
|
+
},
|
|
56
|
+
createdAt: {
|
|
57
|
+
data: '2023-03-01T01:30:00.000-05:00'
|
|
58
|
+
},
|
|
59
|
+
assigned: {
|
|
60
|
+
data: {
|
|
61
|
+
displayName: 'Hana'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
status: {
|
|
65
|
+
data: {
|
|
66
|
+
text: 'To Do',
|
|
67
|
+
style: {
|
|
68
|
+
appearance: 'new'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
ari: {
|
|
74
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10027'
|
|
75
|
+
},
|
|
76
|
+
id: {
|
|
77
|
+
data: 'EDM-15'
|
|
78
|
+
},
|
|
79
|
+
description: {
|
|
80
|
+
data: 'Add Jira Provider'
|
|
81
|
+
},
|
|
82
|
+
createdAt: {
|
|
83
|
+
data: '2023-03-31T01:30:00.000-05:00'
|
|
84
|
+
},
|
|
85
|
+
assigned: {
|
|
86
|
+
data: {
|
|
87
|
+
displayName: 'Princey'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
status: {
|
|
91
|
+
data: {
|
|
92
|
+
text: 'To Do'
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}, {
|
|
96
|
+
ari: {
|
|
97
|
+
data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10028'
|
|
98
|
+
},
|
|
99
|
+
id: {
|
|
100
|
+
data: 'EDM-16'
|
|
101
|
+
},
|
|
102
|
+
description: {
|
|
103
|
+
data: 'Plan team party'
|
|
104
|
+
},
|
|
105
|
+
createdAt: {
|
|
106
|
+
data: '2023-05-01T01:30:00.000-05:00'
|
|
107
|
+
},
|
|
108
|
+
assigned: {
|
|
109
|
+
data: {
|
|
110
|
+
displayName: 'Nidhin'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
status: {
|
|
114
|
+
data: {
|
|
115
|
+
text: 'Done',
|
|
116
|
+
style: {
|
|
117
|
+
appearance: 'success'
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}],
|
|
122
|
+
nextPageCursor: 'c3RhcnRBdD01'
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
export var mockDatasourceDataNoActionsResponse = {
|
|
6
126
|
meta: {
|
|
7
127
|
key: 'jira-object-provider',
|
|
8
128
|
access: 'granted',
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { useSmartLinkClientExtension } from './services/use-smart-link-client-extension';
|
|
2
2
|
export { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension, } from './services/use-data-source-client-extension';
|
|
3
|
-
export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse, mockDatasourceDataResponse, mockDatasourceDataResponseWithSchema, mockActionsDiscoveryResponse, mockActionsDiscoveryEmptyResponse, } from './services/use-data-source-client-extension/mocks';
|
|
3
|
+
export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse, mockDatasourceDataResponse, mockDatasourceDataNoActionsResponse, mockDatasourceDataResponseWithSchema, mockActionsDiscoveryResponse, mockActionsDiscoveryEmptyResponse, } from './services/use-data-source-client-extension/mocks';
|
|
4
4
|
export type { JsonLdDatasourceResponse, DatasourceResolveResponse } from './types';
|
|
@@ -9,4 +9,5 @@ export declare const useDatasourceClientExtension: () => {
|
|
|
9
9
|
getDatasourceData: (datasourceId: string, data: DatasourceDataRequest, force?: boolean) => Promise<DatasourceDataResponse>;
|
|
10
10
|
getDatasourceActionsAndPermissions: (data: ActionsDiscoveryRequest, force?: boolean) => Promise<ActionsDiscoveryResponse>;
|
|
11
11
|
executeAtomicAction: (data: AtomicActionExecuteRequest) => Promise<AtomicActionExecuteResponse>;
|
|
12
|
+
invalidateDatasourceDataCacheByAri: (ari: string) => void;
|
|
12
13
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ActionsDiscoveryResponse, type ActionsServiceDiscoveryResponse, type AtomicActionExecuteResponse, type DatasourceDataResponse, type DatasourceDetailsResponse } from '@atlaskit/linking-types';
|
|
2
2
|
export declare const mockDatasourceDataResponse: DatasourceDataResponse;
|
|
3
|
+
export declare const mockDatasourceDataNoActionsResponse: DatasourceDataResponse;
|
|
3
4
|
export declare const mockDatasourceDetailsResponse: DatasourceDetailsResponse;
|
|
4
5
|
export declare const mockDatasourceDataResponseWithSchema: DatasourceDataResponse;
|
|
5
6
|
export declare const mockActionsDiscoveryResponse: ActionsDiscoveryResponse;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { useSmartLinkClientExtension } from './services/use-smart-link-client-extension';
|
|
2
2
|
export { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension, } from './services/use-data-source-client-extension';
|
|
3
|
-
export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse, mockDatasourceDataResponse, mockDatasourceDataResponseWithSchema, mockActionsDiscoveryResponse, mockActionsDiscoveryEmptyResponse, } from './services/use-data-source-client-extension/mocks';
|
|
3
|
+
export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse, mockDatasourceDataResponse, mockDatasourceDataNoActionsResponse, mockDatasourceDataResponseWithSchema, mockActionsDiscoveryResponse, mockActionsDiscoveryEmptyResponse, } from './services/use-data-source-client-extension/mocks';
|
|
4
4
|
export type { JsonLdDatasourceResponse, DatasourceResolveResponse } from './types';
|
|
@@ -9,4 +9,5 @@ export declare const useDatasourceClientExtension: () => {
|
|
|
9
9
|
getDatasourceData: (datasourceId: string, data: DatasourceDataRequest, force?: boolean) => Promise<DatasourceDataResponse>;
|
|
10
10
|
getDatasourceActionsAndPermissions: (data: ActionsDiscoveryRequest, force?: boolean) => Promise<ActionsDiscoveryResponse>;
|
|
11
11
|
executeAtomicAction: (data: AtomicActionExecuteRequest) => Promise<AtomicActionExecuteResponse>;
|
|
12
|
+
invalidateDatasourceDataCacheByAri: (ari: string) => void;
|
|
12
13
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ActionsDiscoveryResponse, type ActionsServiceDiscoveryResponse, type AtomicActionExecuteResponse, type DatasourceDataResponse, type DatasourceDetailsResponse } from '@atlaskit/linking-types';
|
|
2
2
|
export declare const mockDatasourceDataResponse: DatasourceDataResponse;
|
|
3
|
+
export declare const mockDatasourceDataNoActionsResponse: DatasourceDataResponse;
|
|
3
4
|
export declare const mockDatasourceDetailsResponse: DatasourceDetailsResponse;
|
|
4
5
|
export declare const mockDatasourceDataResponseWithSchema: DatasourceDataResponse;
|
|
5
6
|
export declare const mockActionsDiscoveryResponse: ActionsDiscoveryResponse;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-client-extension",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Extension methods for linking platform client",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
},
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Linking Platform",
|
|
12
|
-
"inPublicMirror": false,
|
|
13
|
-
"releaseModel": "continuous",
|
|
14
12
|
"website": {
|
|
15
13
|
"name": "LinkClientExtension"
|
|
16
14
|
},
|
|
@@ -43,10 +41,11 @@
|
|
|
43
41
|
"lru_map": "^0.4.1"
|
|
44
42
|
},
|
|
45
43
|
"peerDependencies": {
|
|
46
|
-
"@atlaskit/link-provider": "^1.
|
|
44
|
+
"@atlaskit/link-provider": "^1.16.0",
|
|
47
45
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
48
46
|
},
|
|
49
47
|
"devDependencies": {
|
|
48
|
+
"@atlaskit/link-test-helpers": "^7.5.0",
|
|
50
49
|
"@atlassian/feature-flags-test-utils": "0.2.3",
|
|
51
50
|
"@testing-library/react": "^12.1.5",
|
|
52
51
|
"@testing-library/react-hooks": "^8.0.1",
|