@atlaskit/link-client-extension 0.4.2 → 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,22 @@
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
+
13
+ ## 0.4.3
14
+
15
+ ### Patch Changes
16
+
17
+ - [`f1b712482b1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f1b712482b1) - Fixed error handling inside of invoke function
18
+ - Updated dependencies
19
+
3
20
  ## 0.4.2
4
21
 
5
22
  ### 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;
@@ -9,6 +9,7 @@ exports.useSmartLinkClientExtension = void 0;
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _react = require("react");
11
11
  var _linkingCommon = require("@atlaskit/linking-common");
12
+ var _smartLinkActions = require("@atlaskit/linking-types/smart-link-actions");
12
13
  var _useResolverUrl = require("../use-resolver-url");
13
14
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
14
15
  /**
@@ -23,22 +24,40 @@ var useSmartLinkClientExtension = function useSmartLinkClientExtension(cardClien
23
24
  var resolvedUrl = (0, _useResolverUrl.useResolverUrl)(cardClient);
24
25
  var invoke = (0, _react.useCallback)( /*#__PURE__*/function () {
25
26
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
26
- var response;
27
+ var errorBody;
27
28
  return _regeneratorRuntime().wrap(function _callee$(_context) {
28
29
  while (1) {
29
30
  switch (_context.prev = _context.next) {
30
31
  case 0:
31
- _context.next = 2;
32
+ _context.prev = 0;
33
+ _context.next = 3;
32
34
  return (0, _linkingCommon.request)('post', "".concat(resolvedUrl, "/invoke"), data, undefined, [200, 201, 202, 203, 204]);
33
- case 2:
34
- response = _context.sent;
35
- return _context.abrupt("return", response);
36
- case 4:
35
+ case 3:
36
+ return _context.abrupt("return", _context.sent);
37
+ case 6:
38
+ _context.prev = 6;
39
+ _context.t0 = _context["catch"](0);
40
+ if (!(_context.t0 && _context.t0.json && typeof _context.t0.json === 'function')) {
41
+ _context.next = 14;
42
+ break;
43
+ }
44
+ _context.next = 11;
45
+ return _context.t0.json();
46
+ case 11:
47
+ errorBody = _context.sent;
48
+ if (!errorBody) {
49
+ _context.next = 14;
50
+ break;
51
+ }
52
+ throw new _smartLinkActions.InvokeError(errorBody === null || errorBody === void 0 ? void 0 : errorBody.error.message, errorBody === null || errorBody === void 0 ? void 0 : errorBody.error.status);
53
+ case 14:
54
+ throw _context.t0;
55
+ case 15:
37
56
  case "end":
38
57
  return _context.stop();
39
58
  }
40
59
  }
41
- }, _callee);
60
+ }, _callee, null, [[0, 6]]);
42
61
  }));
43
62
  return function (_x) {
44
63
  return _ref.apply(this, arguments);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-client-extension",
3
- "version": "0.4.2",
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,6 @@
1
1
  import { useCallback, useMemo } from 'react';
2
2
  import { request } from '@atlaskit/linking-common';
3
+ import { InvokeError } from '@atlaskit/linking-types/smart-link-actions';
3
4
  import { useResolverUrl } from '../use-resolver-url';
4
5
 
5
6
  /**
@@ -13,8 +14,20 @@ import { useResolverUrl } from '../use-resolver-url';
13
14
  export const useSmartLinkClientExtension = cardClient => {
14
15
  const resolvedUrl = useResolverUrl(cardClient);
15
16
  const invoke = useCallback(async data => {
16
- const response = await request('post', `${resolvedUrl}/invoke`, data, undefined, [200, 201, 202, 203, 204]);
17
- return response;
17
+ try {
18
+ return await request('post', `${resolvedUrl}/invoke`, data, undefined, [200, 201, 202, 203, 204]);
19
+ } catch (err) {
20
+ // checking if the error is a Response type
21
+ // since we already had a few HOTs caused by comparing with instanceOf',
22
+ // we're verifying the type by the contents
23
+ if (err && err.json && typeof err.json === 'function') {
24
+ const errorBody = await err.json();
25
+ if (errorBody) {
26
+ throw new InvokeError(errorBody === null || errorBody === void 0 ? void 0 : errorBody.error.message, errorBody === null || errorBody === void 0 ? void 0 : errorBody.error.status);
27
+ }
28
+ }
29
+ throw err;
30
+ }
18
31
  }, [resolvedUrl]);
19
32
  return useMemo(() => ({
20
33
  invoke
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-client-extension",
3
- "version": "0.4.2",
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
  };
@@ -3,6 +3,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
4
  import { useCallback, useMemo } from 'react';
5
5
  import { request } from '@atlaskit/linking-common';
6
+ import { InvokeError } from '@atlaskit/linking-types/smart-link-actions';
6
7
  import { useResolverUrl } from '../use-resolver-url';
7
8
 
8
9
  /**
@@ -17,22 +18,40 @@ export var useSmartLinkClientExtension = function useSmartLinkClientExtension(ca
17
18
  var resolvedUrl = useResolverUrl(cardClient);
18
19
  var invoke = useCallback( /*#__PURE__*/function () {
19
20
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
20
- var response;
21
+ var errorBody;
21
22
  return _regeneratorRuntime().wrap(function _callee$(_context) {
22
23
  while (1) {
23
24
  switch (_context.prev = _context.next) {
24
25
  case 0:
25
- _context.next = 2;
26
+ _context.prev = 0;
27
+ _context.next = 3;
26
28
  return request('post', "".concat(resolvedUrl, "/invoke"), data, undefined, [200, 201, 202, 203, 204]);
27
- case 2:
28
- response = _context.sent;
29
- return _context.abrupt("return", response);
30
- case 4:
29
+ case 3:
30
+ return _context.abrupt("return", _context.sent);
31
+ case 6:
32
+ _context.prev = 6;
33
+ _context.t0 = _context["catch"](0);
34
+ if (!(_context.t0 && _context.t0.json && typeof _context.t0.json === 'function')) {
35
+ _context.next = 14;
36
+ break;
37
+ }
38
+ _context.next = 11;
39
+ return _context.t0.json();
40
+ case 11:
41
+ errorBody = _context.sent;
42
+ if (!errorBody) {
43
+ _context.next = 14;
44
+ break;
45
+ }
46
+ throw new InvokeError(errorBody === null || errorBody === void 0 ? void 0 : errorBody.error.message, errorBody === null || errorBody === void 0 ? void 0 : errorBody.error.status);
47
+ case 14:
48
+ throw _context.t0;
49
+ case 15:
31
50
  case "end":
32
51
  return _context.stop();
33
52
  }
34
53
  }
35
- }, _callee);
54
+ }, _callee, null, [[0, 6]]);
36
55
  }));
37
56
  return function (_x) {
38
57
  return _ref.apply(this, arguments);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-client-extension",
3
- "version": "0.4.2",
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
  };
@@ -1,5 +1,5 @@
1
1
  import type { CardClient } from '@atlaskit/link-provider';
2
- import type { InvokeRequest, InvokeResponse } from '@atlaskit/linking-types/smart-link-actions';
2
+ import { InvokeRequest, InvokeResponse } from '@atlaskit/linking-types/smart-link-actions';
3
3
  /**
4
4
  * useSmartLinkClientExtension
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-client-extension",
3
- "version": "0.4.2",
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",
@@ -26,8 +26,8 @@
26
26
  ".": "./src/index.ts"
27
27
  },
28
28
  "dependencies": {
29
- "@atlaskit/linking-common": "^2.5.0",
30
- "@atlaskit/linking-types": "^1.0.0",
29
+ "@atlaskit/linking-common": "^2.6.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
@@ -20,11 +20,17 @@ import type { DatasourceDataRequest } from '@atlaskit/linking-types';
20
20
  import type { DatasourceDataResponse } from '@atlaskit/linking-types';
21
21
  import type { DatasourceParameters } from '@atlaskit/linking-types';
22
22
  import type { DatasourceResponse } from '@atlaskit/linking-types';
23
- import type { InvokeRequest } from '@atlaskit/linking-types/smart-link-actions';
24
- import type { InvokeResponse } from '@atlaskit/linking-types/smart-link-actions';
23
+ import { InvokeRequest } from '@atlaskit/linking-types/smart-link-actions';
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,
@@ -9,11 +9,17 @@ import type { DatasourceDataRequest } from '@atlaskit/linking-types';
9
9
  import type { DatasourceDataResponse } from '@atlaskit/linking-types';
10
10
  import type { DatasourceParameters } from '@atlaskit/linking-types';
11
11
  import type { DatasourceResponse } from '@atlaskit/linking-types';
12
- import type { InvokeRequest } from '@atlaskit/linking-types/smart-link-actions';
13
- import type { InvokeResponse } from '@atlaskit/linking-types/smart-link-actions';
12
+ import { InvokeRequest } from '@atlaskit/linking-types/smart-link-actions';
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
  };