@atlaskit/link-client-extension 6.1.0 → 6.1.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/entry-points/data-source-client-extension-mocks.js +11 -6
  3. package/dist/cjs/index.js +11 -6
  4. package/dist/cjs/services/use-data-source-client-extension/index.js +28 -28
  5. package/dist/cjs/services/use-data-source-client-extension/mockActionsDiscoveryEmptyResponse.js +12 -0
  6. package/dist/cjs/services/use-data-source-client-extension/mockActionsDiscoveryResponse.js +76 -0
  7. package/dist/cjs/services/use-data-source-client-extension/mockDatasourceDataNoActionsResponse.js +125 -0
  8. package/dist/cjs/services/use-data-source-client-extension/mockDatasourceDataResponse.js +126 -0
  9. package/dist/cjs/services/use-data-source-client-extension/mockDatasourceDetailsResponse.js +79 -0
  10. package/dist/cjs/services/use-data-source-client-extension/mockExecuteActionResponse.js +11 -0
  11. package/dist/cjs/services/use-data-source-client-extension/mockExecuteActionResponseFailure.js +14 -0
  12. package/dist/cjs/services/use-data-source-client-extension/mocks.js +7 -405
  13. package/dist/cjs/services/use-smart-link-client-extension/index.js +17 -17
  14. package/dist/es2019/entry-points/data-source-client-extension-mocks.js +6 -1
  15. package/dist/es2019/index.js +6 -1
  16. package/dist/es2019/services/use-data-source-client-extension/mockActionsDiscoveryEmptyResponse.js +6 -0
  17. package/dist/es2019/services/use-data-source-client-extension/mockActionsDiscoveryResponse.js +70 -0
  18. package/dist/es2019/services/use-data-source-client-extension/mockDatasourceDataNoActionsResponse.js +119 -0
  19. package/dist/es2019/services/use-data-source-client-extension/mockDatasourceDataResponse.js +120 -0
  20. package/dist/es2019/services/use-data-source-client-extension/mockDatasourceDetailsResponse.js +73 -0
  21. package/dist/es2019/services/use-data-source-client-extension/mockExecuteActionResponse.js +5 -0
  22. package/dist/es2019/services/use-data-source-client-extension/mockExecuteActionResponseFailure.js +8 -0
  23. package/dist/es2019/services/use-data-source-client-extension/mocks.js +2 -400
  24. package/dist/esm/entry-points/data-source-client-extension-mocks.js +6 -1
  25. package/dist/esm/index.js +6 -1
  26. package/dist/esm/services/use-data-source-client-extension/index.js +28 -28
  27. package/dist/esm/services/use-data-source-client-extension/mockActionsDiscoveryEmptyResponse.js +6 -0
  28. package/dist/esm/services/use-data-source-client-extension/mockActionsDiscoveryResponse.js +70 -0
  29. package/dist/esm/services/use-data-source-client-extension/mockDatasourceDataNoActionsResponse.js +119 -0
  30. package/dist/esm/services/use-data-source-client-extension/mockDatasourceDataResponse.js +120 -0
  31. package/dist/esm/services/use-data-source-client-extension/mockDatasourceDetailsResponse.js +73 -0
  32. package/dist/esm/services/use-data-source-client-extension/mockExecuteActionResponse.js +5 -0
  33. package/dist/esm/services/use-data-source-client-extension/mockExecuteActionResponseFailure.js +8 -0
  34. package/dist/esm/services/use-data-source-client-extension/mocks.js +3 -401
  35. package/dist/esm/services/use-smart-link-client-extension/index.js +17 -17
  36. package/dist/types/entry-points/data-source-client-extension-mocks.d.ts +6 -1
  37. package/dist/types/entry-points/data-source-response-types.d.ts +1 -1
  38. package/dist/types/index.d.ts +7 -2
  39. package/dist/types/services/use-data-source-client-extension/mockActionsDiscoveryEmptyResponse.d.ts +2 -0
  40. package/dist/types/services/use-data-source-client-extension/mockActionsDiscoveryResponse.d.ts +2 -0
  41. package/dist/types/services/use-data-source-client-extension/mockDatasourceDataNoActionsResponse.d.ts +2 -0
  42. package/dist/types/services/use-data-source-client-extension/mockDatasourceDataResponse.d.ts +2 -0
  43. package/dist/types/services/use-data-source-client-extension/mockDatasourceDetailsResponse.d.ts +2 -0
  44. package/dist/types/services/use-data-source-client-extension/mockExecuteActionResponse.d.ts +2 -0
  45. package/dist/types/services/use-data-source-client-extension/mockExecuteActionResponseFailure.d.ts +2 -0
  46. package/dist/types/services/use-data-source-client-extension/mocks.d.ts +1 -8
  47. package/dist/types-ts4.5/entry-points/data-source-client-extension-mocks.d.ts +6 -1
  48. package/dist/types-ts4.5/entry-points/data-source-response-types.d.ts +1 -1
  49. package/dist/types-ts4.5/index.d.ts +7 -2
  50. package/dist/types-ts4.5/services/use-data-source-client-extension/mockActionsDiscoveryEmptyResponse.d.ts +2 -0
  51. package/dist/types-ts4.5/services/use-data-source-client-extension/mockActionsDiscoveryResponse.d.ts +2 -0
  52. package/dist/types-ts4.5/services/use-data-source-client-extension/mockDatasourceDataNoActionsResponse.d.ts +2 -0
  53. package/dist/types-ts4.5/services/use-data-source-client-extension/mockDatasourceDataResponse.d.ts +2 -0
  54. package/dist/types-ts4.5/services/use-data-source-client-extension/mockDatasourceDetailsResponse.d.ts +2 -0
  55. package/dist/types-ts4.5/services/use-data-source-client-extension/mockExecuteActionResponse.d.ts +2 -0
  56. package/dist/types-ts4.5/services/use-data-source-client-extension/mockExecuteActionResponseFailure.d.ts +2 -0
  57. package/dist/types-ts4.5/services/use-data-source-client-extension/mocks.d.ts +1 -8
  58. package/link-client-extension.docs.tsx +49 -47
  59. package/package.json +5 -4
