@atlaskit/link-datasource 0.27.3 → 0.28.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/hooks/useAssetsClient.js +70 -0
  3. package/dist/cjs/hooks/useValidateAqlText.js +48 -0
  4. package/dist/cjs/index.js +13 -0
  5. package/dist/cjs/services/cmdbService.js +53 -0
  6. package/dist/cjs/types/assets/types.js +5 -0
  7. package/dist/cjs/ui/assets-modal/index.js +31 -0
  8. package/dist/cjs/ui/assets-modal/modal/index.js +68 -0
  9. package/dist/cjs/ui/assets-modal/modal/messages.js +20 -0
  10. package/dist/cjs/ui/assets-modal/modal/render-assets-content/index.js +27 -0
  11. package/dist/cjs/ui/assets-modal/modal/styled.js +12 -0
  12. package/dist/cjs/ui/assets-modal/types.js +5 -0
  13. package/dist/cjs/ui/common/error-state/modal-loading-error.js +2 -2
  14. package/dist/cjs/version.json +1 -1
  15. package/dist/es2019/hooks/useAssetsClient.js +32 -0
  16. package/dist/es2019/hooks/useValidateAqlText.js +17 -0
  17. package/dist/es2019/index.js +3 -1
  18. package/dist/es2019/services/cmdbService.js +21 -0
  19. package/dist/es2019/types/assets/types.js +1 -0
  20. package/dist/es2019/ui/assets-modal/index.js +13 -0
  21. package/dist/es2019/ui/assets-modal/modal/index.js +52 -0
  22. package/dist/es2019/ui/assets-modal/modal/messages.js +13 -0
  23. package/dist/es2019/ui/assets-modal/modal/render-assets-content/index.js +21 -0
  24. package/dist/es2019/ui/assets-modal/modal/styled.js +6 -0
  25. package/dist/es2019/ui/assets-modal/types.js +1 -0
  26. package/dist/es2019/ui/common/error-state/modal-loading-error.js +2 -2
  27. package/dist/es2019/version.json +1 -1
  28. package/dist/esm/hooks/useAssetsClient.js +62 -0
  29. package/dist/esm/hooks/useValidateAqlText.js +40 -0
  30. package/dist/esm/index.js +3 -1
  31. package/dist/esm/services/cmdbService.js +43 -0
  32. package/dist/esm/types/assets/types.js +1 -0
  33. package/dist/esm/ui/assets-modal/index.js +17 -0
  34. package/dist/esm/ui/assets-modal/modal/index.js +56 -0
  35. package/dist/esm/ui/assets-modal/modal/messages.js +13 -0
  36. package/dist/esm/ui/assets-modal/modal/render-assets-content/index.js +19 -0
  37. package/dist/esm/ui/assets-modal/modal/styled.js +4 -0
  38. package/dist/esm/ui/assets-modal/types.js +1 -0
  39. package/dist/esm/ui/common/error-state/modal-loading-error.js +2 -2
  40. package/dist/esm/version.json +1 -1
  41. package/dist/types/hooks/useAssetsClient.d.ts +6 -0
  42. package/dist/types/hooks/useValidateAqlText.d.ts +4 -0
  43. package/dist/types/index.d.ts +3 -0
  44. package/dist/types/services/cmdbService.d.ts +6 -0
  45. package/dist/types/types/assets/types.d.ts +23 -0
  46. package/dist/types/ui/assets-modal/index.d.ts +5 -0
  47. package/dist/types/ui/assets-modal/modal/index.d.ts +3 -0
  48. package/dist/types/ui/assets-modal/modal/messages.d.ts +12 -0
  49. package/dist/types/ui/assets-modal/modal/render-assets-content/index.d.ts +8 -0
  50. package/dist/types/ui/assets-modal/modal/styled.d.ts +5 -0
  51. package/dist/types/ui/assets-modal/types.d.ts +23 -0
  52. package/dist/types/ui/common/error-state/modal-loading-error.d.ts +1 -1
  53. package/dist/types-ts4.5/hooks/useAssetsClient.d.ts +6 -0
  54. package/dist/types-ts4.5/hooks/useValidateAqlText.d.ts +4 -0
  55. package/dist/types-ts4.5/index.d.ts +3 -0
  56. package/dist/types-ts4.5/services/cmdbService.d.ts +6 -0
  57. package/dist/types-ts4.5/types/assets/types.d.ts +23 -0
  58. package/dist/types-ts4.5/ui/assets-modal/index.d.ts +5 -0
  59. package/dist/types-ts4.5/ui/assets-modal/modal/index.d.ts +3 -0
  60. package/dist/types-ts4.5/ui/assets-modal/modal/messages.d.ts +12 -0
  61. package/dist/types-ts4.5/ui/assets-modal/modal/render-assets-content/index.d.ts +8 -0
  62. package/dist/types-ts4.5/ui/assets-modal/modal/styled.d.ts +5 -0
  63. package/dist/types-ts4.5/ui/assets-modal/types.d.ts +23 -0
  64. package/dist/types-ts4.5/ui/common/error-state/modal-loading-error.d.ts +1 -1
  65. package/package.json +3 -2
  66. package/report.api.md +46 -0
  67. package/tmp/api-report-tmp.d.ts +43 -0
