@atlaskit/link-client-extension 0.4.3 → 0.5.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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/link-client-extension
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5f0b51cb0e9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f0b51cb0e9) - Updated `useDatasourceClientExtension` hook to use `useSmartLinkContext` for creating smart-card client
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
3
13
  ## 0.4.3
4
14
 
5
15
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -3,6 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "mockDatasourceDataResponse", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _mocks.mockDatasourceDataResponse;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "mockDatasourceResponse", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _mocks.mockDatasourceResponse;
16
+ }
17
+ });
6
18
  Object.defineProperty(exports, "useDatasourceClientExtension", {
7
19
  enumerable: true,
8
20
  get: function get() {
@@ -16,4 +28,5 @@ Object.defineProperty(exports, "useSmartLinkClientExtension", {
16
28
  }
17
29
  });
18
30
  var _useSmartLinkClientExtension = require("./services/use-smart-link-client-extension");
19
- var _useDataSourceClientExtension = require("./services/use-data-source-client-extension");
31
+ var _useDataSourceClientExtension = require("./services/use-data-source-client-extension");
32
+ var _mocks = require("./services/use-data-source-client-extension/mocks");
@@ -5,10 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useDatasourceClientExtension = void 0;
7
7
  var _react = require("react");
8
+ var _linkProvider = require("@atlaskit/link-provider");
8
9
  var _linkingCommon = require("@atlaskit/linking-common");
9
10
  var _useResolverUrl = require("../use-resolver-url");
10
- var useDatasourceClientExtension = function useDatasourceClientExtension(cardClient) {
11
- var resolverUrl = (0, _useResolverUrl.useResolverUrl)(cardClient);
11
+ var useDatasourceClientExtension = function useDatasourceClientExtension() {
12
+ var _useSmartLinkContext = (0, _linkProvider.useSmartLinkContext)(),
13
+ client = _useSmartLinkContext.connections.client;
14
+ var resolverUrl = (0, _useResolverUrl.useResolverUrl)(client);
12
15
  var getDatasourceDetails = (0, _react.useCallback)(function (datasourceId, data) {
13
16
  return (0, _linkingCommon.request)('post', "".concat(resolverUrl, "/datasource/").concat(datasourceId, "/fetch/details"), data, undefined, [200, 201, 202, 203, 204]);
14
17
  }, [resolverUrl]);
@@ -12,7 +12,10 @@ var mockDatasourceDataResponse = {
12
12
  assigned: {
13
13
  displayName: 'Sasha'
14
14
  },
15
- state: 'IN PROGRESS'
15
+ status: {
16
+ text: 'In Progress',
17
+ status: 'inprogress'
18
+ }
16
19
  }, {
17
20
  id: 'EDM-14',
18
21
  description: 'Implement datasource feature',
@@ -20,7 +23,10 @@ var mockDatasourceDataResponse = {
20
23
  assigned: {
21
24
  displayName: 'Hana'
22
25
  },
23
- state: 'TO DO'
26
+ status: {
27
+ text: 'To Do',
28
+ status: 'new'
29
+ }
24
30
  }, {
25
31
  id: 'EDM-15',
26
32
  description: 'Add Jira Provider',
@@ -28,7 +34,10 @@ var mockDatasourceDataResponse = {
28
34
  assigned: {
29
35
  displayName: 'Princey'
30
36
  },
31
- state: 'TO DO'
37
+ status: {
38
+ text: 'To Do',
39
+ status: 'default'
40
+ }
32
41
  }, {
33
42
  id: 'EDM-16',
34
43
  description: 'Plan team party',
@@ -36,7 +45,10 @@ var mockDatasourceDataResponse = {
36
45
  assigned: {
37
46
  displayName: 'Nidhin'
38
47
  },
39
- state: 'TO DO'
48
+ status: {
49
+ text: 'Done',
50
+ status: 'success'
51
+ }
40
52
  }],
41
53
  nextPageCursor: 'c3RhcnRBdD01'
42
54
  };
@@ -58,26 +70,48 @@ var mockDatasourceResponse = {
58
70
  schema: {
59
71
  properties: [{
60
72
  key: 'id',
73
+ title: '',
61
74
  type: 'string',
62
- title: 'Id'
75
+ isIdentity: true
63
76
  }, {
64
- key: 'description',
65
- type: 'link',
66
- title: 'Description'
77
+ key: 'issue',
78
+ title: 'Key',
79
+ type: 'link'
67
80
  }, {
68
- key: 'createdAt',
69
- type: 'date',
70
- title: 'Created At'
81
+ key: 'type',
82
+ type: 'icon',
83
+ title: 'Type'
71
84
  }, {
72
- key: 'assigned',
73
- type: 'user',
74
- title: 'Assignee'
85
+ key: 'summary',
86
+ title: 'Summary',
87
+ type: 'link'
75
88
  }, {
76
- key: 'state',
77
- type: 'status',
78
- title: 'Status'
89
+ key: 'assignee',
90
+ title: 'Assignee',
91
+ type: 'user'
92
+ }, {
93
+ key: 'priority',
94
+ title: 'P',
95
+ type: 'icon'
96
+ }, {
97
+ key: 'labels',
98
+ title: 'Labels',
99
+ type: 'tag',
100
+ isList: true
101
+ }, {
102
+ key: 'status',
103
+ title: 'Status',
104
+ type: 'status'
105
+ }, {
106
+ key: 'created',
107
+ title: 'Created',
108
+ type: 'string'
109
+ }, {
110
+ key: 'due',
111
+ title: 'Due Date',
112
+ type: 'string'
79
113
  }],
80
- defaultProperties: ['id', 'description', 'assigned', 'state']
114
+ defaultProperties: ['type', 'issue', 'summary', 'assignee', 'priority', 'labels', 'status', 'created']
81
115
  }
82
116
  };
83
117
  exports.mockDatasourceResponse = mockDatasourceResponse;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-client-extension",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,2 +1,3 @@
1
1
  export { useSmartLinkClientExtension } from './services/use-smart-link-client-extension';
2
- export { useDatasourceClientExtension } from './services/use-data-source-client-extension';
2
+ export { useDatasourceClientExtension } from './services/use-data-source-client-extension';
3
+ export { mockDatasourceResponse, mockDatasourceDataResponse } from './services/use-data-source-client-extension/mocks';
@@ -1,8 +1,14 @@
1
1
  import { useCallback, useMemo } from 'react';
2
+ import { useSmartLinkContext } from '@atlaskit/link-provider';
2
3
  import { request } from '@atlaskit/linking-common';
3
4
  import { useResolverUrl } from '../use-resolver-url';
4
- export const useDatasourceClientExtension = cardClient => {
5
- const resolverUrl = useResolverUrl(cardClient);
5
+ export const useDatasourceClientExtension = () => {
6
+ const {
7
+ connections: {
8
+ client
9
+ }
10
+ } = useSmartLinkContext();
11
+ const resolverUrl = useResolverUrl(client);
6
12
  const getDatasourceDetails = useCallback((datasourceId, data) => request('post', `${resolverUrl}/datasource/${datasourceId}/fetch/details`, data, undefined, [200, 201, 202, 203, 204]), [resolverUrl]);
7
13
  const getDatasourceData = useCallback((datasourceId, data) => request('post', `${resolverUrl}/datasource/${datasourceId}/fetch/data`, data, undefined, [200, 201, 202, 203, 204]), [resolverUrl]);
8
14
  return useMemo(() => ({
@@ -6,7 +6,10 @@ export const mockDatasourceDataResponse = {
6
6
  assigned: {
7
7
  displayName: 'Sasha'
8
8
  },
9
- state: 'IN PROGRESS'
9
+ status: {
10
+ text: 'In Progress',
11
+ status: 'inprogress'
12
+ }
10
13
  }, {
11
14
  id: 'EDM-14',
12
15
  description: 'Implement datasource feature',
@@ -14,7 +17,10 @@ export const mockDatasourceDataResponse = {
14
17
  assigned: {
15
18
  displayName: 'Hana'
16
19
  },
17
- state: 'TO DO'
20
+ status: {
21
+ text: 'To Do',
22
+ status: 'new'
23
+ }
18
24
  }, {
19
25
  id: 'EDM-15',
20
26
  description: 'Add Jira Provider',
@@ -22,7 +28,10 @@ export const mockDatasourceDataResponse = {
22
28
  assigned: {
23
29
  displayName: 'Princey'
24
30
  },
25
- state: 'TO DO'
31
+ status: {
32
+ text: 'To Do',
33
+ status: 'default'
34
+ }
26
35
  }, {
27
36
  id: 'EDM-16',
28
37
  description: 'Plan team party',
@@ -30,7 +39,10 @@ export const mockDatasourceDataResponse = {
30
39
  assigned: {
31
40
  displayName: 'Nidhin'
32
41
  },
33
- state: 'TO DO'
42
+ status: {
43
+ text: 'Done',
44
+ status: 'success'
45
+ }
34
46
  }],
35
47
  nextPageCursor: 'c3RhcnRBdD01'
36
48
  };
@@ -51,25 +63,47 @@ export const mockDatasourceResponse = {
51
63
  schema: {
52
64
  properties: [{
53
65
  key: 'id',
66
+ title: '',
54
67
  type: 'string',
55
- title: 'Id'
68
+ isIdentity: true
56
69
  }, {
57
- key: 'description',
58
- type: 'link',
59
- title: 'Description'
70
+ key: 'issue',
71
+ title: 'Key',
72
+ type: 'link'
60
73
  }, {
61
- key: 'createdAt',
62
- type: 'date',
63
- title: 'Created At'
74
+ key: 'type',
75
+ type: 'icon',
76
+ title: 'Type'
64
77
  }, {
65
- key: 'assigned',
66
- type: 'user',
67
- title: 'Assignee'
78
+ key: 'summary',
79
+ title: 'Summary',
80
+ type: 'link'
68
81
  }, {
69
- key: 'state',
70
- type: 'status',
71
- title: 'Status'
82
+ key: 'assignee',
83
+ title: 'Assignee',
84
+ type: 'user'
85
+ }, {
86
+ key: 'priority',
87
+ title: 'P',
88
+ type: 'icon'
89
+ }, {
90
+ key: 'labels',
91
+ title: 'Labels',
92
+ type: 'tag',
93
+ isList: true
94
+ }, {
95
+ key: 'status',
96
+ title: 'Status',
97
+ type: 'status'
98
+ }, {
99
+ key: 'created',
100
+ title: 'Created',
101
+ type: 'string'
102
+ }, {
103
+ key: 'due',
104
+ title: 'Due Date',
105
+ type: 'string'
72
106
  }],
73
- defaultProperties: ['id', 'description', 'assigned', 'state']
107
+ defaultProperties: ['type', 'issue', 'summary', 'assignee', 'priority', 'labels', 'status', 'created']
74
108
  }
75
109
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-client-extension",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "sideEffects": false
5
5
  }
package/dist/esm/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { useSmartLinkClientExtension } from './services/use-smart-link-client-extension';
2
- export { useDatasourceClientExtension } from './services/use-data-source-client-extension';
2
+ export { useDatasourceClientExtension } from './services/use-data-source-client-extension';
3
+ export { mockDatasourceResponse, mockDatasourceDataResponse } from './services/use-data-source-client-extension/mocks';
@@ -1,8 +1,11 @@
1
1
  import { useCallback, useMemo } from 'react';
2
+ import { useSmartLinkContext } from '@atlaskit/link-provider';
2
3
  import { request } from '@atlaskit/linking-common';
3
4
  import { useResolverUrl } from '../use-resolver-url';
4
- export var useDatasourceClientExtension = function useDatasourceClientExtension(cardClient) {
5
- var resolverUrl = useResolverUrl(cardClient);
5
+ export var useDatasourceClientExtension = function useDatasourceClientExtension() {
6
+ var _useSmartLinkContext = useSmartLinkContext(),
7
+ client = _useSmartLinkContext.connections.client;
8
+ var resolverUrl = useResolverUrl(client);
6
9
  var getDatasourceDetails = useCallback(function (datasourceId, data) {
7
10
  return request('post', "".concat(resolverUrl, "/datasource/").concat(datasourceId, "/fetch/details"), data, undefined, [200, 201, 202, 203, 204]);
8
11
  }, [resolverUrl]);
@@ -6,7 +6,10 @@ export var mockDatasourceDataResponse = {
6
6
  assigned: {
7
7
  displayName: 'Sasha'
8
8
  },
9
- state: 'IN PROGRESS'
9
+ status: {
10
+ text: 'In Progress',
11
+ status: 'inprogress'
12
+ }
10
13
  }, {
11
14
  id: 'EDM-14',
12
15
  description: 'Implement datasource feature',
@@ -14,7 +17,10 @@ export var mockDatasourceDataResponse = {
14
17
  assigned: {
15
18
  displayName: 'Hana'
16
19
  },
17
- state: 'TO DO'
20
+ status: {
21
+ text: 'To Do',
22
+ status: 'new'
23
+ }
18
24
  }, {
19
25
  id: 'EDM-15',
20
26
  description: 'Add Jira Provider',
@@ -22,7 +28,10 @@ export var mockDatasourceDataResponse = {
22
28
  assigned: {
23
29
  displayName: 'Princey'
24
30
  },
25
- state: 'TO DO'
31
+ status: {
32
+ text: 'To Do',
33
+ status: 'default'
34
+ }
26
35
  }, {
27
36
  id: 'EDM-16',
28
37
  description: 'Plan team party',
@@ -30,7 +39,10 @@ export var mockDatasourceDataResponse = {
30
39
  assigned: {
31
40
  displayName: 'Nidhin'
32
41
  },
33
- state: 'TO DO'
42
+ status: {
43
+ text: 'Done',
44
+ status: 'success'
45
+ }
34
46
  }],
35
47
  nextPageCursor: 'c3RhcnRBdD01'
36
48
  };
@@ -51,25 +63,47 @@ export var mockDatasourceResponse = {
51
63
  schema: {
52
64
  properties: [{
53
65
  key: 'id',
66
+ title: '',
54
67
  type: 'string',
55
- title: 'Id'
68
+ isIdentity: true
56
69
  }, {
57
- key: 'description',
58
- type: 'link',
59
- title: 'Description'
70
+ key: 'issue',
71
+ title: 'Key',
72
+ type: 'link'
60
73
  }, {
61
- key: 'createdAt',
62
- type: 'date',
63
- title: 'Created At'
74
+ key: 'type',
75
+ type: 'icon',
76
+ title: 'Type'
64
77
  }, {
65
- key: 'assigned',
66
- type: 'user',
67
- title: 'Assignee'
78
+ key: 'summary',
79
+ title: 'Summary',
80
+ type: 'link'
68
81
  }, {
69
- key: 'state',
70
- type: 'status',
71
- title: 'Status'
82
+ key: 'assignee',
83
+ title: 'Assignee',
84
+ type: 'user'
85
+ }, {
86
+ key: 'priority',
87
+ title: 'P',
88
+ type: 'icon'
89
+ }, {
90
+ key: 'labels',
91
+ title: 'Labels',
92
+ type: 'tag',
93
+ isList: true
94
+ }, {
95
+ key: 'status',
96
+ title: 'Status',
97
+ type: 'status'
98
+ }, {
99
+ key: 'created',
100
+ title: 'Created',
101
+ type: 'string'
102
+ }, {
103
+ key: 'due',
104
+ title: 'Due Date',
105
+ type: 'string'
72
106
  }],
73
- defaultProperties: ['id', 'description', 'assigned', 'state']
107
+ defaultProperties: ['type', 'issue', 'summary', 'assignee', 'priority', 'labels', 'status', 'created']
74
108
  }
75
109
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-client-extension",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,2 +1,3 @@
1
1
  export { useSmartLinkClientExtension } from './services/use-smart-link-client-extension';
2
2
  export { useDatasourceClientExtension } from './services/use-data-source-client-extension';
3
+ export { mockDatasourceResponse, mockDatasourceDataResponse, } from './services/use-data-source-client-extension/mocks';
@@ -1,6 +1,5 @@
1
- import type { CardClient } from '@atlaskit/link-provider';
2
1
  import type { DatasourceDataRequest, DatasourceDataResponse, DatasourceParameters, DatasourceResponse } from '@atlaskit/linking-types';
3
- export declare const useDatasourceClientExtension: (cardClient: CardClient) => {
2
+ export declare const useDatasourceClientExtension: () => {
4
3
  getDatasourceDetails: (datasourceId: string, data: DatasourceParameters) => Promise<DatasourceResponse>;
5
4
  getDatasourceData: (datasourceId: string, data: DatasourceDataRequest) => Promise<DatasourceDataResponse>;
6
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-client-extension",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "Extension methods for linking platform client",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@atlaskit/linking-common": "^2.6.0",
30
- "@atlaskit/linking-types": "^1.2.0",
30
+ "@atlaskit/linking-types": "^1.3.0",
31
31
  "@babel/runtime": "^7.0.0"
32
32
  },
33
33
  "peerDependencies": {
package/report.api.md CHANGED
@@ -24,7 +24,13 @@ import { InvokeRequest } from '@atlaskit/linking-types/smart-link-actions';
24
24
  import { InvokeResponse } from '@atlaskit/linking-types/smart-link-actions';
25
25
 
26
26
  // @public (undocumented)
27
- export const useDatasourceClientExtension: (cardClient: CardClient) => {
27
+ export const mockDatasourceDataResponse: DatasourceDataResponse;
28
+
29
+ // @public (undocumented)
30
+ export const mockDatasourceResponse: DatasourceResponse;
31
+
32
+ // @public (undocumented)
33
+ export const useDatasourceClientExtension: () => {
28
34
  getDatasourceDetails: (
29
35
  datasourceId: string,
30
36
  data: DatasourceParameters,
@@ -13,7 +13,13 @@ import { InvokeRequest } from '@atlaskit/linking-types/smart-link-actions';
13
13
  import { InvokeResponse } from '@atlaskit/linking-types/smart-link-actions';
14
14
 
15
15
  // @public (undocumented)
16
- export const useDatasourceClientExtension: (cardClient: CardClient) => {
16
+ export const mockDatasourceDataResponse: DatasourceDataResponse;
17
+
18
+ // @public (undocumented)
19
+ export const mockDatasourceResponse: DatasourceResponse;
20
+
21
+ // @public (undocumented)
22
+ export const useDatasourceClientExtension: () => {
17
23
  getDatasourceDetails: (datasourceId: string, data: DatasourceParameters) => Promise<DatasourceResponse>;
18
24
  getDatasourceData: (datasourceId: string, data: DatasourceDataRequest) => Promise<DatasourceDataResponse>;
19
25
  };