@@ -1,316 +1,5 @@
1
- import { ActionOperationStatus } from '@atlaskit/linking-types';
2
- export const mockDatasourceDataResponse = {
3
- meta: {
4
- key: 'jira-object-provider',
5
- access: 'granted',
6
- auth: [],
7
- definitionId: 'object-resolver-service',
8
- product: 'jira',
9
- visibility: 'restricted',
10
- extensionKey: 'jira-object-provider',
11
- providerName: 'Jira',
12
- destinationObjectTypes: ['issue'],
13
- objectTypesEntity: 'work-item'
14
- },
15
- data: {
16
- totalCount: 1234,
17
- items: [{
18
- ari: {
19
- data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025'
20
- },
21
- id: {
22
- data: 'EDM-12'
23
- },
24
- description: {
25
- data: 'Design datasource feature'
26
- },
27
- createdAt: {
28
- data: '2023-01-22T01:30:00.000-05:00'
29
- },
30
- assigned: {
31
- data: {
32
- displayName: 'Sasha'
33
- }
34
- },
35
- status: {
36
- data: {
37
- text: 'In Progress',
38
- style: {
39
- appearance: 'inprogress'
40
- }
41
- }
42
- }
43
- }, {
44
- ari: {
45
- data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10026'
46
- },
47
- id: {
48
- data: 'EDM-14'
49
- },
50
- description: {
51
- data: 'Implement datasource feature'
52
- },
53
- createdAt: {
54
- data: '2023-03-01T01:30:00.000-05:00'
55
- },
56
- assigned: {
57
- data: {
58
- displayName: 'Hana'
59
- }
60
- },
61
- status: {
62
- data: {
63
- text: 'To Do',
64
- style: {
65
- appearance: 'new'
66
- }
67
- }
68
- }
69
- }, {
70
- ari: {
71
- data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10027'
72
- },
73
- id: {
74
- data: 'EDM-15'
75
- },
76
- description: {
77
- data: 'Add Jira Provider'
78
- },
79
- createdAt: {
80
- data: '2023-03-31T01:30:00.000-05:00'
81
- },
82
- assigned: {
83
- data: {
84
- displayName: 'Princey'
85
- }
86
- },
87
- status: {
88
- data: {
89
- text: 'To Do'
90
- }
91
- }
92
- }, {
93
- ari: {
94
- data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10028'
95
- },
96
- id: {
97
- data: 'EDM-16'
98
- },
99
- description: {
100
- data: 'Plan team party'
101
- },
102
- createdAt: {
103
- data: '2023-05-01T01:30:00.000-05:00'
104
- },
105
- assigned: {
106
- data: {
107
- displayName: 'Nidhin'
108
- }
109
- },
110
- status: {
111
- data: {
112
- text: 'Done',
113
- style: {
114
- appearance: 'success'
115
- }
116
- }
117
- }
118
- }],
119
- nextPageCursor: 'c3RhcnRBdD01'
120
- }
121
- };
122
- export const mockDatasourceDataNoActionsResponse = {
123
- meta: {
124
- key: 'jira-object-provider',
125
- access: 'granted',
126
- auth: [],
127
- definitionId: 'object-resolver-service',
128
- product: 'jira',
129
- visibility: 'restricted',
130
- extensionKey: 'jira-object-provider',
131
- providerName: 'Jira',
132
- destinationObjectTypes: ['issue']
133
- },
134
- data: {
135
- totalCount: 1234,
136
- items: [{
137
- ari: {
138
- data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025'
139
- },
140
- id: {
141
- data: 'EDM-12'
142
- },
143
- description: {
144
- data: 'Design datasource feature'
145
- },
146
- createdAt: {
147
- data: '2023-01-22T01:30:00.000-05:00'
148
- },
149
- assigned: {
150
- data: {
151
- displayName: 'Sasha'
152
- }
153
- },
154
- status: {
155
- data: {
156
- text: 'In Progress',
157
- style: {
158
- appearance: 'inprogress'
159
- }
160
- }
161
- }
162
- }, {
163
- ari: {
164
- data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10026'
165
- },
166
- id: {
167
- data: 'EDM-14'
168
- },
169
- description: {
170
- data: 'Implement datasource feature'
171
- },
172
- createdAt: {
173
- data: '2023-03-01T01:30:00.000-05:00'
174
- },
175
- assigned: {
176
- data: {
177
- displayName: 'Hana'
178
- }
179
- },
180
- status: {
181
- data: {
182
- text: 'To Do',
183
- style: {
184
- appearance: 'new'
185
- }
186
- }
187
- }
188
- }, {
189
- ari: {
190
- data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10027'
191
- },
192
- id: {
193
- data: 'EDM-15'
194
- },
195
- description: {
196
- data: 'Add Jira Provider'
197
- },
198
- createdAt: {
199
- data: '2023-03-31T01:30:00.000-05:00'
200
- },
201
- assigned: {
202
- data: {
203
- displayName: 'Princey'
204
- }
205
- },
206
- status: {
207
- data: {
208
- text: 'To Do'
209
- }
210
- }
211
- }, {
212
- ari: {
213
- data: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10028'
214
- },
215
- id: {
216
- data: 'EDM-16'
217
- },
218
- description: {
219
- data: 'Plan team party'
220
- },
221
- createdAt: {
222
- data: '2023-05-01T01:30:00.000-05:00'
223
- },
224
- assigned: {
225
- data: {
226
- displayName: 'Nidhin'
227
- }
228
- },
229
- status: {
230
- data: {
231
- text: 'Done',
232
- style: {
233
- appearance: 'success'
234
- }
235
- }
236
- }
237
- }],
238
- nextPageCursor: 'c3RhcnRBdD01'
239
- }
240
- };
241
- export const mockDatasourceDetailsResponse = {
242
- meta: {
243
- key: 'jira-object-provider',
244
- access: 'granted',
245
- auth: [],
246
- definitionId: 'object-resolver-service',
247
- product: 'jira',
248
- visibility: 'restricted',
249
- extensionKey: 'jira-object-provider',
250
- providerName: 'Jira',
251
- destinationObjectTypes: ['issue']
252
- },
253
- data: {
254
- ari: 'ari:cloud:linking-platform:datasource/12e74246-a3f1-46c1-9fd9-8d952aa9f12f',
255
- id: '12e74246-a3f1-46c1-9fd9-8d952aa9f12f',
256
- name: 'JQL Datasource',
257
- description: 'Fetches Issues using JQL',
258
- parameters: [{
259
- key: 'cloudId',
260
- type: 'string',
261
- description: 'Cloud Id'
262
- }, {
263
- key: 'jql',
264
- type: 'string',
265
- description: 'JQL query to retrieve list of issues'
266
- }],
267
- schema: {
268
- properties: [{
269
- key: 'id',
270
- title: '',
271
- type: 'string'
272
- }, {
273
- key: 'issue',
274
- title: 'Key',
275
- type: 'link'
276
- }, {
277
- key: 'type',
278
- type: 'icon',
279
- title: 'Type'
280
- }, {
281
- key: 'summary',
282
- title: 'Summary',
283
- type: 'link'
284
- }, {
285
- key: 'assignee',
286
- title: 'Assignee',
287
- type: 'user'
288
- }, {
289
- key: 'priority',
290
- title: 'P',
291
- type: 'icon'
292
- }, {
293
- key: 'labels',
294
- title: 'Labels',
295
- type: 'tag',
296
- isList: true
297
- }, {
298
- key: 'status',
299
- title: 'Status',
300
- type: 'status'
301
- }, {
302
- key: 'created',
303
- title: 'Created',
304
- type: 'string'
305
- }, {
306
- key: 'due',
307
- title: 'Due Date',
308
- type: 'string'
309
- }],
310
- defaultProperties: ['type', 'issue', 'summary', 'assignee', 'priority', 'labels', 'status', 'created']
311
- }
312
- }
313
- };
1
+ import { mockDatasourceDataResponse } from './mockDatasourceDataResponse';
2
+ import { mockDatasourceDetailsResponse } from './mockDatasourceDetailsResponse';
314
3
  export const mockDatasourceDataResponseWithSchema = {
315
4
  ...mockDatasourceDataResponse,
316
5
  data: {
@@ -319,91 +8,4 @@ export const mockDatasourceDataResponseWithSchema = {
319
8
  properties: mockDatasourceDetailsResponse.data.schema.properties
320
9
  }
321
10
  }
322
- };
323
- export const mockActionsDiscoveryResponse = {
324
- actions: [{
325
- actionKey: 'atlassian:work-item:update:summary',
326
- description: 'Updates issue summary',
327
- fieldKey: 'summary',
328
- integrationKey: 'jira',
329
- type: 'string'
330
- }, {
331
- integrationKey: 'jira',
332
- actionKey: 'atlassian:work-item:update:priority',
333
- fieldKey: 'priority',
334
- type: 'number',
335
- inputs: {
336
- priority: {
337
- type: 'string',
338
- fetchAction: {
339
- actionKey: 'atlassian:work-item:get:priorities',
340
- integrationKey: 'jira',
341
- fieldKey: 'priority',
342
- type: 'string',
343
- inputs: {
344
- issueId: {
345
- type: 'string'
346
- }
347
- }
348
- }
349
- }
350
- }
351
- }, {
352
- integrationKey: 'jira',
353
- actionKey: 'atlassian:work-item:update:status',
354
- type: 'string',
355
- fieldKey: 'status',
356
- inputs: {
357
- status: {
358
- type: 'string',
359
- fetchAction: {
360
- actionKey: 'atlassian:work-item:get:statuses',
361
- integrationKey: 'jira',
362
- fieldKey: 'status',
363
- type: 'string',
364
- inputs: {
365
- issueId: {
366
- type: 'string'
367
- }
368
- }
369
- }
370
- }
371
- }
372
- }],
373
- permissions: {
374
- data: [{
375
- ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025',
376
- fieldKey: 'summary',
377
- isEditable: true
378
- }, {
379
- ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10030',
380
- fieldKey: 'summary',
381
- isEditable: true
382
- }, {
383
- ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025',
384
- fieldKey: 'status',
385
- isEditable: true
386
- }, {
387
- ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10030',
388
- fieldKey: 'status',
389
- isEditable: true
390
- }]
391
- }
392
- };
393
- export const mockActionsDiscoveryEmptyResponse = {
394
- actions: [],
395
- permissions: {
396
- data: []
397
- }
398
- };
399
- export const mockExecuteActionResponse = {
400
- operationStatus: ActionOperationStatus.SUCCESS,
401
- errors: []
402
- };
403
- export const mockExecuteActionResponseFailure = {
404
- operationStatus: ActionOperationStatus.FAILURE,
405
- errors: [{
406
- message: 'summary: You must specify a summary of the issue.',
407
- code: 400
408
- }]
409
11
  };