@@ -34,11 +34,11 @@ export const ModalLoadingError = ({
34
34
  css: errorMessageStyles
35
35
  }, jsx(FormattedMessage, loadingErrorMessages.unableToLoadResults)), jsx("p", {
36
36
  css: errorDescriptionStyles
37
- }, jsx(FormattedMessage, _extends({}, loadingErrorMessages.checkConnectionWithSource, {
37
+ }, url ? jsx(FormattedMessage, _extends({}, loadingErrorMessages.checkConnectionWithSource, {
38
38
  values: {
39
39
  a: chunk => jsx("a", {
40
40
  href: url
41
41
  }, chunk)
42
42
  }
43
- })))));
43
+ })) : jsx(FormattedMessage, loadingErrorMessages.checkConnection))));
44
44
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.27.3",
3
+ "version": "0.28.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,62 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import { useEffect, useState } from 'react';
5
+ import { fetchObjectSchemas, getWorkspaceId } from '../services/cmdbService';
6
+ // TODO: Pass in localhost:3000 for testing locally - remember to remove this code after
7
+ // You must also have a proxy server running to forward requests from http://localhost:3000 to a JSM premium url
8
+ export var useAssetsClient = function useAssetsClient(hostname) {
9
+ var _useState = useState(),
10
+ _useState2 = _slicedToArray(_useState, 2),
11
+ objectSchemas = _useState2[0],
12
+ setObjectSchemas = _useState2[1];
13
+ var _useState3 = useState(),
14
+ _useState4 = _slicedToArray(_useState3, 2),
15
+ workspaceId = _useState4[0],
16
+ setWorkspaceId = _useState4[1];
17
+ var _useState5 = useState(),
18
+ _useState6 = _slicedToArray(_useState5, 2),
19
+ error = _useState6[0],
20
+ setError = _useState6[1];
21
+ useEffect(function () {
22
+ _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
23
+ var _workspaceId, objectSchemasResponse;
24
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
25
+ while (1) switch (_context.prev = _context.next) {
26
+ case 0:
27
+ _context.prev = 0;
28
+ _context.next = 3;
29
+ return getWorkspaceId(hostname);
30
+ case 3:
31
+ _workspaceId = _context.sent;
32
+ _context.next = 6;
33
+ return fetchObjectSchemas(_workspaceId, hostname);
34
+ case 6:
35
+ objectSchemasResponse = _context.sent;
36
+ setWorkspaceId(_workspaceId);
37
+ setObjectSchemas(objectSchemasResponse.values);
38
+ _context.next = 14;
39
+ break;
40
+ case 11:
41
+ _context.prev = 11;
42
+ _context.t0 = _context["catch"](0);
43
+ if (_context.t0 instanceof Error) {
44
+ setError(_context.t0);
45
+ } else {
46
+ setError(new Error('Unexpected error occured'));
47
+ // eslint-disable-next-line no-console
48
+ console.error(_context.t0);
49
+ }
50
+ case 14:
51
+ case "end":
52
+ return _context.stop();
53
+ }
54
+ }, _callee, null, [[0, 11]]);
55
+ }))();
56
+ }, [hostname]);
57
+ return {
58
+ workspaceId: workspaceId,
59
+ objectSchemas: objectSchemas,
60
+ error: error
61
+ };
62
+ };
@@ -0,0 +1,40 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import { useCallback, useState } from 'react';
5
+ import { validateAql } from '../services/cmdbService';
6
+ export var useValidateAqlText = function useValidateAqlText(workspaceId, hostname) {
7
+ var _useState = useState(false),
8
+ _useState2 = _slicedToArray(_useState, 2),
9
+ isLoading = _useState2[0],
10
+ setIsLoading = _useState2[1];
11
+ var validateAqlText = useCallback( /*#__PURE__*/function () {
12
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(aql) {
13
+ var validateAqlResponse;
14
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
15
+ while (1) switch (_context.prev = _context.next) {
16
+ case 0:
17
+ setIsLoading(true);
18
+ _context.next = 3;
19
+ return validateAql(workspaceId, {
20
+ qlQuery: aql
21
+ }, hostname);
22
+ case 3:
23
+ validateAqlResponse = _context.sent;
24
+ setIsLoading(false);
25
+ return _context.abrupt("return", validateAqlResponse.isValid);
26
+ case 6:
27
+ case "end":
28
+ return _context.stop();
29
+ }
30
+ }, _callee);
31
+ }));
32
+ return function (_x) {
33
+ return _ref.apply(this, arguments);
34
+ };
35
+ }(), [hostname, workspaceId]);
36
+ return {
37
+ validateAqlText: validateAqlText,
38
+ isLoading: isLoading
39
+ };
40
+ };
package/dist/esm/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  export { default as JiraIssuesConfigModal } from './ui/jira-issues-modal';
2
2
  export { default as DatasourceTableView } from './ui/datasource-table-view';
