@atlaskit/link-datasource 5.4.4 → 5.5.1
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 +17 -0
- package/dist/cjs/common/utils/locale/fetch-messages-for-locale.js +16 -18
- package/dist/cjs/hooks/useAssetsClient.js +41 -41
- package/dist/cjs/hooks/useDatasourceTableState.js +50 -49
- package/dist/cjs/hooks/useLoadOptions.js +8 -8
- package/dist/cjs/hooks/useObjectSchemas.js +17 -17
- package/dist/cjs/hooks/useValidateAqlText.js +15 -15
- package/dist/cjs/services/cmdbService.js +43 -43
- package/dist/cjs/services/getAvailableSites.js +19 -19
- package/dist/cjs/services/makeGetJqlAutocompleteData.js +19 -19
- package/dist/cjs/services/makeGetJqlSuggestionsData.js +17 -17
- package/dist/cjs/services/useAvailableSites.js +4 -4
- package/dist/cjs/services/useBasicFilterAGG.js +1 -1
- package/dist/cjs/state/actions/index.js +11 -11
- package/dist/cjs/ui/assets-modal/search-container/object-schema-select/index.js +13 -13
- package/dist/cjs/ui/common/error-state/provider-auth-required.js +13 -12
- package/dist/cjs/ui/common/modal/popup-select/index.js +1 -1
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +2 -2
- package/dist/cjs/ui/confluence-search-modal/basic-filters/filters/edited-or-created-by/index.js +2 -2
- package/dist/cjs/ui/confluence-search-modal/basic-filters/hooks/useBasicFilterHydration.js +12 -12
- package/dist/cjs/ui/confluence-search-modal/basic-filters/hooks/useCurrentUserInfo.js +4 -4
- package/dist/cjs/ui/confluence-search-modal/basic-filters/hooks/useRecommendation.js +19 -19
- package/dist/cjs/ui/issue-like-table/drag-column-preview.compiled.css +1 -1
- package/dist/cjs/ui/issue-like-table/drag-column-preview.js +1 -1
- package/dist/cjs/ui/issue-like-table/index.js +14 -13
- package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +25 -23
- package/dist/cjs/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.js +13 -13
- package/dist/cjs/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +2 -2
- package/dist/es2019/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +2 -2
- package/dist/es2019/ui/issue-like-table/drag-column-preview.compiled.css +1 -1
- package/dist/es2019/ui/issue-like-table/drag-column-preview.js +1 -1
- package/dist/esm/common/utils/locale/fetch-messages-for-locale.js +15 -17
- package/dist/esm/hooks/useAssetsClient.js +41 -41
- package/dist/esm/hooks/useDatasourceTableState.js +50 -49
- package/dist/esm/hooks/useLoadOptions.js +8 -8
- package/dist/esm/hooks/useObjectSchemas.js +17 -17
- package/dist/esm/hooks/useValidateAqlText.js +15 -15
- package/dist/esm/services/cmdbService.js +43 -43
- package/dist/esm/services/getAvailableSites.js +19 -19
- package/dist/esm/services/makeGetJqlAutocompleteData.js +19 -19
- package/dist/esm/services/makeGetJqlSuggestionsData.js +17 -17
- package/dist/esm/services/useAvailableSites.js +4 -4
- package/dist/esm/services/useBasicFilterAGG.js +1 -1
- package/dist/esm/state/actions/index.js +11 -11
- package/dist/esm/ui/assets-modal/search-container/object-schema-select/index.js +12 -12
- package/dist/esm/ui/common/error-state/provider-auth-required.js +12 -11
- package/dist/esm/ui/common/modal/popup-select/index.js +1 -1
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/date-range-picker/messages.js +2 -2
- package/dist/esm/ui/confluence-search-modal/basic-filters/filters/edited-or-created-by/index.js +2 -2
- package/dist/esm/ui/confluence-search-modal/basic-filters/hooks/useBasicFilterHydration.js +12 -12
- package/dist/esm/ui/confluence-search-modal/basic-filters/hooks/useCurrentUserInfo.js +4 -4
- package/dist/esm/ui/confluence-search-modal/basic-filters/hooks/useRecommendation.js +19 -19
- package/dist/esm/ui/issue-like-table/drag-column-preview.compiled.css +1 -1
- package/dist/esm/ui/issue-like-table/drag-column-preview.js +1 -1
- package/dist/esm/ui/issue-like-table/index.js +13 -12
- package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useFilterOptions.js +25 -23
- package/dist/esm/ui/jira-issues-modal/basic-filters/hooks/useHydrateJqlQuery.js +13 -13
- package/dist/esm/ui/jira-issues-modal/basic-filters/ui/async-popup-select/index.js +2 -2
- package/link-datasource.docs.tsx +6 -3
- package/package.json +13 -13
|
@@ -104,35 +104,35 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
104
104
|
getDatasourceData = _useDatasourceClientE.getDatasourceData,
|
|
105
105
|
getDatasourceDetails = _useDatasourceClientE.getDatasourceDetails;
|
|
106
106
|
var loadDatasourceDetails = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
107
|
-
var _yield$getDatasourceD, _yield$getDatasourceD2, access, auth, schema, isColumnNotPresentInCurrentColumnsList, allColumns, newColumns;
|
|
108
|
-
return _regeneratorRuntime.wrap(function
|
|
107
|
+
var _yield$getDatasourceD, _yield$getDatasourceD2, access, auth, schema, isColumnNotPresentInCurrentColumnsList, allColumns, newColumns, _t;
|
|
108
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
109
109
|
while (1) switch (_context.prev = _context.next) {
|
|
110
110
|
case 0:
|
|
111
111
|
if (parameters) {
|
|
112
|
-
_context.next =
|
|
112
|
+
_context.next = 1;
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
115
|
return _context.abrupt("return");
|
|
116
|
-
case
|
|
117
|
-
_context.prev =
|
|
118
|
-
_context.next =
|
|
116
|
+
case 1:
|
|
117
|
+
_context.prev = 1;
|
|
118
|
+
_context.next = 2;
|
|
119
119
|
return getDatasourceDetails(datasourceId, {
|
|
120
120
|
parameters: parameters
|
|
121
121
|
});
|
|
122
|
-
case
|
|
122
|
+
case 2:
|
|
123
123
|
_yield$getDatasourceD = _context.sent;
|
|
124
124
|
_yield$getDatasourceD2 = _yield$getDatasourceD.meta;
|
|
125
125
|
access = _yield$getDatasourceD2.access;
|
|
126
126
|
auth = _yield$getDatasourceD2.auth;
|
|
127
127
|
schema = _yield$getDatasourceD.data.schema;
|
|
128
128
|
if (!(access === 'unauthorized' || access === 'forbidden')) {
|
|
129
|
-
_context.next =
|
|
129
|
+
_context.next = 3;
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
132
132
|
setStatus(access);
|
|
133
133
|
setAuthDetails(auth || initialEmptyArray);
|
|
134
134
|
return _context.abrupt("return");
|
|
135
|
-
case
|
|
135
|
+
case 3:
|
|
136
136
|
isColumnNotPresentInCurrentColumnsList = function isColumnNotPresentInCurrentColumnsList(col) {
|
|
137
137
|
return !columns.find(function (column) {
|
|
138
138
|
return column.key === col.key;
|
|
@@ -141,32 +141,32 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
141
141
|
allColumns = schema.properties;
|
|
142
142
|
newColumns = allColumns.filter(isColumnNotPresentInCurrentColumnsList);
|
|
143
143
|
newColumns.length > 0 && setColumns([].concat(_toConsumableArray(columns), _toConsumableArray(newColumns)));
|
|
144
|
-
_context.next =
|
|
144
|
+
_context.next = 7;
|
|
145
145
|
break;
|
|
146
|
-
case
|
|
147
|
-
_context.prev =
|
|
148
|
-
|
|
149
|
-
captureError('loadDatasourceDetails',
|
|
150
|
-
if (!(
|
|
151
|
-
_context.next =
|
|
146
|
+
case 4:
|
|
147
|
+
_context.prev = 4;
|
|
148
|
+
_t = _context["catch"](1);
|
|
149
|
+
captureError('loadDatasourceDetails', _t);
|
|
150
|
+
if (!(_t instanceof Response && _t.status === 401)) {
|
|
151
|
+
_context.next = 5;
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
154
|
setStatus('unauthorized');
|
|
155
155
|
return _context.abrupt("return");
|
|
156
|
-
case
|
|
157
|
-
if (!(
|
|
158
|
-
_context.next =
|
|
156
|
+
case 5:
|
|
157
|
+
if (!(_t instanceof Response && _t.status === 403)) {
|
|
158
|
+
_context.next = 6;
|
|
159
159
|
break;
|
|
160
160
|
}
|
|
161
161
|
setStatus('forbidden');
|
|
162
162
|
return _context.abrupt("return");
|
|
163
|
-
case
|
|
163
|
+
case 6:
|
|
164
164
|
setStatus('rejected');
|
|
165
|
-
case
|
|
165
|
+
case 7:
|
|
166
166
|
case "end":
|
|
167
167
|
return _context.stop();
|
|
168
168
|
}
|
|
169
|
-
}, _callee, null, [[
|
|
169
|
+
}, _callee, null, [[1, 4]]);
|
|
170
170
|
})), [captureError, columns, datasourceId, getDatasourceDetails, parameters, initialEmptyArray]);
|
|
171
171
|
var applySchemaProperties = useCallback(function (schema, fieldKeys) {
|
|
172
172
|
var properties = schema.properties,
|
|
@@ -246,8 +246,9 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
246
246
|
isUserLoadingNextPage,
|
|
247
247
|
currentLoadedItemCount,
|
|
248
248
|
newlyLoadedItemCount,
|
|
249
|
-
_args2 = arguments
|
|
250
|
-
|
|
249
|
+
_args2 = arguments,
|
|
250
|
+
_t2;
|
|
251
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
251
252
|
while (1) switch (_context2.prev = _context2.next) {
|
|
252
253
|
case 0:
|
|
253
254
|
requestInfo = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
@@ -261,11 +262,11 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
261
262
|
abortController.current = new AbortController();
|
|
262
263
|
currentAbortController = abortController.current;
|
|
263
264
|
if (parameters) {
|
|
264
|
-
_context2.next =
|
|
265
|
+
_context2.next = 1;
|
|
265
266
|
break;
|
|
266
267
|
}
|
|
267
268
|
return _context2.abrupt("return");
|
|
268
|
-
case
|
|
269
|
+
case 1:
|
|
269
270
|
_requestInfo$isSchema = requestInfo.isSchemaFromData, isSchemaFromData = _requestInfo$isSchema === void 0 ? true : _requestInfo$isSchema, shouldRequestFirstPage = requestInfo.shouldRequestFirstPage, _requestInfo$shouldFo = requestInfo.shouldForceRequest, shouldForceRequest = _requestInfo$shouldFo === void 0 ? false : _requestInfo$shouldFo;
|
|
270
271
|
isFullSchemaLoaded = fullSchema.properties.length > 0;
|
|
271
272
|
datasourceDataRequest = {
|
|
@@ -276,10 +277,10 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
276
277
|
includeSchema: isFullSchemaLoaded ? false : isSchemaFromData
|
|
277
278
|
};
|
|
278
279
|
setStatus('loading');
|
|
279
|
-
_context2.prev =
|
|
280
|
-
_context2.next =
|
|
280
|
+
_context2.prev = 2;
|
|
281
|
+
_context2.next = 3;
|
|
281
282
|
return getDatasourceData(datasourceId, datasourceDataRequest, shouldForceRequest);
|
|
282
|
-
case
|
|
283
|
+
case 3:
|
|
283
284
|
_yield$getDatasourceD3 = _context2.sent;
|
|
284
285
|
_yield$getDatasourceD4 = _yield$getDatasourceD3.meta;
|
|
285
286
|
access = _yield$getDatasourceD4.access;
|
|
@@ -295,21 +296,21 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
295
296
|
_totalCount = _yield$getDatasourceD5.totalCount;
|
|
296
297
|
schema = _yield$getDatasourceD5.schema;
|
|
297
298
|
if (!((_currentAbortControll = currentAbortController) !== null && _currentAbortControll !== void 0 && _currentAbortControll.signal.aborted)) {
|
|
298
|
-
_context2.next =
|
|
299
|
+
_context2.next = 4;
|
|
299
300
|
break;
|
|
300
301
|
}
|
|
301
302
|
throw new Error('Aborted');
|
|
302
|
-
case
|
|
303
|
+
case 4:
|
|
303
304
|
setExtensionKey(_extensionKey);
|
|
304
305
|
setProviderName(_providerName);
|
|
305
306
|
if (!(access === 'unauthorized' || access === 'forbidden')) {
|
|
306
|
-
_context2.next =
|
|
307
|
+
_context2.next = 5;
|
|
307
308
|
break;
|
|
308
309
|
}
|
|
309
310
|
setStatus(access);
|
|
310
311
|
setAuthDetails(auth || initialEmptyArray);
|
|
311
312
|
return _context2.abrupt("return");
|
|
312
|
-
case
|
|
313
|
+
case 5:
|
|
313
314
|
setDestinationObjectTypes(_destinationObjectTypes);
|
|
314
315
|
setTotalCount(_totalCount);
|
|
315
316
|
setNextCursor(nextPageCursor);
|
|
@@ -366,38 +367,38 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
366
367
|
});
|
|
367
368
|
}
|
|
368
369
|
setStatus('resolved');
|
|
369
|
-
_context2.next =
|
|
370
|
+
_context2.next = 10;
|
|
370
371
|
break;
|
|
371
|
-
case
|
|
372
|
-
_context2.prev =
|
|
373
|
-
|
|
374
|
-
if (!(
|
|
375
|
-
_context2.next =
|
|
372
|
+
case 6:
|
|
373
|
+
_context2.prev = 6;
|
|
374
|
+
_t2 = _context2["catch"](2);
|
|
375
|
+
if (!(_t2.message === 'Aborted')) {
|
|
376
|
+
_context2.next = 7;
|
|
376
377
|
break;
|
|
377
378
|
}
|
|
378
379
|
return _context2.abrupt("return");
|
|
379
|
-
case
|
|
380
|
-
captureError('onNextPage',
|
|
381
|
-
if (!(
|
|
382
|
-
_context2.next =
|
|
380
|
+
case 7:
|
|
381
|
+
captureError('onNextPage', _t2);
|
|
382
|
+
if (!(_t2 instanceof Response && _t2.status === 401)) {
|
|
383
|
+
_context2.next = 8;
|
|
383
384
|
break;
|
|
384
385
|
}
|
|
385
386
|
setStatus('unauthorized');
|
|
386
387
|
return _context2.abrupt("return");
|
|
387
|
-
case
|
|
388
|
-
if (!(
|
|
389
|
-
_context2.next =
|
|
388
|
+
case 8:
|
|
389
|
+
if (!(_t2 instanceof Response && _t2.status === 403)) {
|
|
390
|
+
_context2.next = 9;
|
|
390
391
|
break;
|
|
391
392
|
}
|
|
392
393
|
setStatus('forbidden');
|
|
393
394
|
return _context2.abrupt("return");
|
|
394
|
-
case
|
|
395
|
+
case 9:
|
|
395
396
|
setStatus('rejected');
|
|
396
|
-
case
|
|
397
|
+
case 10:
|
|
397
398
|
case "end":
|
|
398
399
|
return _context2.stop();
|
|
399
400
|
}
|
|
400
|
-
}, _callee2, null, [[
|
|
401
|
+
}, _callee2, null, [[2, 6]]);
|
|
401
402
|
})), [captureError, parameters, fieldKeys, nextCursor, responseItems, setResponseItemIds, onAddItems, getDatasourceData, datasourceId, applySchemaProperties, fireEvent, fullSchema, initialEmptyArray, discoverActions, isInPDFRender]);
|
|
402
403
|
var reset = useCallback(function (options) {
|
|
403
404
|
setResponseItems(initialEmptyArray);
|
|
@@ -16,30 +16,30 @@ var loadOptions = /*#__PURE__*/function () {
|
|
|
16
16
|
operationStatus,
|
|
17
17
|
entities,
|
|
18
18
|
_args = arguments;
|
|
19
|
-
return _regeneratorRuntime.wrap(function
|
|
19
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
21
21
|
case 0:
|
|
22
22
|
fetchInputs = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
23
23
|
executeFetch = _args.length > 1 ? _args[1] : undefined;
|
|
24
24
|
if (executeFetch) {
|
|
25
|
-
_context.next =
|
|
25
|
+
_context.next = 1;
|
|
26
26
|
break;
|
|
27
27
|
}
|
|
28
28
|
return _context.abrupt("return", []);
|
|
29
|
-
case
|
|
30
|
-
_context.next =
|
|
29
|
+
case 1:
|
|
30
|
+
_context.next = 2;
|
|
31
31
|
return executeFetch(fetchInputs);
|
|
32
|
-
case
|
|
32
|
+
case 2:
|
|
33
33
|
result = _context.sent;
|
|
34
34
|
operationStatus = result.operationStatus, entities = result.entities;
|
|
35
35
|
if (!(operationStatus === ActionOperationStatus.FAILURE)) {
|
|
36
|
-
_context.next =
|
|
36
|
+
_context.next = 3;
|
|
37
37
|
break;
|
|
38
38
|
}
|
|
39
39
|
throw new Error('Failed to fetch status options');
|
|
40
|
-
case
|
|
40
|
+
case 3:
|
|
41
41
|
return _context.abrupt("return", entities !== null && entities !== void 0 ? entities : []);
|
|
42
|
-
case
|
|
42
|
+
case 4:
|
|
43
43
|
case "end":
|
|
44
44
|
return _context.stop();
|
|
45
45
|
}
|
|
@@ -22,45 +22,45 @@ export var useObjectSchemas = function useObjectSchemas(workspaceId) {
|
|
|
22
22
|
setError = _useState8[1];
|
|
23
23
|
var request = useCallback( /*#__PURE__*/function () {
|
|
24
24
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(query) {
|
|
25
|
-
var fetchedObjectSchemas, fetchTotalObjectSchemas, fetchedObjectSchemasResponse;
|
|
26
|
-
return _regeneratorRuntime.wrap(function
|
|
25
|
+
var fetchedObjectSchemas, fetchTotalObjectSchemas, fetchedObjectSchemasResponse, _t;
|
|
26
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
27
27
|
while (1) switch (_context.prev = _context.next) {
|
|
28
28
|
case 0:
|
|
29
29
|
setLoading(true);
|
|
30
30
|
setError(undefined);
|
|
31
|
-
_context.prev =
|
|
32
|
-
_context.next =
|
|
31
|
+
_context.prev = 1;
|
|
32
|
+
_context.next = 2;
|
|
33
33
|
return fetchObjectSchemas(workspaceId, query);
|
|
34
|
-
case
|
|
34
|
+
case 2:
|
|
35
35
|
fetchedObjectSchemasResponse = _context.sent;
|
|
36
36
|
setObjectSchemas(fetchedObjectSchemasResponse.values);
|
|
37
37
|
setTotalObjectSchemas(fetchedObjectSchemasResponse.total);
|
|
38
38
|
fetchedObjectSchemas = fetchedObjectSchemasResponse.values;
|
|
39
39
|
fetchTotalObjectSchemas = fetchedObjectSchemasResponse.total;
|
|
40
|
-
_context.next =
|
|
40
|
+
_context.next = 4;
|
|
41
41
|
break;
|
|
42
|
-
case
|
|
43
|
-
_context.prev =
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
setError(
|
|
42
|
+
case 3:
|
|
43
|
+
_context.prev = 3;
|
|
44
|
+
_t = _context["catch"](1);
|
|
45
|
+
if (_t instanceof Error) {
|
|
46
|
+
setError(_t);
|
|
47
47
|
} else {
|
|
48
48
|
setError(new Error('Unexpected error occured'));
|
|
49
49
|
}
|
|
50
|
-
case
|
|
51
|
-
_context.prev =
|
|
50
|
+
case 4:
|
|
51
|
+
_context.prev = 4;
|
|
52
52
|
setLoading(false);
|
|
53
|
-
return _context.finish(
|
|
54
|
-
case
|
|
53
|
+
return _context.finish(4);
|
|
54
|
+
case 5:
|
|
55
55
|
return _context.abrupt("return", {
|
|
56
56
|
objectSchemas: fetchedObjectSchemas,
|
|
57
57
|
totalObjectSchemas: fetchTotalObjectSchemas
|
|
58
58
|
});
|
|
59
|
-
case
|
|
59
|
+
case 6:
|
|
60
60
|
case "end":
|
|
61
61
|
return _context.stop();
|
|
62
62
|
}
|
|
63
|
-
}, _callee, null, [[
|
|
63
|
+
}, _callee, null, [[1, 3, 4, 5]]);
|
|
64
64
|
}));
|
|
65
65
|
return function (_x) {
|
|
66
66
|
return _ref.apply(this, arguments);
|
|
@@ -23,23 +23,23 @@ export var useValidateAqlText = function useValidateAqlText(workspaceId, initial
|
|
|
23
23
|
// We return undefined when valid and 'error' when invalid
|
|
24
24
|
var validateAqlText = useCallback( /*#__PURE__*/function () {
|
|
25
25
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(aql) {
|
|
26
|
-
var validateAqlResponse, _validateAqlResponse$, _validateAqlResponse$2;
|
|
27
|
-
return _regeneratorRuntime.wrap(function
|
|
26
|
+
var validateAqlResponse, _validateAqlResponse$, _validateAqlResponse$2, _t;
|
|
27
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
28
28
|
while (1) switch (_context.prev = _context.next) {
|
|
29
29
|
case 0:
|
|
30
30
|
if (!(aql !== null && aql !== void 0 && aql.trim())) {
|
|
31
|
-
_context.next =
|
|
31
|
+
_context.next = 6;
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
_context.prev = 1;
|
|
35
|
-
_context.next =
|
|
35
|
+
_context.next = 2;
|
|
36
36
|
return validateAql(workspaceId, {
|
|
37
37
|
qlQuery: aql
|
|
38
38
|
}, fireEvent);
|
|
39
|
-
case
|
|
39
|
+
case 2:
|
|
40
40
|
validateAqlResponse = _context.sent;
|
|
41
41
|
if (!validateAqlResponse.isValid) {
|
|
42
|
-
_context.next =
|
|
42
|
+
_context.next = 3;
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
45
|
setLastValidationResult({
|
|
@@ -47,33 +47,33 @@ export var useValidateAqlText = function useValidateAqlText(workspaceId, initial
|
|
|
47
47
|
validatedAql: aql
|
|
48
48
|
});
|
|
49
49
|
return _context.abrupt("return", undefined);
|
|
50
|
-
case
|
|
50
|
+
case 3:
|
|
51
51
|
setLastValidationResult({
|
|
52
52
|
type: 'invalid',
|
|
53
53
|
error: (_validateAqlResponse$ = (_validateAqlResponse$2 = validateAqlResponse.errors) === null || _validateAqlResponse$2 === void 0 ? void 0 : _validateAqlResponse$2.iql) !== null && _validateAqlResponse$ !== void 0 ? _validateAqlResponse$ : ''
|
|
54
54
|
});
|
|
55
55
|
return _context.abrupt("return", 'error');
|
|
56
|
-
case
|
|
57
|
-
_context.next =
|
|
56
|
+
case 4:
|
|
57
|
+
_context.next = 6;
|
|
58
58
|
break;
|
|
59
|
-
case
|
|
60
|
-
_context.prev =
|
|
61
|
-
|
|
59
|
+
case 5:
|
|
60
|
+
_context.prev = 5;
|
|
61
|
+
_t = _context["catch"](1);
|
|
62
62
|
setLastValidationResult({
|
|
63
63
|
type: 'invalid',
|
|
64
64
|
error: ''
|
|
65
65
|
});
|
|
66
66
|
return _context.abrupt("return", 'error');
|
|
67
|
-
case
|
|
67
|
+
case 6:
|
|
68
68
|
setLastValidationResult({
|
|
69
69
|
type: 'idle'
|
|
70
70
|
});
|
|
71
71
|
return _context.abrupt("return", undefined);
|
|
72
|
-
case
|
|
72
|
+
case 7:
|
|
73
73
|
case "end":
|
|
74
74
|
return _context.stop();
|
|
75
75
|
}
|
|
76
|
-
}, _callee, null, [[1,
|
|
76
|
+
}, _callee, null, [[1, 5]]);
|
|
77
77
|
}));
|
|
78
78
|
return function (_x) {
|
|
79
79
|
return _ref.apply(this, arguments);
|
|
@@ -4,28 +4,28 @@ import { request } from '@atlaskit/linking-common';
|
|
|
4
4
|
import { FetchError, getStatusCodeGroup, mapFetchErrors, PermissionError } from './cmdbService.utils';
|
|
5
5
|
export var getWorkspaceId = /*#__PURE__*/function () {
|
|
6
6
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fireEvent) {
|
|
7
|
-
var url, _workspaceDetailsResp, workspaceDetailsResponse, error;
|
|
8
|
-
return _regeneratorRuntime.wrap(function
|
|
7
|
+
var url, _workspaceDetailsResp, workspaceDetailsResponse, error, _t;
|
|
8
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
9
9
|
while (1) switch (_context.prev = _context.next) {
|
|
10
10
|
case 0:
|
|
11
11
|
url = '/rest/servicedesk/cmdb/latest/workspace';
|
|
12
12
|
_context.prev = 1;
|
|
13
|
-
_context.next =
|
|
13
|
+
_context.next = 2;
|
|
14
14
|
return request('get', url, undefined, undefined, [200, 201, 202, 203, 204]);
|
|
15
|
-
case
|
|
15
|
+
case 2:
|
|
16
16
|
workspaceDetailsResponse = _context.sent;
|
|
17
17
|
if ((_workspaceDetailsResp = workspaceDetailsResponse.results) !== null && _workspaceDetailsResp !== void 0 && _workspaceDetailsResp.length) {
|
|
18
|
-
_context.next =
|
|
18
|
+
_context.next = 3;
|
|
19
19
|
break;
|
|
20
20
|
}
|
|
21
21
|
throw new PermissionError('No workspace results found');
|
|
22
|
-
case
|
|
22
|
+
case 3:
|
|
23
23
|
fireEvent && fireEvent('operational.getWorkspaceId.success', {});
|
|
24
24
|
return _context.abrupt("return", workspaceDetailsResponse.results[0].id);
|
|
25
|
-
case
|
|
26
|
-
_context.prev =
|
|
27
|
-
|
|
28
|
-
error = mapFetchErrors(
|
|
25
|
+
case 4:
|
|
26
|
+
_context.prev = 4;
|
|
27
|
+
_t = _context["catch"](1);
|
|
28
|
+
error = mapFetchErrors(_t);
|
|
29
29
|
if (error instanceof FetchError) {
|
|
30
30
|
fireEvent && fireEvent('operational.getWorkspaceId.failed', {
|
|
31
31
|
statusCodeGroup: getStatusCodeGroup(error)
|
|
@@ -36,11 +36,11 @@ export var getWorkspaceId = /*#__PURE__*/function () {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
throw error;
|
|
39
|
-
case
|
|
39
|
+
case 5:
|
|
40
40
|
case "end":
|
|
41
41
|
return _context.stop();
|
|
42
42
|
}
|
|
43
|
-
}, _callee, null, [[1,
|
|
43
|
+
}, _callee, null, [[1, 4]]);
|
|
44
44
|
}));
|
|
45
45
|
return function getWorkspaceId(_x) {
|
|
46
46
|
return _ref.apply(this, arguments);
|
|
@@ -48,25 +48,25 @@ export var getWorkspaceId = /*#__PURE__*/function () {
|
|
|
48
48
|
}();
|
|
49
49
|
export var validateAql = /*#__PURE__*/function () {
|
|
50
50
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(workspaceId, data, fireEvent) {
|
|
51
|
-
var url, response, error;
|
|
52
|
-
return _regeneratorRuntime.wrap(function
|
|
51
|
+
var url, response, error, _t2;
|
|
52
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
53
53
|
while (1) switch (_context2.prev = _context2.next) {
|
|
54
54
|
case 0:
|
|
55
55
|
url = "/gateway/api/jsm/assets/workspace/".concat(workspaceId, "/v1/aql/validate");
|
|
56
56
|
_context2.prev = 1;
|
|
57
|
-
_context2.next =
|
|
57
|
+
_context2.next = 2;
|
|
58
58
|
return request('post', url, {
|
|
59
59
|
qlQuery: data.qlQuery,
|
|
60
60
|
context: 'SMART_LINKS'
|
|
61
61
|
}, undefined, [200, 201, 202, 203, 204]);
|
|
62
|
-
case
|
|
62
|
+
case 2:
|
|
63
63
|
response = _context2.sent;
|
|
64
64
|
fireEvent && fireEvent('operational.validateAql.success', {});
|
|
65
65
|
return _context2.abrupt("return", response);
|
|
66
|
-
case
|
|
67
|
-
_context2.prev =
|
|
68
|
-
|
|
69
|
-
error = mapFetchErrors(
|
|
66
|
+
case 3:
|
|
67
|
+
_context2.prev = 3;
|
|
68
|
+
_t2 = _context2["catch"](1);
|
|
69
|
+
error = mapFetchErrors(_t2);
|
|
70
70
|
if (error instanceof FetchError) {
|
|
71
71
|
fireEvent && fireEvent('operational.validateAql.failed', {
|
|
72
72
|
statusCodeGroup: getStatusCodeGroup(error)
|
|
@@ -76,11 +76,11 @@ export var validateAql = /*#__PURE__*/function () {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
throw error;
|
|
79
|
-
case
|
|
79
|
+
case 4:
|
|
80
80
|
case "end":
|
|
81
81
|
return _context2.stop();
|
|
82
82
|
}
|
|
83
|
-
}, _callee2, null, [[1,
|
|
83
|
+
}, _callee2, null, [[1, 3]]);
|
|
84
84
|
}));
|
|
85
85
|
return function validateAql(_x2, _x3, _x4) {
|
|
86
86
|
return _ref2.apply(this, arguments);
|
|
@@ -88,22 +88,22 @@ export var validateAql = /*#__PURE__*/function () {
|
|
|
88
88
|
}();
|
|
89
89
|
export var fetchObjectSchema = /*#__PURE__*/function () {
|
|
90
90
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(workspaceId, schemaId, fireEvent) {
|
|
91
|
-
var url, response, error;
|
|
92
|
-
return _regeneratorRuntime.wrap(function
|
|
91
|
+
var url, response, error, _t3;
|
|
92
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
93
93
|
while (1) switch (_context3.prev = _context3.next) {
|
|
94
94
|
case 0:
|
|
95
95
|
url = "/gateway/api/jsm/assets/workspace/".concat(workspaceId, "/v1/objectschema/").concat(schemaId);
|
|
96
96
|
_context3.prev = 1;
|
|
97
|
-
_context3.next =
|
|
97
|
+
_context3.next = 2;
|
|
98
98
|
return request('get', url, undefined, undefined, [200, 201, 202, 203, 204]);
|
|
99
|
-
case
|
|
99
|
+
case 2:
|
|
100
100
|
response = _context3.sent;
|
|
101
101
|
fireEvent && fireEvent('operational.objectSchema.success', {});
|
|
102
102
|
return _context3.abrupt("return", response);
|
|
103
|
-
case
|
|
104
|
-
_context3.prev =
|
|
105
|
-
|
|
106
|
-
error = mapFetchErrors(
|
|
103
|
+
case 3:
|
|
104
|
+
_context3.prev = 3;
|
|
105
|
+
_t3 = _context3["catch"](1);
|
|
106
|
+
error = mapFetchErrors(_t3);
|
|
107
107
|
if (error instanceof FetchError) {
|
|
108
108
|
fireEvent && fireEvent('operational.objectSchema.failed', {
|
|
109
109
|
statusCodeGroup: getStatusCodeGroup(error)
|
|
@@ -113,11 +113,11 @@ export var fetchObjectSchema = /*#__PURE__*/function () {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
throw error;
|
|
116
|
-
case
|
|
116
|
+
case 4:
|
|
117
117
|
case "end":
|
|
118
118
|
return _context3.stop();
|
|
119
119
|
}
|
|
120
|
-
}, _callee3, null, [[1,
|
|
120
|
+
}, _callee3, null, [[1, 3]]);
|
|
121
121
|
}));
|
|
122
122
|
return function fetchObjectSchema(_x5, _x6, _x7) {
|
|
123
123
|
return _ref3.apply(this, arguments);
|
|
@@ -125,8 +125,8 @@ export var fetchObjectSchema = /*#__PURE__*/function () {
|
|
|
125
125
|
}();
|
|
126
126
|
export var fetchObjectSchemas = /*#__PURE__*/function () {
|
|
127
127
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(workspaceId, query, fireEvent) {
|
|
128
|
-
var queryParams, url, response, error;
|
|
129
|
-
return _regeneratorRuntime.wrap(function
|
|
128
|
+
var queryParams, url, response, error, _t4;
|
|
129
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
130
130
|
while (1) switch (_context4.prev = _context4.next) {
|
|
131
131
|
case 0:
|
|
132
132
|
queryParams = new URLSearchParams();
|
|
@@ -134,17 +134,17 @@ export var fetchObjectSchemas = /*#__PURE__*/function () {
|
|
|
134
134
|
queryParams.set('includeCounts', 'false');
|
|
135
135
|
query && queryParams.set('query', query);
|
|
136
136
|
url = "/gateway/api/jsm/assets/workspace/".concat(workspaceId, "/v1/objectschema/list?").concat(queryParams);
|
|
137
|
-
_context4.prev =
|
|
138
|
-
_context4.next =
|
|
137
|
+
_context4.prev = 1;
|
|
138
|
+
_context4.next = 2;
|
|
139
139
|
return request('get', url, undefined, undefined, [200, 201, 202, 203, 204]);
|
|
140
|
-
case
|
|
140
|
+
case 2:
|
|
141
141
|
response = _context4.sent;
|
|
142
142
|
fireEvent && fireEvent('operational.objectSchemas.success', {});
|
|
143
143
|
return _context4.abrupt("return", response);
|
|
144
|
-
case
|
|
145
|
-
_context4.prev =
|
|
146
|
-
|
|
147
|
-
error = mapFetchErrors(
|
|
144
|
+
case 3:
|
|
145
|
+
_context4.prev = 3;
|
|
146
|
+
_t4 = _context4["catch"](1);
|
|
147
|
+
error = mapFetchErrors(_t4);
|
|
148
148
|
if (error instanceof FetchError) {
|
|
149
149
|
fireEvent && fireEvent('operational.objectSchemas.failed', {
|
|
150
150
|
statusCodeGroup: getStatusCodeGroup(error)
|
|
@@ -154,11 +154,11 @@ export var fetchObjectSchemas = /*#__PURE__*/function () {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
throw error;
|
|
157
|
-
case
|
|
157
|
+
case 4:
|
|
158
158
|
case "end":
|
|
159
159
|
return _context4.stop();
|
|
160
160
|
}
|
|
161
|
-
}, _callee4, null, [[
|
|
161
|
+
}, _callee4, null, [[1, 3]]);
|
|
162
162
|
}));
|
|
163
163
|
return function fetchObjectSchemas(_x8, _x9, _x0) {
|
|
164
164
|
return _ref4.apply(this, arguments);
|
|
@@ -4,8 +4,8 @@ import { mapAccessibleProductsToAvailableSites } from '@atlaskit/linking-common/
|
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
export var getAccessibleProducts = /*#__PURE__*/function () {
|
|
6
6
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(product) {
|
|
7
|
-
var requestConfig, endpoint, response, res;
|
|
8
|
-
return _regeneratorRuntime.wrap(function
|
|
7
|
+
var requestConfig, endpoint, response, res, _t, _t2, _t3;
|
|
8
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
9
9
|
while (1) switch (_context.prev = _context.next) {
|
|
10
10
|
case 0:
|
|
11
11
|
requestConfig = {
|
|
@@ -21,34 +21,34 @@ export var getAccessibleProducts = /*#__PURE__*/function () {
|
|
|
21
21
|
})
|
|
22
22
|
};
|
|
23
23
|
endpoint = fg('linking_platform_link_datasource_unit_compliant') ? '/gateway/api/experimental/v2/accessible-products' : '/gateway/api/v2/accessible-products';
|
|
24
|
-
_context.next =
|
|
24
|
+
_context.next = 1;
|
|
25
25
|
return fetch(endpoint, requestConfig);
|
|
26
|
-
case
|
|
26
|
+
case 1:
|
|
27
27
|
response = _context.sent;
|
|
28
28
|
if (!response.ok) {
|
|
29
|
-
_context.next =
|
|
29
|
+
_context.next = 3;
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
32
|
-
_context.next =
|
|
32
|
+
_context.next = 2;
|
|
33
33
|
return response.json();
|
|
34
|
-
case
|
|
34
|
+
case 2:
|
|
35
35
|
res = _context.sent;
|
|
36
36
|
return _context.abrupt("return", mapAccessibleProductsToAvailableSites(res.data));
|
|
37
|
-
case
|
|
38
|
-
|
|
39
|
-
_context.next =
|
|
37
|
+
case 3:
|
|
38
|
+
_t = Error;
|
|
39
|
+
_context.next = 4;
|
|
40
40
|
return response.text();
|
|
41
|
-
case
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
_context.next =
|
|
41
|
+
case 4:
|
|
42
|
+
_t2 = _context.sent;
|
|
43
|
+
if (_t2) {
|
|
44
|
+
_context.next = 5;
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
case
|
|
49
|
-
|
|
50
|
-
throw new
|
|
51
|
-
case
|
|
47
|
+
_t2 = 'Something went wrong';
|
|
48
|
+
case 5:
|
|
49
|
+
_t3 = _t2;
|
|
50
|
+
throw new _t(_t3);
|
|
51
|
+
case 6:
|
|
52
52
|
case "end":
|
|
53
53
|
return _context.stop();
|
|
54
54
|
}
|