@@ -1 +1,6 @@
1
- export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse, mockDatasourceDataResponse, mockDatasourceDataNoActionsResponse, mockDatasourceDataResponseWithSchema, mockActionsDiscoveryResponse, mockActionsDiscoveryEmptyResponse } from '../services/use-data-source-client-extension/mocks';
1
+ export { mockActionsDiscoveryEmptyResponse } from '../services/use-data-source-client-extension/mockActionsDiscoveryEmptyResponse';
2
+ export { mockActionsDiscoveryResponse } from '../services/use-data-source-client-extension/mockActionsDiscoveryResponse';
3
+ export { mockDatasourceDataNoActionsResponse } from '../services/use-data-source-client-extension/mockDatasourceDataNoActionsResponse';
4
+ export { mockDatasourceDataResponse } from '../services/use-data-source-client-extension/mockDatasourceDataResponse';
5
+ export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse } from '../services/use-data-source-client-extension/mockDatasourceDetailsResponse';
6
+ export { mockDatasourceDataResponseWithSchema } from '../services/use-data-source-client-extension/mocks';
package/dist/esm/index.js CHANGED
@@ -3,5 +3,10 @@ export { useSmartLinkClientExtension } from './services/use-smart-link-client-ex
3
3
  /** @deprecated use @atlaskit/link-client-extension/use-data-source-client-extension */