3
- export { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from './ui/jira-issues-modal';
3
+ export { default as JSMAssetsConfigModal } from './ui/assets-modal';
4
+ export { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from './ui/jira-issues-modal';
5
+ export { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from './ui/assets-modal';
@@ -0,0 +1,43 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { request } from '@atlaskit/linking-common';
4
+ export var getWorkspaceId = /*#__PURE__*/function () {
5
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(hostname) {
6
+ var _workspaceDetailsResp;
7
+ var url, workspaceDetailsResponse;
8
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
9
+ while (1) switch (_context.prev = _context.next) {
10
+ case 0:
11
+ url = "".concat(hostname || '', "/rest/servicedesk/cmdb/latest/workspace");
12
+ _context.next = 3;
13
+ return request('get', url, undefined, undefined, [200, 201, 202, 203, 204]);
14
+ case 3:
15
+ workspaceDetailsResponse = _context.sent;
16
+ if ((_workspaceDetailsResp = workspaceDetailsResponse.results) !== null && _workspaceDetailsResp !== void 0 && _workspaceDetailsResp.length) {
17
+ _context.next = 6;
18
+ break;
19
+ }
20
+ throw new Error('No workspace results found');
21
+ case 6:
22
+ return _context.abrupt("return", workspaceDetailsResponse.results[0].id);
23
+ case 7:
24
+ case "end":
25
+ return _context.stop();
26
+ }
27
+ }, _callee);
28
+ }));
29
+ return function getWorkspaceId(_x) {
30
+ return _ref.apply(this, arguments);
31
+ };
32
+ }();
33
+ export var validateAql = function validateAql(workspaceId, data, hostname) {
34
+ var url = "".concat(hostname || '', "/gateway/api/jsm/assets/workspace/").concat(workspaceId, "/v1/aql/validate");
35
+ return request('post', url, {
36
+ qlQuery: data.qlQuery,
37
+ context: 'SMART_LINKS'
38
+ }, undefined, [200, 201, 202, 203, 204]);
39
+ };
40
+ export var fetchObjectSchemas = function fetchObjectSchemas(workspaceId, hostname) {
41
+ var url = "".concat(hostname || '', "/gateway/api/jsm/assets/workspace/").concat(workspaceId, "/v1/objectschema/list?maxResults=100");
42
+ return request('get', url, undefined, undefined, [200, 201, 202, 203, 204]);
43
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import React, { lazy, Suspense } from 'react';
2
+ export var ASSETS_LIST_OF_LINKS_DATASOURCE_ID = '361d618a-3c04-40ad-9b27-3c8ea6927020';
3
+ var LazyAssetsConfigModal = /*#__PURE__*/lazy(function () {
4
+ return import( /* webpackChunkName: "@atlaskit-internal_linkdatasource-assetsmodal" */'./modal').then(function (module) {
5
+ return {
6
+ default: module.AssetsConfigModal
7
+ };
8
+ });
9
+ });
10
+ var AssetsConfigModalWithWrappers = function AssetsConfigModalWithWrappers(props) {
11
+ return /*#__PURE__*/React.createElement(Suspense, {
12
+ fallback: /*#__PURE__*/React.createElement("div", {
13
+ "data-testid": 'assets-aql-datasource-table-suspense'
14
+ })
15
+ }, /*#__PURE__*/React.createElement(LazyAssetsConfigModal, props));
16
+ };
17
+ export default AssetsConfigModalWithWrappers;
@@ -0,0 +1,56 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ /** @jsx jsx */
3
+ import { useCallback, useMemo, useState } from 'react';
4
+ import { jsx } from '@emotion/react';
5
+ import { FormattedMessage } from 'react-intl-next';
6
+ import Button from '@atlaskit/button/standard-button';
7
+ import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
8
+ import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
9
+ import { modalMessages } from './messages';
10
+ import { RenderAssetsContent } from './render-assets-content';
11
+ import { ModalContentContainer } from './styled';
12
+ export var AssetsConfigModal = function AssetsConfigModal(props) {
13
+ var datasourceId = props.datasourceId,
14
+ initialParameters = props.parameters,
15
+ onCancel = props.onCancel;
16
+ var _useState = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.aql),
17
+ _useState2 = _slicedToArray(_useState, 1),
18
+ aql = _useState2[0];
19
+ var _useState3 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.schemaId),
20
+ _useState4 = _slicedToArray(_useState3, 1),
21
+ schemaId = _useState4[0];
22
+ var parameters = useMemo(function () {
23
+ return {
24
+ aql: aql || '',
25
+ schemaId: schemaId || '',
26
+ workspaceId: '' /* TODO FLY-1240: Add workspace Id */
27
+ };
28
+ }, [aql, schemaId]);
29
+ var _useDatasourceTableSt = useDatasourceTableState({
30
+ datasourceId: datasourceId,
31
+ parameters: parameters
32
+ }),
33
+ status = _useDatasourceTableSt.status,
34
+ responseItems = _useDatasourceTableSt.responseItems;
35
+ var isDisabled = status === 'rejected' || status === 'loading' || status === 'empty' || status === 'resolved' && !responseItems.length;
36
+ var onInsertPressed = useCallback(function () {
37
+ /* Placeholder for inserting of ADF, to do in FLY-1241 */
38
+ }, []);
39
+ return jsx(ModalTransition, null, jsx(Modal, {
40
+ testId: 'asset-datasource-modal',
41
+ onClose: onCancel,
42
+ width: "x-large",
43
+ shouldScrollInViewport: true
44
+ }, jsx(ModalHeader, null, jsx(ModalTitle, null)), jsx(ModalBody, null, jsx(ModalContentContainer, null, jsx(RenderAssetsContent, {
45
+ status: status,
46
+ responseItems: responseItems
47
+ }))), jsx(ModalFooter, null, jsx(Button, {
48
+ appearance: "default",
49
+ onClick: onCancel
50
+ }, jsx(FormattedMessage, modalMessages.cancelButtonText)), jsx(Button, {
51
+ appearance: "primary",
52
+ onClick: onInsertPressed,
53
+ isDisabled: isDisabled,
54
+ testId: 'asset-datasource-modal--insert-button'
55
+ }, jsx(FormattedMessage, modalMessages.insertIssuesButtonText)))));
56
+ };
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var modalMessages = defineMessages({
3
+ cancelButtonText: {
4
+ id: 'linkDataSource.assets.configmodal.cancelButtonText',
5
+ description: 'Button text to close the modal with no changes being made',
6
+ defaultMessage: 'Cancel'
7
+ },
8
+ insertIssuesButtonText: {
9
+ id: 'linkDataSource.assets.configmodal.insertIssuesButtonText',
10
+ description: 'Button text to insert the displayed content',
11
+ defaultMessage: 'Insert objects'
12
+ }
13
+ });
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { ModalLoadingError } from '../../../common/error-state/modal-loading-error';
3
+ import { NoResults } from '../../../common/error-state/no-results';
4
+ import { EmptyState } from '../../../issue-like-table';
5
+ export var RenderAssetsContent = function RenderAssetsContent(props) {
6
+ var status = props.status,
7
+ responseItems = props.responseItems;
8
+ var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
9
+ if (status === 'rejected') {
10
+ return /*#__PURE__*/React.createElement(ModalLoadingError, null);
11
+ } else if (resolvedWithNoResults) {
12
+ return /*#__PURE__*/React.createElement(NoResults, null);
13
+ } else if (status === 'empty') {
14
+ return /*#__PURE__*/React.createElement(EmptyState, {
15
+ testId: "assets-aql-datasource-modal--empty-state"
16
+ });
17
+ }
18
+ return /*#__PURE__*/React.createElement("p", null, "TODO add IssueLikeDataTableView component.");
19
+ };
@@ -0,0 +1,4 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import styled from '@emotion/styled';
4
+ export var ModalContentContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: 'grid';\n height: '420px';\n overflow: 'auto';\n"])));
@@ -0,0 +1 @@
1
+ export {};
@@ -33,7 +33,7 @@ export var ModalLoadingError = function ModalLoadingError(_ref) {
33
33
  css: errorMessageStyles
34
34
  }, jsx(FormattedMessage, loadingErrorMessages.unableToLoadResults)), jsx("p", {
35
35
  css: errorDescriptionStyles
36
- }, jsx(FormattedMessage, _extends({}, loadingErrorMessages.checkConnectionWithSource, {
36
+ }, url ? jsx(FormattedMessage, _extends({}, loadingErrorMessages.checkConnectionWithSource, {
37
37
  values: {
38
38
  a: function a(chunk) {
39
39
  return jsx("a", {
@@ -41,5 +41,5 @@ export var ModalLoadingError = function ModalLoadingError(_ref) {
41
41
  }, chunk);
42
42
  }
43
43
  }
44
- })))));
44
+ })) : jsx(FormattedMessage, loadingErrorMessages.checkConnection))));
45
45
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.27.3",
3
+ "version": "0.28.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,6 @@
1
+ import { ObjectSchema } from '../types/assets/types';
2
+ export declare const useAssetsClient: (hostname?: string) => {
3
+ workspaceId: string | undefined;
4
+ objectSchemas: ObjectSchema[] | undefined;
5
+ error: Error | undefined;
6
+ };
@@ -0,0 +1,4 @@
1
+ export declare const useValidateAqlText: (workspaceId: string, hostname?: string) => {
2
+ validateAqlText: (aql: string) => Promise<boolean>;
3
+ isLoading: boolean;
4
+ };
@@ -1,5 +1,8 @@
1
1
  export { default as JiraIssuesConfigModal } from './ui/jira-issues-modal';
