@atlaskit/link-datasource 3.6.13 → 3.6.15

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,20 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 3.6.15
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.6.14
10
+
11
+ ### Patch Changes
12
+
13
+ - [#157343](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/157343)
14
+ [`64cef773c3dcf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/64cef773c3dcf) -
15
+ Internal refactor to support fetchActions behind new ff: `enable_datasource_supporting_actions`
16
+ - Updated dependencies
17
+
3
18
  ## 3.6.13
4
19
 
5
20
  ### Patch Changes
@@ -12,6 +12,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
12
12
  var _react = require("react");
13
13
  var _reactSweetState = require("react-sweet-state");
14
14
  var _linkClientExtension = require("@atlaskit/link-client-extension");
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
16
  var _analytics = require("../../analytics");
16
17
  var _useErrorLogger2 = _interopRequireDefault(require("../../hooks/useErrorLogger"));
17
18
  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; }
@@ -20,15 +21,27 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
20
21
  * Atomic actions available for an integration (by field)
21
22
  * @example
22
23
  * ```ts
23
- * {
24
- * jira: {
25
- * summary: {
26
- * actionKey: 'atlassian:work-item:update:summary',
27
- * type: 'string',
28
- * description: 'Update issue summary',
29
- * }
30
- * }
31
- * }
24
+ * {
25
+ * jira: {
26
+ * summary: {
27
+ * actionKey: 'atlassian:work-item:update:summary',
28
+ * type: 'string'
29
+ * },
30
+ * status: {
31
+ * actionKey: 'atlassian:work-item:update:status',
32
+ * type: 'string',
33
+ * fetchAction: {
34
+ * actionKey: 'atlassian:work-item:get:statuses',
35
+ * type: 'string',
36
+ * inputs: {
37
+ * issueId: {
38
+ * type: 'string'
39
+ * }
40
+ * }
41
+ * }
42
+ * }
43
+ * }
44
+ * }
32
45
  * ```
33
46
  */
34
47
 
@@ -73,10 +86,19 @@ var actions = exports.actions = {
73
86
  if ('permissions' in response) {
74
87
  _getState = getState(), currentActions = _getState.actionsByIntegration, currentPermissions = _getState.permissions;
75
88
  actionsByIntegration = response.actions.reduce(function (acc, action) {
76
- return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, action.integrationKey, _objectSpread(_objectSpread({}, acc[action.integrationKey]), {}, (0, _defineProperty2.default)({}, action.fieldKey, {
89
+ var _action$inputs;
90
+ var fieldKey = action.fieldKey;
91
+ var fetchAction = (_action$inputs = action.inputs) === null || _action$inputs === void 0 || (_action$inputs = _action$inputs[fieldKey]) === null || _action$inputs === void 0 ? void 0 : _action$inputs.fetchAction;
92
+ return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, action.integrationKey, _objectSpread(_objectSpread({}, acc[action.integrationKey]), {}, (0, _defineProperty2.default)({}, fieldKey, _objectSpread({
77
93
  actionKey: action.actionKey,
78
94
  type: action.type
79
- }))));
95
+ }, fetchAction && (0, _platformFeatureFlags.fg)('enable_datasource_supporting_actions') && {
96
+ fetchAction: {
97
+ actionKey: fetchAction.actionKey,
98
+ type: fetchAction.type,
99
+ inputs: fetchAction.inputs
100
+ }
101
+ })))));
80
102
  }, currentActions);
81
103
  permissions = response.permissions.data.reduce(function (acc, permission) {
82
104
  return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, permission.ari, _objectSpread(_objectSpread({}, acc[permission.ari]), {}, (0, _defineProperty2.default)({}, permission.fieldKey, {
@@ -1,6 +1,7 @@
1
1
  import { useCallback, useMemo } from 'react';
2
2
  import { createActionsHook, createHook, createStore } from 'react-sweet-state';
3
3
  import { useDatasourceClientExtension } from '@atlaskit/link-client-extension';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { useDatasourceAnalyticsEvents } from '../../analytics';
5
6
  import useErrorLogger from '../../hooks/useErrorLogger';
6
7
 
@@ -8,15 +9,27 @@ import useErrorLogger from '../../hooks/useErrorLogger';
8
9
  * Atomic actions available for an integration (by field)
9
10
  * @example
10
11
  * ```ts
11
- * {
12
- * jira: {
13
- * summary: {
14
- * actionKey: 'atlassian:work-item:update:summary',
15
- * type: 'string',
16
- * description: 'Update issue summary',
17
- * }
18
- * }
19
- * }
12
+ * {
13
+ * jira: {
14
+ * summary: {
15
+ * actionKey: 'atlassian:work-item:update:summary',
16
+ * type: 'string'
17
+ * },
18
+ * status: {
19
+ * actionKey: 'atlassian:work-item:update:status',
20
+ * type: 'string',
21
+ * fetchAction: {
22
+ * actionKey: 'atlassian:work-item:get:statuses',
23
+ * type: 'string',
24
+ * inputs: {
25
+ * issueId: {
26
+ * type: 'string'
27
+ * }
28
+ * }
29
+ * }
30
+ * }
31
+ * }
32
+ * }
20
33
  * ```
21
34
  */
22
35
 
@@ -54,16 +67,28 @@ export const actions = {
54
67
  actionsByIntegration: currentActions,
55
68
  permissions: currentPermissions
56
69
  } = getState();
57
- const actionsByIntegration = response.actions.reduce((acc, action) => ({
58
- ...acc,
59
- [action.integrationKey]: {
60
- ...acc[action.integrationKey],
61
- [action.fieldKey]: {
62
- actionKey: action.actionKey,
63
- type: action.type
70
+ const actionsByIntegration = response.actions.reduce((acc, action) => {
71
+ var _action$inputs, _action$inputs$fieldK;
72
+ const fieldKey = action.fieldKey;
73
+ const fetchAction = (_action$inputs = action.inputs) === null || _action$inputs === void 0 ? void 0 : (_action$inputs$fieldK = _action$inputs[fieldKey]) === null || _action$inputs$fieldK === void 0 ? void 0 : _action$inputs$fieldK.fetchAction;
74
+ return {
75
+ ...acc,
76
+ [action.integrationKey]: {
77
+ ...acc[action.integrationKey],
78
+ [fieldKey]: {
79
+ actionKey: action.actionKey,
80
+ type: action.type,
81
+ ...(fetchAction && fg('enable_datasource_supporting_actions') && {
82
+ fetchAction: {
83
+ actionKey: fetchAction.actionKey,
84
+ type: fetchAction.type,
85
+ inputs: fetchAction.inputs
86
+ }
87
+ })
88
+ }
64
89
  }
65
- }
66
- }), currentActions);
90
+ };
91
+ }, currentActions);
67
92
  const permissions = response.permissions.data.reduce((acc, permission) => ({
68
93
  ...acc,
69
94
  [permission.ari]: {
@@ -7,6 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { useCallback, useMemo } from 'react';
8
8
  import { createActionsHook, createHook, createStore } from 'react-sweet-state';
9
9
  import { useDatasourceClientExtension } from '@atlaskit/link-client-extension';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import { useDatasourceAnalyticsEvents } from '../../analytics';
11
12
  import useErrorLogger from '../../hooks/useErrorLogger';
12
13
 
@@ -14,15 +15,27 @@ import useErrorLogger from '../../hooks/useErrorLogger';
14
15
  * Atomic actions available for an integration (by field)
15
16
  * @example
16
17
  * ```ts
17
- * {
18
- * jira: {
19
- * summary: {
20
- * actionKey: 'atlassian:work-item:update:summary',
21
- * type: 'string',
22
- * description: 'Update issue summary',
23
- * }
24
- * }
25
- * }
18
+ * {
19
+ * jira: {
20
+ * summary: {
21
+ * actionKey: 'atlassian:work-item:update:summary',
22
+ * type: 'string'
23
+ * },
24
+ * status: {
25
+ * actionKey: 'atlassian:work-item:update:status',
26
+ * type: 'string',
27
+ * fetchAction: {
28
+ * actionKey: 'atlassian:work-item:get:statuses',
29
+ * type: 'string',
30
+ * inputs: {
31
+ * issueId: {
32
+ * type: 'string'
33
+ * }
34
+ * }
35
+ * }
36
+ * }
37
+ * }
38
+ * }
26
39
  * ```
27
40
  */
28
41
 
@@ -67,10 +80,19 @@ export var actions = {
67
80
  if ('permissions' in response) {
68
81
  _getState = getState(), currentActions = _getState.actionsByIntegration, currentPermissions = _getState.permissions;
69
82
  actionsByIntegration = response.actions.reduce(function (acc, action) {
70
- return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, action.integrationKey, _objectSpread(_objectSpread({}, acc[action.integrationKey]), {}, _defineProperty({}, action.fieldKey, {
83
+ var _action$inputs;
84
+ var fieldKey = action.fieldKey;
85
+ var fetchAction = (_action$inputs = action.inputs) === null || _action$inputs === void 0 || (_action$inputs = _action$inputs[fieldKey]) === null || _action$inputs === void 0 ? void 0 : _action$inputs.fetchAction;
86
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, action.integrationKey, _objectSpread(_objectSpread({}, acc[action.integrationKey]), {}, _defineProperty({}, fieldKey, _objectSpread({
71
87
  actionKey: action.actionKey,
72
88
  type: action.type
73
- }))));
89
+ }, fetchAction && fg('enable_datasource_supporting_actions') && {
90
+ fetchAction: {
91
+ actionKey: fetchAction.actionKey,
92
+ type: fetchAction.type,
93
+ inputs: fetchAction.inputs
94
+ }
95
+ })))));
74
96
  }, currentActions);
75
97
  permissions = response.permissions.data.reduce(function (acc, permission) {
76
98
  return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, permission.ari, _objectSpread(_objectSpread({}, acc[permission.ari]), {}, _defineProperty({}, permission.fieldKey, {
@@ -9,18 +9,32 @@ type FieldKey = string;
9
9
  * Atomic actions available for an integration (by field)
10
10
  * @example
11
11
  * ```ts
12
- * {
13
- * jira: {
14
- * summary: {
15
- * actionKey: 'atlassian:work-item:update:summary',
16
- * type: 'string',
17
- * description: 'Update issue summary',
18
- * }
19
- * }
20
- * }
12
+ * {
13
+ * jira: {
14
+ * summary: {
15
+ * actionKey: 'atlassian:work-item:update:summary',
16
+ * type: 'string'
17
+ * },
18
+ * status: {
19
+ * actionKey: 'atlassian:work-item:update:status',
20
+ * type: 'string',
21
+ * fetchAction: {
22
+ * actionKey: 'atlassian:work-item:get:statuses',
23
+ * type: 'string',
24
+ * inputs: {
25
+ * issueId: {
26
+ * type: 'string'
27
+ * }
28
+ * }
29
+ * }
30
+ * }
31
+ * }
32
+ * }
21
33
  * ```
22
34
  */
23
- type IntegrationActions = Record<IntegrationKey, Record<FieldKey, Pick<AtomicActionInterface, 'actionKey' | 'type' | 'description'>>>;
35
+ type IntegrationActions = Record<IntegrationKey, Record<FieldKey, Pick<AtomicActionInterface, 'actionKey' | 'type' | 'description'> & {
36
+ fetchAction?: Pick<AtomicActionInterface, 'actionKey' | 'type' | 'inputs'>;
37
+ }>>;
24
38
  /**
25
39
  * Permissions available for a target
26
40
  */
@@ -67,7 +81,9 @@ export declare const useDiscoverActions: ({ captureError, fireEvent }: UseDiscov
67
81
  /**
68
82
  * Retrieves the action schema for a given ARI + fieldKey + integrationKey
69
83
  */
70
- export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<Pick<AtomicActionInterface, "actionKey" | "type" | "description"> | undefined, import("react-sweet-state").BoundActions<ActionsStoreState, {
84
+ export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<(Pick<AtomicActionInterface, "actionKey" | "type" | "description"> & {
85
+ fetchAction?: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
86
+ }) | undefined, import("react-sweet-state").BoundActions<ActionsStoreState, {
71
87
  discoverActions: (captureError: AnalyticsCaptureError, fireEvent: AnalyticsFireEvent, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
72
88
  }>, {
73
89
  ari: string;
@@ -9,18 +9,32 @@ type FieldKey = string;
9
9
  * Atomic actions available for an integration (by field)
10
10
  * @example
11
11
  * ```ts
12
- * {
13
- * jira: {
14
- * summary: {
15
- * actionKey: 'atlassian:work-item:update:summary',
16
- * type: 'string',
17
- * description: 'Update issue summary',
18
- * }
19
- * }
20
- * }
12
+ * {
13
+ * jira: {
14
+ * summary: {
15
+ * actionKey: 'atlassian:work-item:update:summary',
16
+ * type: 'string'
17
+ * },
18
+ * status: {
19
+ * actionKey: 'atlassian:work-item:update:status',
20
+ * type: 'string',
21
+ * fetchAction: {
22
+ * actionKey: 'atlassian:work-item:get:statuses',
23
+ * type: 'string',
24
+ * inputs: {
25
+ * issueId: {
26
+ * type: 'string'
27
+ * }
28
+ * }
29
+ * }
30
+ * }
31
+ * }
32
+ * }
21
33
  * ```
22
34
  */
23
- type IntegrationActions = Record<IntegrationKey, Record<FieldKey, Pick<AtomicActionInterface, 'actionKey' | 'type' | 'description'>>>;
35
+ type IntegrationActions = Record<IntegrationKey, Record<FieldKey, Pick<AtomicActionInterface, 'actionKey' | 'type' | 'description'> & {
36
+ fetchAction?: Pick<AtomicActionInterface, 'actionKey' | 'type' | 'inputs'>;
37
+ }>>;
24
38
  /**
25
39
  * Permissions available for a target
26
40
  */
@@ -67,7 +81,9 @@ export declare const useDiscoverActions: ({ captureError, fireEvent }: UseDiscov
67
81
  /**
68
82
  * Retrieves the action schema for a given ARI + fieldKey + integrationKey
69
83
  */
70
- export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<Pick<AtomicActionInterface, "actionKey" | "type" | "description"> | undefined, import("react-sweet-state").BoundActions<ActionsStoreState, {
84
+ export declare const useAtomicUpdateActionSchema: import("react-sweet-state").HookFunction<(Pick<AtomicActionInterface, "actionKey" | "type" | "description"> & {
85
+ fetchAction?: Pick<AtomicActionInterface, "actionKey" | "type" | "inputs"> | undefined;
86
+ }) | undefined, import("react-sweet-state").BoundActions<ActionsStoreState, {
71
87
  discoverActions: (captureError: AnalyticsCaptureError, fireEvent: AnalyticsFireEvent, api: Client, request: ActionsDiscoveryRequest) => Action<ActionsStoreState>;
72
88
  }>, {
73
89
  ari: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "3.6.13",
3
+ "version": "3.6.15",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/badge": "^16.4.0",
43
43
  "@atlaskit/button": "^20.3.0",
44
44
  "@atlaskit/datetime-picker": "^15.5.0",
45
- "@atlaskit/dropdown-menu": "^12.21.0",
45
+ "@atlaskit/dropdown-menu": "^12.22.0",
46
46
  "@atlaskit/editor-prosemirror": "6.0.0",
47
47
  "@atlaskit/empty-state": "^7.12.0",
48
48
  "@atlaskit/flag": "^15.8.0",
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/layering": "^0.7.0",
60
60
  "@atlaskit/link-client-extension": "^2.4.0",
61
61
  "@atlaskit/linking-common": "^6.0.0",
62
- "@atlaskit/linking-types": "^9.2.0",
62
+ "@atlaskit/linking-types": "^9.3.0",
63
63
  "@atlaskit/logo": "^14.3.0",
64
64
  "@atlaskit/lozenge": "^11.12.0",
65
65
  "@atlaskit/modal-dialog": "^12.17.0",
@@ -70,8 +70,8 @@
70
70
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
71
71
  "@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^1.2.0",
72
72
  "@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
73
- "@atlaskit/primitives": "^12.2.0",
74
- "@atlaskit/select": "^18.3.0",
73
+ "@atlaskit/primitives": "^13.0.0",
74
+ "@atlaskit/select": "^18.4.0",
75
75
  "@atlaskit/smart-card": "^30.1.0",
76
76
  "@atlaskit/smart-user-picker": "6.11.1",
77
77
  "@atlaskit/spinner": "^16.3.0",
@@ -161,6 +161,9 @@
161
161
  "platform-datasources-enable-two-way-sync": {
162
162
  "type": "boolean"
163
163
  },
164
+ "enable_datasource_supporting_actions": {
165
+ "type": "boolean"
166
+ },
164
167
  "platform.linking-platform.datasource-assets_add_version_parameter": {
165
168
  "type": "boolean"
166
169
  },