4
4
  export { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension } from './services/use-data-source-client-extension';
5
5
  /** @deprecated use @atlaskit/link-client-extension/data-source-client-extension/mocks */
6
- export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse, mockDatasourceDataResponse, mockDatasourceDataNoActionsResponse, mockDatasourceDataResponseWithSchema, mockActionsDiscoveryResponse, mockActionsDiscoveryEmptyResponse } from './services/use-data-source-client-extension/mocks';
6
+ export { mockActionsDiscoveryEmptyResponse } from './services/use-data-source-client-extension/mockActionsDiscoveryEmptyResponse';
7
+ export { mockActionsDiscoveryResponse } from './services/use-data-source-client-extension/mockActionsDiscoveryResponse';
8
+ export { mockDatasourceDataNoActionsResponse } from './services/use-data-source-client-extension/mockDatasourceDataNoActionsResponse';
9
+ export { mockDatasourceDataResponse } from './services/use-data-source-client-extension/mockDatasourceDataResponse';
10
+ export { mockDatasourceDetailsResponse as mockDatasourceResponse, mockDatasourceDetailsResponse } from './services/use-data-source-client-extension/mockDatasourceDetailsResponse';
11
+ export { mockDatasourceDataResponseWithSchema } from './services/use-data-source-client-extension/mocks';
7
12
  /** @deprecated use @atlaskit/link-client-extension/use-data-source-client-extension/types */