2
2
  export { default as DatasourceTableView } from './ui/datasource-table-view';
3
+ export { default as JSMAssetsConfigModal } from './ui/assets-modal';
3
4
  export type { JiraIssuesDatasourceAdf, JiraIssueDatasourceParameters, } from './ui/jira-issues-modal/types';
5
+ export type { AssetsDatasourceAdf, AssetsDatasourceParameters, } from './ui/assets-modal/types';
4
6
  export { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from './ui/jira-issues-modal';
7
+ export { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from './ui/assets-modal';
5
8
  export type { DatasourceAdf, DatasourceAdfView, DatasourceAdfTableView, } from '@atlaskit/linking-common/types';
@@ -0,0 +1,6 @@
1
+ import { AqlValidateResponse, FetchObjectSchemasResponse } from '../types/assets/types';
2
+ export declare const getWorkspaceId: (hostname?: string) => Promise<string>;
3
+ export declare const validateAql: (workspaceId: string, data: {
4
+ qlQuery: string;
5
+ }, hostname?: string) => Promise<AqlValidateResponse>;
6
+ export declare const fetchObjectSchemas: (workspaceId: string, hostname?: string) => Promise<FetchObjectSchemasResponse>;
@@ -0,0 +1,23 @@
1
+ export interface GetWorkspaceDetailsResponse {
2
+ results: [
3
+ {
4
+ id: string;
5
+ }
6
+ ];
7
+ }
8
+ export interface ObjectSchema {
9
+ id?: string;
10
+ name?: string;
11
+ }
12
+ export interface FetchObjectSchemasResponse {
13
+ startAt: number;
14
+ maxResults: number;
15
+ total: number;
16
+ values: ObjectSchema[];
17
+ isLast: boolean;
18
+ }
19
+ export interface AqlValidateResponse {
20
+ isValid: boolean;
21
+ errorMessages: string[];
22
+ errors: {};
23
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { AssetsConfigModalProps } from './types';
3
+ export declare const ASSETS_LIST_OF_LINKS_DATASOURCE_ID = "361d618a-3c04-40ad-9b27-3c8ea6927020";
4
+ declare const AssetsConfigModalWithWrappers: (props: AssetsConfigModalProps) => JSX.Element;
5
+ export default AssetsConfigModalWithWrappers;
@@ -0,0 +1,3 @@
1
+ import { jsx } from '@emotion/react';
2
+ import { AssetsConfigModalProps } from '../types';
3
+ export declare const AssetsConfigModal: (props: AssetsConfigModalProps) => jsx.JSX.Element;
@@ -0,0 +1,12 @@
1
+ export declare const modalMessages: {
2
+ cancelButtonText: {
3
+ id: string;
4
+ description: string;
5
+ defaultMessage: string;
6
+ };
7
+ insertIssuesButtonText: {
8
+ id: string;
9
+ description: string;
10
+ defaultMessage: string;
11
+ };
12
+ };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { DatasourceDataResponseItem, DatasourceTableStatusType } from '@atlaskit/linking-types';
3
+ interface RenderAssetsContentProps {
4
+ status: DatasourceTableStatusType;
5
+ responseItems: DatasourceDataResponseItem[];
6
+ }
7
+ export declare const RenderAssetsContent: (props: RenderAssetsContentProps) => JSX.Element;
8
+ export {};
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const ModalContentContainer: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,23 @@
1
+ import { DatasourceAdf, DatasourceAdfView, InlineCardAdf } from '@atlaskit/linking-common/types';
2
+ export interface AssetsDatasourceParameters {
3
+ cloudId: string;
4
+ aql: string;
5
+ schemaId?: string;
6
+ }
7
+ export interface AssetsDatasourceAdf extends DatasourceAdf {
8
+ attrs: {
9
+ url?: string;
10
+ datasource: {
11
+ id: string;
12
+ parameters: AssetsDatasourceParameters;
13
+ views: DatasourceAdfView[];
14
+ };
15
+ };
16
+ }
17
+ export interface AssetsConfigModalProps {
18
+ datasourceId: string;
19
+ visibleColumnKeys?: string[];
20
+ parameters?: AssetsDatasourceParameters;
21
+ onCancel: () => void;
22
+ onInsert: (adf: InlineCardAdf | AssetsDatasourceAdf) => void;
23
+ }
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  interface ModalLoadingErrorProps {
4
- url: string;
4
+ url?: string;
5
5
  }
6
6
  export declare const ModalLoadingError: ({ url }: ModalLoadingErrorProps) => jsx.JSX.Element;
7
7
  export {};
@@ -0,0 +1,6 @@
1
+ import { ObjectSchema } from '../types/assets/types';
2
+ export declare const useAssetsClient: (hostname?: string) => {
3
+ workspaceId: string | undefined;
4
+ objectSchemas: ObjectSchema[] | undefined;
5
+ error: Error | undefined;
6
+ };
@@ -0,0 +1,4 @@
1
+ export declare const useValidateAqlText: (workspaceId: string, hostname?: string) => {
2
+ validateAqlText: (aql: string) => Promise<boolean>;
3
+ isLoading: boolean;
4
+ };
@@ -1,5 +1,8 @@
1
1
  export { default as JiraIssuesConfigModal } from './ui/jira-issues-modal';
2
2
  export { default as DatasourceTableView } from './ui/datasource-table-view';
3
+ export { default as JSMAssetsConfigModal } from './ui/assets-modal';
3
4
  export type { JiraIssuesDatasourceAdf, JiraIssueDatasourceParameters, } from './ui/jira-issues-modal/types';
5
+ export type { AssetsDatasourceAdf, AssetsDatasourceParameters, } from './ui/assets-modal/types';
4
6
  export { JIRA_LIST_OF_LINKS_DATASOURCE_ID } from './ui/jira-issues-modal';
7
+ export { ASSETS_LIST_OF_LINKS_DATASOURCE_ID } from './ui/assets-modal';
5
8
  export type { DatasourceAdf, DatasourceAdfView, DatasourceAdfTableView, } from '@atlaskit/linking-common/types';
@@ -0,0 +1,6 @@
1
+ import { AqlValidateResponse, FetchObjectSchemasResponse } from '../types/assets/types';
2
+ export declare const getWorkspaceId: (hostname?: string) => Promise<string>;
3
+ export declare const validateAql: (workspaceId: string, data: {
4
+ qlQuery: string;
5
+ }, hostname?: string) => Promise<AqlValidateResponse>;
6
+ export declare const fetchObjectSchemas: (workspaceId: string, hostname?: string) => Promise<FetchObjectSchemasResponse>;
@@ -0,0 +1,23 @@
1
+ export interface GetWorkspaceDetailsResponse {
2
+ results: [
3
+ {
4
+ id: string;
5
+ }
6
+ ];
7
+ }
8
+ export interface ObjectSchema {
9
+ id?: string;
10
+ name?: string;
11
+ }
12
+ export interface FetchObjectSchemasResponse {
13
+ startAt: number;
14
+ maxResults: number;
15
+ total: number;
16
+ values: ObjectSchema[];
17
+ isLast: boolean;
18
+ }
19
+ export interface AqlValidateResponse {
20
+ isValid: boolean;
21
+ errorMessages: string[];
22
+ errors: {};
23
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { AssetsConfigModalProps } from './types';
3
+ export declare const ASSETS_LIST_OF_LINKS_DATASOURCE_ID = "361d618a-3c04-40ad-9b27-3c8ea6927020";
4
+ declare const AssetsConfigModalWithWrappers: (props: AssetsConfigModalProps) => JSX.Element;
5
+ export default AssetsConfigModalWithWrappers;
@@ -0,0 +1,3 @@
1
+ import { jsx } from '@emotion/react';
2
+ import { AssetsConfigModalProps } from '../types';
3
+ export declare const AssetsConfigModal: (props: AssetsConfigModalProps) => jsx.JSX.Element;
@@ -0,0 +1,12 @@
1
+ export declare const modalMessages: {
2
+ cancelButtonText: {
3
+ id: string;
4
+ description: string;
5
+ defaultMessage: string;
6
+ };
7
+ insertIssuesButtonText: {
8
+ id: string;
9
+ description: string;
10
+ defaultMessage: string;
11
+ };
12
+ };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { DatasourceDataResponseItem, DatasourceTableStatusType } from '@atlaskit/linking-types';
3
+ interface RenderAssetsContentProps {
4
+ status: DatasourceTableStatusType;
5
+ responseItems: DatasourceDataResponseItem[];
6
+ }
7
+ export declare const RenderAssetsContent: (props: RenderAssetsContentProps) => JSX.Element;
8
+ export {};
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const ModalContentContainer: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,23 @@
1
+ import { DatasourceAdf, DatasourceAdfView, InlineCardAdf } from '@atlaskit/linking-common/types';
2
+ export interface AssetsDatasourceParameters {
3
+ cloudId: string;
4
+ aql: string;
5
+ schemaId?: string;
6
+ }
7
+ export interface AssetsDatasourceAdf extends DatasourceAdf {
8
+ attrs: {
9
+ url?: string;
10
+ datasource: {
11
+ id: string;
12
+ parameters: AssetsDatasourceParameters;
13
+ views: DatasourceAdfView[];
14
+ };
15
+ };
16
+ }
17
+ export interface AssetsConfigModalProps {
18
+ datasourceId: string;
19
+ visibleColumnKeys?: string[];
20
+ parameters?: AssetsDatasourceParameters;
21
+ onCancel: () => void;
22
+ onInsert: (adf: InlineCardAdf | AssetsDatasourceAdf) => void;
23
+ }
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
3
  interface ModalLoadingErrorProps {
4
- url: string;
4
+ url?: string;
5
5
  }
6
6
  export declare const ModalLoadingError: ({ url }: ModalLoadingErrorProps) => jsx.JSX.Element;
7
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.27.3",
3
+ "version": "0.28.0",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,7 +36,7 @@
36
36
  "@atlaskit/icon-object": "^6.3.0",
37
37
  "@atlaskit/image": "^1.1.0",
38
38
  "@atlaskit/link-client-extension": "^1.5.0",
39
- "@atlaskit/linking-common": "^3.2.0",
39
+ "@atlaskit/linking-common": "^3.3.0",
40
40
  "@atlaskit/linking-types": "^8.1.0",
41
41
  "@atlaskit/lozenge": "^11.4.0",
42
42
  "@atlaskit/modal-dialog": "^12.6.0",
@@ -64,6 +64,7 @@
64
64
  "react-intl-next": "npm:react-intl@^5.18.1"
65
65
  },
66
66
  "devDependencies": {
67
+ "@af/visual-regression": "*",
67
68
  "@atlaskit/link-provider": "^1.6.0",
68
69
  "@atlaskit/link-test-helpers": "^4.1.0",
69
70
  "@atlaskit/ssr": "*",