@kineticdata/react 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 (95) hide show
  1. package/README.md +110 -110
  2. package/assets/task/icons/defer.svg +12 -12
  3. package/assets/task/icons/drag-handle.svg +3 -3
  4. package/assets/task/icons/filter.svg +11 -11
  5. package/assets/task/icons/loop.svg +10 -10
  6. package/assets/task/icons/plus_small.svg +5 -5
  7. package/assets/task/icons/routine.svg +9 -9
  8. package/assets/task/icons/scale-minus.svg +11 -11
  9. package/assets/task/icons/scale-plus.svg +13 -13
  10. package/assets/task/icons/start.svg +11 -11
  11. package/assets/task/icons/stop.svg +8 -8
  12. package/lib/apis/core/activity.js +4 -4
  13. package/lib/apis/core/attributeDefinitions.js +55 -0
  14. package/lib/apis/core/attributeDefinitions.test.js +7 -4
  15. package/lib/apis/core/authentication.js +12 -1
  16. package/lib/apis/core/bridgeModels.test.js +46 -23
  17. package/lib/apis/core/bridgedresources.js +41 -41
  18. package/lib/apis/core/fileResources.js +2 -6
  19. package/lib/apis/core/forms.js +51 -2
  20. package/lib/apis/core/forms.test.js +32 -19
  21. package/lib/apis/core/kapps.js +49 -0
  22. package/lib/apis/core/kapps.test.js +16 -10
  23. package/lib/apis/core/notices.js +7 -0
  24. package/lib/apis/core/securityPolicyDefinitions.test.js +7 -4
  25. package/lib/apis/core/space.js +18 -0
  26. package/lib/apis/core/space.test.js +16 -10
  27. package/lib/apis/core/submissionActivities.js +38 -0
  28. package/lib/apis/core/submissions.js +62 -0
  29. package/lib/apis/core/translations.test.js +126 -55
  30. package/lib/apis/core/userPreferences.js +59 -0
  31. package/lib/apis/core/webApis.js +32 -2
  32. package/lib/apis/core/webhooks.test.js +7 -4
  33. package/lib/apis/http.js +22 -11
  34. package/lib/apis/index.js +24 -0
  35. package/lib/apis/integrator/index.js +95 -20
  36. package/lib/components/common/AttributeSelect.js +1 -0
  37. package/lib/components/common/BridgeSelect.js +1 -0
  38. package/lib/components/common/ConnectionSelect.js +2 -1
  39. package/lib/components/common/FormSelect.js +1 -0
  40. package/lib/components/common/NodeSelect.js +1 -0
  41. package/lib/components/common/StaticSelect.js +1 -0
  42. package/lib/components/common/TeamSelect.js +1 -0
  43. package/lib/components/common/ToastContainer.js +3 -3
  44. package/lib/components/common/Typeahead.js +3 -0
  45. package/lib/components/common/UserSelect.js +1 -0
  46. package/lib/components/common/authentication/AuthenticationContainer.js +121 -55
  47. package/lib/components/common/preferences/PreferencesProvider.js +461 -0
  48. package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +7 -7
  49. package/lib/components/core/field_definition/FieldDefinitionForm.js +3 -3
  50. package/lib/components/core/form/FormTable.js +0 -1
  51. package/lib/components/core/integration/IntegrationTable.js +3 -0
  52. package/lib/components/core/space/SpaceForm.js +14 -14
  53. package/lib/components/core/submission/SubmissionActivityForm.js +79 -0
  54. package/lib/components/core/submission/SubmissionForm.js +12 -2
  55. package/lib/components/core/translation/EntryTable.js +8 -7
  56. package/lib/components/core/user/UserForm.js +2 -0
  57. package/lib/components/core/user/UserTable.js +4 -4
  58. package/lib/components/form/Form.js +14 -3
  59. package/lib/components/form/FormState.js +1 -1
  60. package/lib/components/form/SimpleForm.js +2 -2
  61. package/lib/components/index.js +68 -0
  62. package/lib/components/integrator/connection/ConnectionForm.js +62 -18
  63. package/lib/components/integrator/connection/ConnectionTable.js +5 -3
  64. package/lib/components/integrator/connection/config_fields/http.js +19 -19
  65. package/lib/components/integrator/connection/config_fields/sql.js +123 -0
  66. package/lib/components/integrator/integrationTypes.js +27 -5
  67. package/lib/components/integrator/operation/OperationForm.js +24 -4
  68. package/lib/components/integrator/operation/OperationTable.js +3 -5
  69. package/lib/components/integrator/operation/config_fields/http.js +3 -2
  70. package/lib/components/integrator/operation/config_fields/sql.js +81 -0
  71. package/lib/components/system/SystemUserForm.js +2 -0
  72. package/lib/components/table/Table.js +75 -15
  73. package/lib/components/table/Table.redux.js +296 -72
  74. package/lib/components/table/defaults/FilterControl.js +24 -0
  75. package/lib/components/table/defaults/index.js +2 -0
  76. package/lib/components/table/tests/Table.test.js +22 -22
  77. package/lib/components/table/tests/components.js +9 -2
  78. package/lib/components/task/builder/Connector.js +51 -41
  79. package/lib/components/task/builder/Node.js +25 -38
  80. package/lib/components/task/builder/SvgCanvas.js +3 -17
  81. package/lib/components/task/builder/TreeBuilder.js +1 -2
  82. package/lib/components/task/builder/builder.redux.js +52 -32
  83. package/lib/components/task/builder/helpers.js +35 -5
  84. package/lib/components/task/common/UsageTable.js +8 -1
  85. package/lib/components/task/handlers/HandlerTable.js +9 -18
  86. package/lib/components/task/runs/RunTable.js +6 -10
  87. package/lib/components/task/workflows/LinkedWorkflowTable.js +14 -9
  88. package/lib/components/task/workflows/WorkflowTable.js +25 -24
  89. package/lib/helpers/index.js +18 -2
  90. package/lib/index.js +2 -1
  91. package/lib/saga.js +4 -4
  92. package/lib/store.js +2 -1
  93. package/package.json +5 -6
  94. package/proxyhelper.js +201 -201
  95. package/CHANGELOG.md +0 -116