@@ -20,8 +20,8 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
20
20
  var resolverUrl = useResolverUrl(client);
21
21
  var cachedRequest = /*#__PURE__*/function () {
22
22
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(cacheKeyId, data, url, lruMap, force) {
23
- var cacheKeyData, cacheKey, responsePromise, headers;
24
- return _regeneratorRuntime.wrap(function _callee$(_context) {
23
+ var cacheKeyData, cacheKey, responsePromise, headers, _t;
24
+ return _regeneratorRuntime.wrap(function (_context) {
25
25
  while (1) switch (_context.prev = _context.next) {
26
26
  case 0:
27
27
  cacheKeyData = _objectSpread(_objectSpread(_objectSpread({}, data), 'fields' in data ? {
@@ -38,11 +38,11 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
38
38
  }
39
39
  responsePromise = lruMap.get(cacheKey);
40
40
  if (!responsePromise) {
41
- _context.next = 6;
41
+ _context.next = 1;
42
42
  break;
43
43
  }
44
44
  return _context.abrupt("return", responsePromise);
45
- case 6:
45
+ case 1:
46
46
  headers = {
47
47
  /**
48
48
  * This header exists to enable the backend to process relative time, eg: "today", with respect to user timezone.
@@ -50,23 +50,23 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
50
50
  */
51
51
  'origin-timezone': Intl === null || Intl === void 0 ? void 0 : Intl.DateTimeFormat().resolvedOptions().timeZone
52
52
  };
53
- _context.prev = 7;
53
+ _context.prev = 2;
54
54
  responsePromise = request('post', url, data, headers, [200, 201, 202, 203, 204]);
55
55
  lruMap.set(cacheKey, responsePromise);
56
- _context.next = 12;
56
+ _context.next = 3;
57
57
  return responsePromise;
58
- case 12:
58
+ case 3:
59
59
  return _context.abrupt("return", _context.sent);
60
- case 15:
61
- _context.prev = 15;
62
- _context.t0 = _context["catch"](7);
60
+ case 4:
61
+ _context.prev = 4;
62
+ _t = _context["catch"](2);
63
63
  lruMap.delete(cacheKey);
64
- throw _context.t0;
65
- case 19:
64
+ throw _t;
65
+ case 5:
66
66
  case "end":
67
67
  return _context.stop();
68
68
  }
69
- }, _callee, null, [[7, 15]]);
69
+ }, _callee, null, [[2, 4]]);
70
70
  }));
71
71
  return function cachedRequest(_x, _x2, _x3, _x4, _x5) {
72
72
  return _ref.apply(this, arguments);
@@ -75,12 +75,12 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
75
75
  var uncachedRequest = /*#__PURE__*/function () {
76
76
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data, url) {
77
77
  var responsePromise;
78
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
78
+ return _regeneratorRuntime.wrap(function (_context2) {
79
79
  while (1) switch (_context2.prev = _context2.next) {
80
80
  case 0:
81
81
  responsePromise = request('post', url, data, undefined, [200, 201, 202, 203, 204]);
82
82
  return _context2.abrupt("return", responsePromise);
83
- case 2:
83
+ case 1:
84
84
  case "end":
85
85
  return _context2.stop();
86
86
  }
@@ -94,12 +94,12 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
94
94
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(datasourceId, data) {
95
95
  var force,
96
96
  _args3 = arguments;
97
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
97
+ return _regeneratorRuntime.wrap(function (_context3) {
98
98
  while (1) switch (_context3.prev = _context3.next) {
99
99
  case 0:
100
100
  force = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : false;
101
101
  return _context3.abrupt("return", cachedRequest(datasourceId, data, "".concat(resolverUrl, "/datasource/").concat(datasourceId, "/fetch/details"), datasourceDetailsResponsePromiseCache, force));
102
- case 2:
102
+ case 1:
103
103
  case "end":
104
104
  return _context3.stop();
105
105
  }
@@ -113,12 +113,12 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
113
113
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(datasourceId, data) {
114
114
  var force,
115
115
  _args4 = arguments;
116
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
116
+ return _regeneratorRuntime.wrap(function (_context4) {
117
117
  while (1) switch (_context4.prev = _context4.next) {
118
118
  case 0:
119
119
  force = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : false;
120
120
  return _context4.abrupt("return", cachedRequest(datasourceId, data, "".concat(resolverUrl, "/datasource/").concat(datasourceId, "/fetch/data"), datasourceDataResponsePromiseCache, force));
121
- case 2:
121
+ case 1:
122
122
  case "end":
123
123
  return _context4.stop();
124
124
  }
@@ -133,19 +133,19 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
133
133
  var force,
134
134
  resolvedCacheIdKey,
135
135
  _args5 = arguments;
136
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
136
+ return _regeneratorRuntime.wrap(function (_context5) {
137
137
  while (1) switch (_context5.prev = _context5.next) {
138
138
  case 0:
139
139
  force = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : false;
140
140
  resolvedCacheIdKey = 'datasourceId' in data ? data.datasourceId : data.integrationKey; // This is just to prevent empty string being passed up to ORS and causing issues.
141
141
  if (resolvedCacheIdKey) {
142
- _context5.next = 4;
142
+ _context5.next = 1;
143
143
  break;
144
144
  }
145
145
  throw new Error('No target was supplied to retrieve actions for');
146
- case 4:
146
+ case 1:
147
147
  return _context5.abrupt("return", cachedRequest(resolvedCacheIdKey, data, "".concat(resolverUrl, "/actions"), datasourceActionsPermissionsPromiseCache, force));
148
- case 5:
148
+ case 2:
149
149
  case "end":
150
150
  return _context5.stop();
151
151
  }
@@ -157,7 +157,7 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
157
157
  }(), [resolverUrl]);
158
158
  var executeAtomicAction = useCallback( /*#__PURE__*/function () {
159
159
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(data) {
160
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
160
+ return _regeneratorRuntime.wrap(function (_context6) {
161
161
  while (1) switch (_context6.prev = _context6.next) {
162
162
  case 0:
163
163
  return _context6.abrupt("return", uncachedRequest(data, "".concat(resolverUrl, "/actions/execute")));
@@ -175,12 +175,12 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
175
175
  datasourceDataResponsePromiseCache.forEach( /*#__PURE__*/function () {
176
176
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(value, key) {
177
177
  var response, targetFound;
178
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
178
+ return _regeneratorRuntime.wrap(function (_context7) {
179
179
  while (1) switch (_context7.prev = _context7.next) {
180
180
  case 0:
181
- _context7.next = 2;
181
+ _context7.next = 1;
182
182
  return value;
183
- case 2:
183
+ case 1:
184
184
  response = _context7.sent;
185
185
  targetFound = response.data.items.some(function (item) {
186
186
  var _item$ari;
@@ -189,7 +189,7 @@ export var useDatasourceClientExtension = function useDatasourceClientExtension(
189
189
  if (targetFound) {
190
190
  datasourceDataResponsePromiseCache.delete(key);
191
191
  }
192
- case 5:
192
+ case 2:
193
193
  case "end":
194
194
  return _context7.stop();
195
195
  }
@@ -0,0 +1,6 @@
1
+ export var mockActionsDiscoveryEmptyResponse = {
2
+ actions: [],
3
+ permissions: {
4
+ data: []
5
+ }
6
+ };
@@ -0,0 +1,70 @@
1
+ export var mockActionsDiscoveryResponse = {
2
+ actions: [{
3
+ actionKey: 'atlassian:work-item:update:summary',
4
+ description: 'Updates issue summary',
5
+ fieldKey: 'summary',
6
+ integrationKey: 'jira',
7
+ type: 'string'
8
+ }, {
9
+ integrationKey: 'jira',
10
+ actionKey: 'atlassian:work-item:update:priority',
11
+ fieldKey: 'priority',
12
+ type: 'number',
13
+ inputs: {
14
+ priority: {
15
+ type: 'string',
16
+ fetchAction: {
17
+ actionKey: 'atlassian:work-item:get:priorities',
18
+ integrationKey: 'jira',
19
+ fieldKey: 'priority',
20
+ type: 'string',
21
+ inputs: {
22
+ issueId: {
23
+ type: 'string'
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }, {
30
+ integrationKey: 'jira',
31
+ actionKey: 'atlassian:work-item:update:status',
32
+ type: 'string',
33
+ fieldKey: 'status',
34
+ inputs: {
35
+ status: {
36
+ type: 'string',
37
+ fetchAction: {
38
+ actionKey: 'atlassian:work-item:get:statuses',
39
+ integrationKey: 'jira',
40
+ fieldKey: 'status',
41
+ type: 'string',
42
+ inputs: {
43
+ issueId: {
44
+ type: 'string'
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }],
51
+ permissions: {
52
+ data: [{
53
+ ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025',
54
+ fieldKey: 'summary',
55
+ isEditable: true
56
+ }, {
57
+ ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10030',
58
+ fieldKey: 'summary',
59
+ isEditable: true
60
+ }, {
61
+ ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10025',
62
+ fieldKey: 'status',
63
+ isEditable: true
64
+ }, {
65
+ ari: 'ari:cloud:jira:3ac63b37-9bca-435e-9840-eff6f8739dba:issue/10030',
66
+ fieldKey: 'status',
67
+ isEditable: true
68
+ }]
69
+ }
70
+ };