@@ -4,7 +4,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
5
5
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
6
6
  var _axios = _interopRequireDefault(require("axios"));
7
- var _createError = _interopRequireDefault(require("axios/lib/core/createError"));
8
7
  var _space = require("./space");
9
8
  jest.mock('axios');
10
9
  describe('space api', function () {
@@ -155,11 +154,15 @@ describe('space api', function () {
155
154
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
156
155
  while (1) switch (_context3.prev = _context3.next) {
157
156
  case 0:
158
- _axios["default"].put.mockRejectedValue((0, _createError["default"])('Request failed with status code 400', null, 400, null, {
159
- status: 400,
160
- statusText: 'Bad Request',
161
- data: {
162
- error: 'Invalid space'
157
+ _axios["default"].put.mockRejectedValue(Object.assign(new Error('Request failed with status code 400'), {
158
+ name: 'AxiosError',
159
+ isAxiosError: true,
160
+ response: {
161
+ status: 400,
162
+ statusText: 'Bad Request',
163
+ data: {
164
+ error: 'Invalid space'
165
+ }
163
166
  }
164
167
  }));
165
168
  _context3.next = 3;
@@ -190,10 +193,13 @@ describe('space api', function () {
190
193
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context4) {
191
194
  while (1) switch (_context4.prev = _context4.next) {
192
195
  case 0:
193
- _axios["default"].put.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
194
- status: 403,
195
- statusText: 'Forbidden',
196
- data: {}
196
+ _axios["default"].put.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
197
+ name: 'AxiosError',
198
+ isAxiosError: true,
199
+ response: {
200
+ status: 403,
201
+ statusText: 'Forbidden'
202
+ }
197
203
  }));
198
204
  _context4.next = 3;
199
205
  return (0, _space.updateSpace)({
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.updateSubmissionActivity = exports.fetchSubmissionActivity = exports.fetchSubmissionActivities = exports.deleteSubmissionActivity = exports.createSubmissionActivity = void 0;
7
+ var _http = require("../http");
8
+ var _apiGroup = (0, _http.apiGroup)({
9
+ name: 'SubmissionActivity',
10
+ pluralName: 'SubmissionActivities',
11
+ dataOption: 'activity',
12
+ plural: {
13
+ requiredOptions: ['submissionId'],
14
+ url: function url(_ref) {
15
+ var submissionId = _ref.submissionId;
16
+ return "/submissions/".concat(submissionId, "/activities");
17
+ },
18
+ transform: function transform(response) {
19
+ return response.data;
20
+ }
21
+ },
22
+ singular: {
23
+ requiredOptions: ['submissionId', 'activityId'],
24
+ url: function url(_ref2) {
25
+ var submissionId = _ref2.submissionId,
26
+ activityId = _ref2.activityId;
27
+ return "/submissions/".concat(submissionId, "/activities/").concat(activityId);
28
+ },
29
+ transform: function transform(response) {
30
+ return response.data;
31
+ }
32
+ }
33
+ }),
34
+ fetchSubmissionActivities = exports.fetchSubmissionActivities = _apiGroup.fetchSubmissionActivities,
35
+ fetchSubmissionActivity = exports.fetchSubmissionActivity = _apiGroup.fetchSubmissionActivity,
36
+ createSubmissionActivity = exports.createSubmissionActivity = _apiGroup.createSubmissionActivity,
37
+ updateSubmissionActivity = exports.updateSubmissionActivity = _apiGroup.updateSubmissionActivity,
38
+ deleteSubmissionActivity = exports.deleteSubmissionActivity = _apiGroup.deleteSubmissionActivity;
@@ -436,6 +436,19 @@ var searchSubmissions = exports.searchSubmissions = function searchSubmissions(o
436
436
  promise = promise["catch"](_http.handleErrors);
437
437
  return promise;
438
438
  };
439
+
440
+ /**
441
+ * Fetches a submission by ID.
442
+ *
443
+ * @param {Object} options - Options for the fetch.
444
+ * @param {string} options.id - The ID of the submission to fetch.
445
+ * @param {boolean} [options.datastore] - Whether to fetch from the datastore API.
446
+ * @param {Object} [options.params] - Additional query parameters to include.
447
+ * @param {Object} [options.headers] - Additional headers to include.
448
+ *
449
+ * @returns {Promise<{submission: Object}>}
450
+ */
451
+
439
452
  var fetchSubmission = exports.fetchSubmission = function fetchSubmission(options) {
440
453
  var id = options.id;
441
454
  if (!id) {
@@ -456,6 +469,21 @@ var fetchSubmission = exports.fetchSubmission = function fetchSubmission(options
456
469
  // cleans up any errors.
457
470
  ["catch"](_http.handleErrors);
458
471
  };
472
+
473
+ /**
474
+ * Creates a new submission for the specified form in either a kapp or the datastore.
475
+ *
476
+ * @param {Object} options - Options for creating the submission.
477
+ * @param {string} [options.kappSlug] - The slug of the kapp. Defaults to bundle.kappSlug().
478
+ * @param {string} options.formSlug - The slug of the form to submit to.
479
+ * @param {Object} options.values - The values to submit.
480
+ * @param {boolean} [options.completed=true] - Whether the submission should be marked completed.
481
+ * @param {string} [options.coreState] - The core state of the submission.
482
+ * @param {string} [options.parent] - The ID of the parent submission, if applicable.
483
+ *
484
+ * @returns {Promise<{submission: Object}>}
485
+ */
486
+
459
487
  var createSubmission = exports.createSubmission = function createSubmission(options) {
460
488
  var _options$kappSlug = options.kappSlug,
461
489
  kappSlug = _options$kappSlug === void 0 ? _helpers.bundle.kappSlug() : _options$kappSlug,
@@ -492,6 +520,17 @@ var createSubmission = exports.createSubmission = function createSubmission(opti
492
520
  // cleans up any errors.
493
521
  ["catch"](_http.handleErrors);
494
522
  };
523
+
524
+ /**
525
+ * Clones an existing submission by ID.
526
+ *
527
+ * @param {Object} options - Options for cloning the submission.
528
+ * @param {string} options.id - The ID of the submission to clone.
529
+ * @param {boolean} [options.completed=false] - Whether the cloned submission should be marked as completed.
530
+ * @param {Object} [options.submission={}] - Optional values to override in the cloned submission.
531
+ * @returns {Promise<{submission: Object}>}
532
+ */
533
+
495
534
  var cloneSubmission = exports.cloneSubmission = function cloneSubmission(options) {
496
535
  var id = options.id,
497
536
  _options$completed2 = options.completed,
@@ -529,6 +568,18 @@ var cloneSubmission = exports.cloneSubmission = function cloneSubmission(options
529
568
  // cleans up any errors.
530
569
  ["catch"](_http.handleErrors);
531
570
  };
571
+
572
+ /**
573
+ * Updates an existing submission in either a kapp or the datastore.
574
+ *
575
+ * @param {Object} options - Options for updating the submission.
576
+ * @param {string} options.id - The ID of the submission to update.
577
+ * @param {Object} options.values - The values to update on the submission.
578
+ * @param {boolean} [options.datastore] - Whether the submission is in the datastore.
579
+ *
580
+ * @returns {Promise<{submission: Object}>}
581
+ */
582
+
532
583
  var updateSubmission = exports.updateSubmission = function updateSubmission(options) {
533
584
  var id = options.id,
534
585
  values = options.values;
@@ -622,6 +673,17 @@ var submitSubmission = exports.submitSubmission = function submitSubmission(opti
622
673
  // cleans up any errors.
623
674
  ["catch"](_http.handleErrors);
624
675
  };
676
+
677
+ /**
678
+ * Deletes an existing submission from either a kapp or the datastore.
679
+ *
680
+ * @param {Object} options - Options for deleting the submission.
681
+ * @param {string} options.id - The ID of the submission to delete.
682
+ * @param {boolean} [options.datastore] - Whether the submission is in the datastore.
683
+ *
684
+ * @returns {Promise<{submission: Object}>}
685
+ */
686
+
625
687
  var deleteSubmission = exports.deleteSubmission = function deleteSubmission(options) {
626
688
  var id = options.id;
627
689
  if (!id) {
@@ -4,7 +4,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
5
5
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
6
6
  var _axios = _interopRequireDefault(require("axios"));
7
- var _createError = _interopRequireDefault(require("axios/lib/core/createError"));
8
7
  var _translations = require("./translations");
9
8
  jest.mock('axios');
10
9
 
@@ -92,9 +91,13 @@ describe('translations api', function () {
92
91
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
93
92
  while (1) switch (_context3.prev = _context3.next) {
94
93
  case 0:
95
- _axios["default"].get.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
96
- status: 403,
97
- statusText: 'Forbidden'
94
+ _axios["default"].get.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
95
+ name: 'AxiosError',
96
+ isAxiosError: true,
97
+ response: {
98
+ status: 403,
99
+ statusText: 'Forbidden'
100
+ }
98
101
  }));
99
102
  _context3.next = 3;
100
103
  return (0, _translations.fetchAvailableLocales)();
@@ -160,9 +163,13 @@ describe('translations api', function () {
160
163
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee5$(_context5) {
161
164
  while (1) switch (_context5.prev = _context5.next) {
162
165
  case 0:
163
- _axios["default"]["delete"].mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
164
- status: 403,
165
- statusText: 'Forbidden'
166
+ _axios["default"]["delete"].mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
167
+ name: 'AxiosError',
168
+ isAxiosError: true,
169
+ response: {
170
+ status: 403,
171
+ statusText: 'Forbidden'
172
+ }
166
173
  }));
167
174
  _context5.next = 3;
168
175
  return (0, _translations.clearTranslationsCache)();
@@ -262,9 +269,13 @@ describe('translations api', function () {
262
269
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee8$(_context8) {
263
270
  while (1) switch (_context8.prev = _context8.next) {
264
271
  case 0:
265
- _axios["default"].get.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
266
- status: 403,
267
- statusText: 'Forbidden'
272
+ _axios["default"].get.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
273
+ name: 'AxiosError',
274
+ isAxiosError: true,
275
+ response: {
276
+ status: 403,
277
+ statusText: 'Forbidden'
278
+ }
268
279
  }));
269
280
  _context8.next = 3;
270
281
  return (0, _translations.fetchStagedTranslations)();
@@ -334,9 +345,13 @@ describe('translations api', function () {
334
345
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee10$(_context10) {
335
346
  while (1) switch (_context10.prev = _context10.next) {
336
347
  case 0:
337
- _axios["default"].get.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
338
- status: 403,
339
- statusText: 'Forbidden'
348
+ _axios["default"].get.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
349
+ name: 'AxiosError',
350
+ isAxiosError: true,
351
+ response: {
352
+ status: 403,
353
+ statusText: 'Forbidden'
354
+ }
340
355
  }));
341
356
  _context10.next = 3;
342
357
  return (0, _translations.fetchDefaultLocale)();
@@ -415,9 +430,13 @@ describe('translations api', function () {
415
430
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee12$(_context12) {
416
431
  while (1) switch (_context12.prev = _context12.next) {
417
432
  case 0:
418
- _axios["default"].put.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
419
- status: 403,
420
- statusText: 'Forbidden'
433
+ _axios["default"].put.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
434
+ name: 'AxiosError',
435
+ isAxiosError: true,
436
+ response: {
437
+ status: 403,
438
+ statusText: 'Forbidden'
439
+ }
421
440
  }));
422
441
  _context12.next = 3;
423
442
  return (0, _translations.setDefaultLocale)({
@@ -487,9 +506,13 @@ describe('translations api', function () {
487
506
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee14$(_context14) {
488
507
  while (1) switch (_context14.prev = _context14.next) {
489
508
  case 0:
490
- _axios["default"].get.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
491
- status: 403,
492
- statusText: 'Forbidden'
509
+ _axios["default"].get.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
510
+ name: 'AxiosError',
511
+ isAxiosError: true,
512
+ response: {
513
+ status: 403,
514
+ statusText: 'Forbidden'
515
+ }
493
516
  }));
494
517
  _context14.next = 3;
495
518
  return (0, _translations.fetchEnabledLocales)();
@@ -568,9 +591,13 @@ describe('translations api', function () {
568
591
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee16$(_context16) {
569
592
  while (1) switch (_context16.prev = _context16.next) {
570
593
  case 0:
571
- _axios["default"].post.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
572
- status: 403,
573
- statusText: 'Forbidden'
594
+ _axios["default"].post.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
595
+ name: 'AxiosError',
596
+ isAxiosError: true,
597
+ response: {
598
+ status: 403,
599
+ statusText: 'Forbidden'
600
+ }
574
601
  }));
575
602
  _context16.next = 3;
576
603
  return (0, _translations.enableLocale)({
@@ -651,9 +678,13 @@ describe('translations api', function () {
651
678
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee18$(_context18) {
652
679
  while (1) switch (_context18.prev = _context18.next) {
653
680
  case 0:
654
- _axios["default"]["delete"].mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
655
- status: 403,
656
- statusText: 'Forbidden'
681
+ _axios["default"]["delete"].mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
682
+ name: 'AxiosError',
683
+ isAxiosError: true,
684
+ response: {
685
+ status: 403,
686
+ statusText: 'Forbidden'
687
+ }
657
688
  }));
658
689
  _context18.next = 3;
659
690
  return (0, _translations.disableLocale)({
@@ -823,9 +854,13 @@ describe('translations api', function () {
823
854
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee22$(_context22) {
824
855
  while (1) switch (_context22.prev = _context22.next) {
825
856
  case 0:
826
- _axios["default"].get.mockRejectedValue((0, _createError["default"])('Request failed with status code 400', null, 400, null, {
827
- status: 400,
828
- statusText: 'The custom, expected, and unexpected flags can only be specified independently.'
857
+ _axios["default"].get.mockRejectedValue(Object.assign(new Error('Request failed with status code 400'), {
858
+ name: 'AxiosError',
859
+ isAxiosError: true,
860
+ response: {
861
+ status: 400,
862
+ statusText: 'The custom, expected, and unexpected flags can only be specified independently.'
863
+ }
829
864
  }));
830
865
  _context22.next = 3;
831
866
  return (0, _translations.fetchContexts)({
@@ -861,9 +896,13 @@ describe('translations api', function () {
861
896
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee23$(_context23) {
862
897
  while (1) switch (_context23.prev = _context23.next) {
863
898
  case 0:
864
- _axios["default"].get.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
865
- status: 403,
866
- statusText: 'Forbidden'
899
+ _axios["default"].get.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
900
+ name: 'AxiosError',
901
+ isAxiosError: true,
902
+ response: {
903
+ status: 403,
904
+ statusText: 'Forbidden'
905
+ }
867
906
  }));
868
907
  _context23.next = 3;
869
908
  return (0, _translations.fetchContexts)();
@@ -940,9 +979,13 @@ describe('translations api', function () {
940
979
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee25$(_context25) {
941
980
  while (1) switch (_context25.prev = _context25.next) {
942
981
  case 0:
943
- _axios["default"].post.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
944
- status: 403,
945
- statusText: 'Forbidden'
982
+ _axios["default"].post.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
983
+ name: 'AxiosError',
984
+ isAxiosError: true,
985
+ response: {
986
+ status: 403,
987
+ statusText: 'Forbidden'
988
+ }
946
989
  }));
947
990
  _context25.next = 3;
948
991
  return (0, _translations.createContext)({
@@ -1031,9 +1074,13 @@ describe('translations api', function () {
1031
1074
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee27$(_context27) {
1032
1075
  while (1) switch (_context27.prev = _context27.next) {
1033
1076
  case 0:
1034
- _axios["default"].put.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
1035
- status: 403,
1036
- statusText: 'Forbidden'
1077
+ _axios["default"].put.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
1078
+ name: 'AxiosError',
1079
+ isAxiosError: true,
1080
+ response: {
1081
+ status: 403,
1082
+ statusText: 'Forbidden'
1083
+ }
1037
1084
  }));
1038
1085
  _context27.next = 3;
1039
1086
  return (0, _translations.updateContext)({
@@ -1109,9 +1156,13 @@ describe('translations api', function () {
1109
1156
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee29$(_context29) {
1110
1157
  while (1) switch (_context29.prev = _context29.next) {
1111
1158
  case 0:
1112
- _axios["default"]["delete"].mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
1113
- status: 403,
1114
- statusText: 'Forbidden'
1159
+ _axios["default"]["delete"].mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
1160
+ name: 'AxiosError',
1161
+ isAxiosError: true,
1162
+ response: {
1163
+ status: 403,
1164
+ statusText: 'Forbidden'
1165
+ }
1115
1166
  }));
1116
1167
  _context29.next = 3;
1117
1168
  return (0, _translations.deleteContext)({
@@ -1186,9 +1237,13 @@ describe('translations api', function () {
1186
1237
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee31$(_context31) {
1187
1238
  while (1) switch (_context31.prev = _context31.next) {
1188
1239
  case 0:
1189
- _axios["default"].get.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
1190
- status: 403,
1191
- statusText: 'Forbidden'
1240
+ _axios["default"].get.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
1241
+ name: 'AxiosError',
1242
+ isAxiosError: true,
1243
+ response: {
1244
+ status: 403,
1245
+ statusText: 'Forbidden'
1246
+ }
1192
1247
  }));
1193
1248
  _context31.next = 3;
1194
1249
  return (0, _translations.fetchContextKeys)({
@@ -1288,9 +1343,13 @@ describe('translations api', function () {
1288
1343
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee33$(_context33) {
1289
1344
  while (1) switch (_context33.prev = _context33.next) {
1290
1345
  case 0:
1291
- _axios["default"].put.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
1292
- status: 403,
1293
- statusText: 'Forbidden'
1346
+ _axios["default"].put.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
1347
+ name: 'AxiosError',
1348
+ isAxiosError: true,
1349
+ response: {
1350
+ status: 403,
1351
+ statusText: 'Forbidden'
1352
+ }
1294
1353
  }));
1295
1354
  _context33.next = 3;
1296
1355
  return (0, _translations.updateContextKey)({
@@ -1529,9 +1588,13 @@ describe('translations api', function () {
1529
1588
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee39$(_context39) {
1530
1589
  while (1) switch (_context39.prev = _context39.next) {
1531
1590
  case 0:
1532
- _axios["default"].get.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
1533
- status: 403,
1534
- statusText: 'Forbidden'
1591
+ _axios["default"].get.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
1592
+ name: 'AxiosError',
1593
+ isAxiosError: true,
1594
+ response: {
1595
+ status: 403,
1596
+ statusText: 'Forbidden'
1597
+ }
1535
1598
  }));
1536
1599
  _context39.next = 3;
1537
1600
  return (0, _translations.fetchTranslations)();
@@ -1690,9 +1753,13 @@ describe('translations api', function () {
1690
1753
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee43$(_context43) {
1691
1754
  while (1) switch (_context43.prev = _context43.next) {
1692
1755
  case 0:
1693
- _axios["default"].post.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
1694
- status: 403,
1695
- statusText: 'Forbidden'
1756
+ _axios["default"].post.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
1757
+ name: 'AxiosError',
1758
+ isAxiosError: true,
1759
+ response: {
1760
+ status: 403,
1761
+ statusText: 'Forbidden'
1762
+ }
1696
1763
  }));
1697
1764
  _context43.next = 3;
1698
1765
  return (0, _translations.upsertTranslations)({
@@ -1847,9 +1914,13 @@ describe('translations api', function () {
1847
1914
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee47$(_context47) {
1848
1915
  while (1) switch (_context47.prev = _context47.next) {
1849
1916
  case 0:
1850
- _axios["default"]["delete"].mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
1851
- status: 403,
1852
- statusText: 'Forbidden'
1917
+ _axios["default"]["delete"].mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
1918
+ name: 'AxiosError',
1919
+ isAxiosError: true,
1920
+ response: {
1921
+ status: 403,
1922
+ statusText: 'Forbidden'
1923
+ }
1853
1924
  }));
1854
1925
  _context47.next = 3;
1855
1926
  return (0, _translations.deleteTranslations)();
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.upsertUserPreference = exports.resetUserPreferences = exports.fetchUserPreferences = exports.fetchUserPreference = exports.deleteUserPreference = void 0;
8
+ var _axios = _interopRequireDefault(require("axios"));
9
+ var _http = require("../http");
10
+ var _helpers = require("../../helpers");
11
+ var fetchUserPreferences = exports.fetchUserPreferences = function fetchUserPreferences() {
12
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
+ return _axios["default"].get("".concat(_helpers.bundle.apiLocation(), "/userPreferences"), {
14
+ params: options
15
+ }).then(function (response) {
16
+ return response.data;
17
+ })["catch"](_http.handleErrors);
18
+ };
19
+ var fetchUserPreference = exports.fetchUserPreference = function fetchUserPreference() {
20
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
21
+ (0, _http.validateOptions)('updateUserPreference', ['key'], options);
22
+ var key = options.key;
23
+ return _axios["default"].get("".concat(_helpers.bundle.apiLocation(), "/userPreferences/").concat(key), {
24
+ params: options
25
+ }).then(function (response) {
26
+ return response.data;
27
+ })["catch"](_http.handleErrors);
28
+ };
29
+ var upsertUserPreference = exports.upsertUserPreference = function upsertUserPreference() {
30
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
31
+ (0, _http.validateOptions)('updateUserPreference', ['userPreference'], options);
32
+ var userPreference = options.userPreference;
33
+ return _axios["default"].post("".concat(_helpers.bundle.apiLocation(), "/userPreferences"), {
34
+ userPreference: userPreference
35
+ }, {
36
+ params: (0, _http.paramBuilder)(options),
37
+ headers: (0, _http.headerBuilder)(options)
38
+ }).then(function (response) {
39
+ return response.data;
40
+ })["catch"](_http.handleErrors);
41
+ };
42
+ var deleteUserPreference = exports.deleteUserPreference = function deleteUserPreference() {
43
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
44
+ (0, _http.validateOptions)('updateUserPreference', ['key'], options);
45
+ var key = options.key;
46
+ return _axios["default"]["delete"]("".concat(_helpers.bundle.apiLocation(), "/userPreferences/").concat(key), {
47
+ params: options
48
+ }).then(function (response) {
49
+ return response.data;
50
+ })["catch"](_http.handleErrors);
51
+ };
52
+ var resetUserPreferences = exports.resetUserPreferences = function resetUserPreferences() {
53
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
54
+ return _axios["default"].post("".concat(_helpers.bundle.apiLocation(), "/userPreferences/reset"), null, {
55
+ params: options
56
+ }).then(function (response) {
57
+ return response.data;
58
+ })["catch"](_http.handleErrors);
59
+ };
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.updateWebApi = exports.fetchWebApis = exports.fetchWebApi = exports.deleteWebApi = exports.createWebApi = void 0;
7
+ exports.updateWebApi = exports.importWebApi = exports.fetchWebApis = exports.fetchWebApi = exports.exportWebApi = exports.deleteWebApi = exports.createWebApi = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
7
9
  var _http = require("../http");
10
+ var _axios = _interopRequireDefault(require("axios"));
11
+ var _helpers = require("../../helpers");
12
+ var _excluded = ["webApi", "kappSlug"];
8
13
  var _apiGroup = (0, _http.apiGroup)({
9
14
  name: 'WebApi',
10
15
  dataOption: 'webApi',
@@ -38,4 +43,29 @@ var _apiGroup = (0, _http.apiGroup)({
38
43
  fetchWebApi = exports.fetchWebApi = _apiGroup.fetchWebApi,
39
44
  createWebApi = exports.createWebApi = _apiGroup.createWebApi,
40
45
  updateWebApi = exports.updateWebApi = _apiGroup.updateWebApi,
41
- deleteWebApi = exports.deleteWebApi = _apiGroup.deleteWebApi;
46
+ deleteWebApi = exports.deleteWebApi = _apiGroup.deleteWebApi;
47
+ var exportWebApi = exports.exportWebApi = function exportWebApi() {
48
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
49
+ (0, _http.validateOptions)('exportWebApi', ['slug'], options);
50
+ var slug = options.slug,
51
+ kappSlug = options.kappSlug;
52
+ return _axios["default"].get("".concat(_helpers.bundle.apiLocation()).concat(kappSlug ? "/kapps/".concat(kappSlug) : '', "/webApis/").concat(slug, "/export")).then(function (response) {
53
+ return {
54
+ webApi: response.data
55
+ };
56
+ })["catch"](_http.handleErrors);
57
+ };
58
+ var importWebApi = exports.importWebApi = function importWebApi() {
59
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
60
+ (0, _http.validateOptions)('importWebApi', ['webApi'], options);
61
+ var webApi = options.webApi,
62
+ kappSlug = options.kappSlug,
63
+ params = (0, _objectWithoutProperties2["default"])(options, _excluded);
64
+ return _axios["default"].post("".concat(_helpers.bundle.apiLocation()).concat(kappSlug ? "/kapps/".concat(kappSlug) : '', "/webApiImport"), webApi, {
65
+ params: params
66
+ }).then(function (response) {
67
+ return {
68
+ webApi: response.data
69
+ };
70
+ })["catch"](_http.handleErrors);
71
+ };
@@ -4,7 +4,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
5
5
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
6
6
  var _axios = _interopRequireDefault(require("axios"));
7
- var _createError = _interopRequireDefault(require("axios/lib/core/createError"));
8
7
  var _webhooks = require("./webhooks");
9
8
  jest.mock('axios');
10
9
 
@@ -118,9 +117,13 @@ describe('webhooks api', function () {
118
117
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
119
118
  while (1) switch (_context3.prev = _context3.next) {
120
119
  case 0:
121
- _axios["default"].get.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
122
- status: 403,
123
- statusText: 'Forbidden'
120
+ _axios["default"].get.mockRejectedValue(Object.assign(new Error('Request failed with status code 403'), {
121
+ name: 'AxiosError',
122
+ isAxiosError: true,
123
+ response: {
124
+ status: 403,
125
+ statusText: 'Forbidden'
126
+ }
124
127
  }));
125
128
  _context3.next = 3;
126
129
  return (0, _webhooks.fetchWebhooks)();