@kineticdata/react 5.1.0 → 5.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.
- package/lib/apis/core/attributeDefinitions.js +11 -9
- package/lib/apis/core/attributeDefinitions.test.js +1 -1
- package/lib/apis/core/backgroundJobs.js +2 -1
- package/lib/apis/core/bridgeModelAttributeMappings.js +1 -1
- package/lib/apis/core/bridgeModelAttributes.js +15 -12
- package/lib/apis/core/bridgeModelMappings.js +1 -1
- package/lib/apis/core/bridgeModelQualificationMappings.js +2 -2
- package/lib/apis/core/bridgeModelQualifications.js +2 -2
- package/lib/apis/core/bridgeModels.js +14 -8
- package/lib/apis/core/bridgedresources.js +3 -2
- package/lib/apis/core/formTypes.js +18 -21
- package/lib/apis/core/oauthClients.js +11 -5
- package/lib/apis/core/securityPolicyDefinitions.js +1 -1
- package/lib/apis/core/submissions.js +68 -0
- package/lib/apis/core/webhooks.js +1 -1
- package/lib/apis/core/webhooks.test.js +2 -2
- package/lib/apis/http.js +6 -0
- package/package.json +2 -2
|
@@ -32,11 +32,13 @@ var validateOptions = function validateOptions(functionName, requiredOptions, op
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
var buildEndpoint = function buildEndpoint(_ref) {
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
var kappSlug = _ref.kappSlug,
|
|
36
|
+
at = _ref.attributeType,
|
|
37
|
+
an = _ref.attributeName;
|
|
38
|
+
var attributeType = encodeURIComponent(at);
|
|
39
|
+
var attributeName = encodeURIComponent(an);
|
|
38
40
|
var basePath = kappSlug ? "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/").concat(attributeType) : "".concat(bundle.apiLocation(), "/").concat(attributeType);
|
|
39
|
-
return
|
|
41
|
+
return an ? "".concat(basePath, "/").concat(attributeName) : basePath;
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
export var fetchAttributeDefinitions = function fetchAttributeDefinitions() {
|
|
@@ -70,12 +72,12 @@ export var createAttributeDefinition = function createAttributeDefinition() {
|
|
|
70
72
|
var kappSlug = options.kappSlug,
|
|
71
73
|
attributeType = options.attributeType,
|
|
72
74
|
attributeDefinition = options.attributeDefinition;
|
|
73
|
-
validateOptions('createAttributeDefinition', ['attributeType', 'attributeDefinition'], options); //
|
|
74
|
-
// so not using the buildEndpoint function
|
|
75
|
+
validateOptions('createAttributeDefinition', ['attributeType', 'attributeDefinition'], options); // The API returns the singular name of the attribute type, so we remove the "s"
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
return axios.post(buildEndpoint({
|
|
78
|
+
kappSlug: kappSlug,
|
|
79
|
+
attributeType: attributeType
|
|
80
|
+
}), attributeDefinition, {
|
|
79
81
|
params: paramBuilder(options),
|
|
80
82
|
headers: headerBuilder(options)
|
|
81
83
|
}).then(function (response) {
|
|
@@ -325,7 +325,7 @@ describe('attributeDefinitions api', function () {
|
|
|
325
325
|
|
|
326
326
|
case 3:
|
|
327
327
|
result = _context6.sent;
|
|
328
|
-
expect(axios.put.mock.calls).toEqual([['space/app/api/v1/spaceAttributeDefinitions/Test
|
|
328
|
+
expect(axios.put.mock.calls).toEqual([['space/app/api/v1/spaceAttributeDefinitions/Test%20Attribute', {
|
|
329
329
|
name: 'Test Attribute',
|
|
330
330
|
description: 'Test Attr Desc',
|
|
331
331
|
allowsMultiple: true
|
|
@@ -9,8 +9,9 @@ var backgroundJobPath = function backgroundJobPath() {
|
|
|
9
9
|
kappSlug = _ref.kappSlug,
|
|
10
10
|
job = _ref.job;
|
|
11
11
|
|
|
12
|
+
var j = encodeURIComponent(job);
|
|
12
13
|
var basePath = !formSlug && !kappSlug ? "".concat(bundle.apiLocation(), "/backgroundJobs") : !formSlug && kappSlug ? "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/backgroundJobs") : formSlug && !kappSlug ? "".concat(bundle.apiLocation(), "/forms/").concat(formSlug, "/backgroundJobs") : "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/forms/").concat(formSlug, "/backgroundJobs");
|
|
13
|
-
return basePath + (job ? "/".concat(
|
|
14
|
+
return basePath + (job ? "/".concat(j) : '');
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export var fetchBackgroundJobs = function fetchBackgroundJobs() {
|
|
@@ -22,7 +22,7 @@ var _apiGroup = apiGroup({
|
|
|
22
22
|
var modelName = _ref2.modelName,
|
|
23
23
|
mappingName = _ref2.mappingName,
|
|
24
24
|
attributeName = _ref2.attributeName;
|
|
25
|
-
return "/models/".concat(modelName, "/mappings/").concat(mappingName, "/attributes/").concat(attributeName);
|
|
25
|
+
return "/models/".concat(modelName, "/mappings/").concat(mappingName, "/attributes/").concat(encodeURIComponent(attributeName));
|
|
26
26
|
},
|
|
27
27
|
transform: function transform(response) {
|
|
28
28
|
return {
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { bundle } from '../../helpers';
|
|
3
3
|
import { handleErrors, headerBuilder, paramBuilder, validateOptions } from '../http';
|
|
4
|
+
|
|
5
|
+
var buildEndpoint = function buildEndpoint(_ref) {
|
|
6
|
+
var modelName = _ref.modelName,
|
|
7
|
+
attributeName = _ref.attributeName;
|
|
8
|
+
var an = encodeURIComponent(attributeName);
|
|
9
|
+
var mn = encodeURIComponent(modelName);
|
|
10
|
+
return attributeName ? "".concat(bundle.apiLocation(), "/models/").concat(mn, "/attributes") : "".concat(bundle.apiLocation(), "/models/").concat(mn, "/attributes/").concat(an);
|
|
11
|
+
};
|
|
12
|
+
|
|
4
13
|
export var fetchBridgeModelAttributes = function fetchBridgeModelAttributes() {
|
|
5
14
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
15
|
validateOptions('fetchBridgeModelAttributes', ['modelName'], options);
|
|
7
|
-
return axios.get(
|
|
16
|
+
return axios.get(buildEndpoint(options), {
|
|
8
17
|
params: paramBuilder(options),
|
|
9
18
|
headers: headerBuilder(options)
|
|
10
19
|
}).then(function (response) {
|
|
@@ -16,9 +25,7 @@ export var fetchBridgeModelAttributes = function fetchBridgeModelAttributes() {
|
|
|
16
25
|
export var fetchBridgeModelAttribute = function fetchBridgeModelAttribute() {
|
|
17
26
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
27
|
validateOptions('fetchBridgeModelAttribute', ['modelName', 'attributeName'], options);
|
|
19
|
-
|
|
20
|
-
attributeName = options.attributeName;
|
|
21
|
-
return axios.get("".concat(bundle.apiLocation(), "/models/").concat(modelName, "/attributes/").concat(attributeName), {
|
|
28
|
+
return axios.get(buildEndpoint(options), {
|
|
22
29
|
params: paramBuilder(options),
|
|
23
30
|
headers: headerBuilder(options)
|
|
24
31
|
}).then(function (response) {
|
|
@@ -30,7 +37,7 @@ export var fetchBridgeModelAttribute = function fetchBridgeModelAttribute() {
|
|
|
30
37
|
export var createBridgeModelAttribute = function createBridgeModelAttribute() {
|
|
31
38
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
39
|
validateOptions('createBridgeModelAttribute', ['modelName', 'bridgeModelAttribute'], options);
|
|
33
|
-
return axios.post(
|
|
40
|
+
return axios.post(buildEndpoint(options), options.bridgeModelAttribute, {
|
|
34
41
|
params: paramBuilder(options),
|
|
35
42
|
headers: headerBuilder(options)
|
|
36
43
|
}).then(function (response) {
|
|
@@ -42,10 +49,8 @@ export var createBridgeModelAttribute = function createBridgeModelAttribute() {
|
|
|
42
49
|
export var updateBridgeModelAttribute = function updateBridgeModelAttribute() {
|
|
43
50
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
44
51
|
validateOptions('updateBridgeModelAttribute', ['modelName', 'attributeName', 'bridgeModelAttribute'], options);
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
bridgeModelAttribute = options.bridgeModelAttribute;
|
|
48
|
-
return axios.put("".concat(bundle.apiLocation(), "/models/").concat(modelName, "/attributes/").concat(attributeName), bridgeModelAttribute, {
|
|
52
|
+
var bridgeModelAttribute = options.bridgeModelAttribute;
|
|
53
|
+
return axios.put(buildEndpoint(options), bridgeModelAttribute, {
|
|
49
54
|
params: paramBuilder(options),
|
|
50
55
|
headers: headerBuilder(options)
|
|
51
56
|
}).then(function (response) {
|
|
@@ -57,9 +62,7 @@ export var updateBridgeModelAttribute = function updateBridgeModelAttribute() {
|
|
|
57
62
|
export var deleteBridgeModelAttribute = function deleteBridgeModelAttribute() {
|
|
58
63
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
59
64
|
validateOptions('deleteBridgeModelAttribute', ['modelName', 'attributeName'], options);
|
|
60
|
-
|
|
61
|
-
attributeName = options.attributeName;
|
|
62
|
-
return axios["delete"]("".concat(bundle.apiLocation(), "/models/").concat(modelName, "/attributes/").concat(attributeName), {
|
|
65
|
+
return axios["delete"](buildEndpoint(options), {
|
|
63
66
|
params: paramBuilder(options),
|
|
64
67
|
headers: headerBuilder(options)
|
|
65
68
|
}).then(function (response) {
|
|
@@ -20,7 +20,7 @@ var _apiGroup = apiGroup({
|
|
|
20
20
|
url: function url(_ref2) {
|
|
21
21
|
var modelName = _ref2.modelName,
|
|
22
22
|
mappingName = _ref2.mappingName;
|
|
23
|
-
return "/models/".concat(modelName, "/mappings/").concat(mappingName);
|
|
23
|
+
return "/models/".concat(encodeURIComponent(modelName), "/mappings/").concat(encodeURIComponent(mappingName));
|
|
24
24
|
},
|
|
25
25
|
transform: function transform(response) {
|
|
26
26
|
return {
|
|
@@ -8,7 +8,7 @@ var _apiGroup = apiGroup({
|
|
|
8
8
|
url: function url(_ref) {
|
|
9
9
|
var modelName = _ref.modelName,
|
|
10
10
|
mappingName = _ref.mappingName;
|
|
11
|
-
return "/models/".concat(modelName, "/mappings/").concat(mappingName, "/qualifications");
|
|
11
|
+
return "/models/".concat(encodeURIComponent(modelName), "/mappings/").concat(encodeURIComponent(mappingName), "/qualifications");
|
|
12
12
|
},
|
|
13
13
|
transform: function transform(response) {
|
|
14
14
|
return {
|
|
@@ -22,7 +22,7 @@ var _apiGroup = apiGroup({
|
|
|
22
22
|
var modelName = _ref2.modelName,
|
|
23
23
|
mappingName = _ref2.mappingName,
|
|
24
24
|
qualificationName = _ref2.qualificationName;
|
|
25
|
-
return "/models/".concat(modelName, "/mappings/").concat(mappingName, "/qualifications/").concat(qualificationName);
|
|
25
|
+
return "/models/".concat(encodeURIComponent(modelName), "/mappings/").concat(encodeURIComponent(mappingName), "/qualifications/").concat(encodeURIComponent(qualificationName));
|
|
26
26
|
},
|
|
27
27
|
transform: function transform(response) {
|
|
28
28
|
return {
|
|
@@ -7,7 +7,7 @@ var _apiGroup = apiGroup({
|
|
|
7
7
|
requiredOptions: ['modelName'],
|
|
8
8
|
url: function url(_ref) {
|
|
9
9
|
var modelName = _ref.modelName;
|
|
10
|
-
return "/models/".concat(modelName, "/qualifications");
|
|
10
|
+
return "/models/".concat(encodeURIComponent(modelName), "/qualifications");
|
|
11
11
|
},
|
|
12
12
|
transform: function transform(response) {
|
|
13
13
|
return {
|
|
@@ -20,7 +20,7 @@ var _apiGroup = apiGroup({
|
|
|
20
20
|
url: function url(_ref2) {
|
|
21
21
|
var modelName = _ref2.modelName,
|
|
22
22
|
qualificationName = _ref2.qualificationName;
|
|
23
|
-
return "/models/".concat(modelName, "/qualifications/").concat(qualificationName);
|
|
23
|
+
return "/models/".concat(encodeURIComponent(modelName), "/qualifications/").concat(encodeURIComponent(qualificationName));
|
|
24
24
|
},
|
|
25
25
|
transform: function transform(response) {
|
|
26
26
|
return {
|
|
@@ -2,9 +2,16 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import { bundle } from '../../helpers';
|
|
4
4
|
import { handleErrors, headerBuilder, paramBuilder, validateOptions } from '../http';
|
|
5
|
+
|
|
6
|
+
var buildEndpoint = function buildEndpoint(_ref) {
|
|
7
|
+
var modelName = _ref.modelName;
|
|
8
|
+
var mn = encodeURIComponent(modelName);
|
|
9
|
+
return modelName ? "".concat(bundle.apiLocation(), "/models/").concat(mn) : "".concat(bundle.apiLocation(), "/models");
|
|
10
|
+
};
|
|
11
|
+
|
|
5
12
|
export var fetchBridgeModels = function fetchBridgeModels() {
|
|
6
13
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
-
return axios.get(
|
|
14
|
+
return axios.get(buildEndpoint(options), {
|
|
8
15
|
params: paramBuilder(options),
|
|
9
16
|
headers: headerBuilder(options)
|
|
10
17
|
}).then(function (response) {
|
|
@@ -16,7 +23,7 @@ export var fetchBridgeModels = function fetchBridgeModels() {
|
|
|
16
23
|
export var fetchBridgeModel = function fetchBridgeModel() {
|
|
17
24
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
25
|
validateOptions('fetchBridgeModel', ['modelName'], options);
|
|
19
|
-
return axios.get(
|
|
26
|
+
return axios.get(buildEndpoint(options), {
|
|
20
27
|
params: paramBuilder(options),
|
|
21
28
|
headers: headerBuilder(options)
|
|
22
29
|
}).then(function (response) {
|
|
@@ -29,8 +36,7 @@ var TEST_METHODS = ['retrieve', 'search', 'count'];
|
|
|
29
36
|
export var testBridgeModel = function testBridgeModel() {
|
|
30
37
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
31
38
|
validateOptions('testBridgeModel', ['modelName', 'qualificationName', 'method'], options);
|
|
32
|
-
var
|
|
33
|
-
qualificationName = options.qualificationName,
|
|
39
|
+
var qualificationName = options.qualificationName,
|
|
34
40
|
_options$attributes = options.attributes,
|
|
35
41
|
attributes = _options$attributes === void 0 ? [] : _options$attributes;
|
|
36
42
|
var method = TEST_METHODS.includes(options.method) ? options.method : 'retrieve';
|
|
@@ -38,7 +44,7 @@ export var testBridgeModel = function testBridgeModel() {
|
|
|
38
44
|
params["parameters[".concat(parameter.name, "]")] = parameter.value;
|
|
39
45
|
return params;
|
|
40
46
|
}, {});
|
|
41
|
-
return axios.post("".concat(
|
|
47
|
+
return axios.post("".concat(buildEndpoint(options), "/qualifications/").concat(encodeURIComponent(qualificationName), "/").concat(encodeURIComponent(method)), null, {
|
|
42
48
|
params: _objectSpread(_objectSpread({}, paramBuilder(options)), {}, {
|
|
43
49
|
attributes: attributes.join(',')
|
|
44
50
|
}, parameters),
|
|
@@ -48,7 +54,7 @@ export var testBridgeModel = function testBridgeModel() {
|
|
|
48
54
|
export var createBridgeModel = function createBridgeModel() {
|
|
49
55
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
50
56
|
validateOptions('createBridgeModel', ['bridgeModel'], options);
|
|
51
|
-
return axios.post(
|
|
57
|
+
return axios.post(buildEndpoint(options), options.bridgeModel, {
|
|
52
58
|
params: paramBuilder(options),
|
|
53
59
|
headers: headerBuilder(options)
|
|
54
60
|
}).then(function (response) {
|
|
@@ -60,7 +66,7 @@ export var createBridgeModel = function createBridgeModel() {
|
|
|
60
66
|
export var updateBridgeModel = function updateBridgeModel() {
|
|
61
67
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
62
68
|
validateOptions('updateBridgeModel', ['modelName', 'bridgeModel'], options);
|
|
63
|
-
return axios.put(
|
|
69
|
+
return axios.put(buildEndpoint(options), options.bridgeModel, {
|
|
64
70
|
params: paramBuilder(options),
|
|
65
71
|
headers: headerBuilder(options)
|
|
66
72
|
}).then(function (response) {
|
|
@@ -72,7 +78,7 @@ export var updateBridgeModel = function updateBridgeModel() {
|
|
|
72
78
|
export var deleteBridgeModel = function deleteBridgeModel() {
|
|
73
79
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
74
80
|
validateOptions('deleteBridgeModel', ['modelName'], options);
|
|
75
|
-
return axios["delete"](
|
|
81
|
+
return axios["delete"](buildEndpoint(options), {
|
|
76
82
|
params: paramBuilder(options),
|
|
77
83
|
headers: headerBuilder(options)
|
|
78
84
|
}).then(function (response) {
|
|
@@ -31,10 +31,11 @@ export var bridgedResourceUrl = function bridgedResourceUrl(options) {
|
|
|
31
31
|
|
|
32
32
|
if (!bridgedResourceName) {
|
|
33
33
|
throw new Error('Property "bridgedResourceName" is required.');
|
|
34
|
-
}
|
|
34
|
+
}
|
|
35
35
|
|
|
36
|
+
var brn = encodeURIComponent(options.bridgedResourceName); // build the url
|
|
36
37
|
|
|
37
|
-
var url = datastore ? "".concat(bundle.spaceLocation(), "/app/datastore/forms/").concat(
|
|
38
|
+
var url = datastore ? "".concat(bundle.spaceLocation(), "/app/datastore/forms/").concat(formSlug, "/bridgedResources/").concat(brn) : "".concat(bundle.spaceLocation(), "/").concat(kappSlug, "/").concat(formSlug, "/bridgedResources/").concat(brn); // append any attributes if they were specified
|
|
38
39
|
|
|
39
40
|
if (counting) {
|
|
40
41
|
url += '/count';
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { bundle } from '../../helpers';
|
|
3
3
|
import { handleErrors, headerBuilder, paramBuilder } from '../http';
|
|
4
|
+
|
|
5
|
+
var buildEndpoint = function buildEndpoint(_ref) {
|
|
6
|
+
var _ref$kappSlug = _ref.kappSlug,
|
|
7
|
+
kappSlug = _ref$kappSlug === void 0 ? bundle.kappSlug() : _ref$kappSlug,
|
|
8
|
+
name = _ref.name;
|
|
9
|
+
return name ? "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/formTypes/").concat(encodeURIComponent(name)) : "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/formTypes");
|
|
10
|
+
};
|
|
11
|
+
|
|
4
12
|
export var fetchFormTypes = function fetchFormTypes() {
|
|
5
13
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return axios.get("".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/formTypes"), {
|
|
14
|
+
// Build URL and fetch the form types.
|
|
15
|
+
return axios.get(buildEndpoint(options), {
|
|
10
16
|
params: paramBuilder(options),
|
|
11
17
|
headers: headerBuilder(options)
|
|
12
18
|
}).then(function (response) {
|
|
@@ -17,16 +23,14 @@ export var fetchFormTypes = function fetchFormTypes() {
|
|
|
17
23
|
};
|
|
18
24
|
export var fetchFormType = function fetchFormType() {
|
|
19
25
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
20
|
-
var
|
|
21
|
-
kappSlug = _options$kappSlug2 === void 0 ? bundle.kappSlug() : _options$kappSlug2,
|
|
22
|
-
name = options.name;
|
|
26
|
+
var name = options.name;
|
|
23
27
|
|
|
24
28
|
if (!name) {
|
|
25
29
|
throw new Error('fetchFormType failed! The option "name" is required.');
|
|
26
30
|
} // Build URL and fetch the form type.
|
|
27
31
|
|
|
28
32
|
|
|
29
|
-
return axios.get(
|
|
33
|
+
return axios.get(buildEndpoint(options), {
|
|
30
34
|
params: paramBuilder(options),
|
|
31
35
|
headers: headerBuilder(options)
|
|
32
36
|
}).then(function (response) {
|
|
@@ -37,16 +41,14 @@ export var fetchFormType = function fetchFormType() {
|
|
|
37
41
|
};
|
|
38
42
|
export var createFormType = function createFormType() {
|
|
39
43
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
40
|
-
var
|
|
41
|
-
kappSlug = _options$kappSlug3 === void 0 ? bundle.kappSlug() : _options$kappSlug3,
|
|
42
|
-
formType = options.formType;
|
|
44
|
+
var formType = options.formType;
|
|
43
45
|
|
|
44
46
|
if (!formType) {
|
|
45
47
|
throw new Error('createFormType failed! The option "formType" is required.');
|
|
46
48
|
} // Build URL and create the form type.
|
|
47
49
|
|
|
48
50
|
|
|
49
|
-
return axios.post(
|
|
51
|
+
return axios.post(buildEndpoint(options), formType, {
|
|
50
52
|
params: paramBuilder(options),
|
|
51
53
|
headers: headerBuilder(options)
|
|
52
54
|
}).then(function (response) {
|
|
@@ -57,9 +59,7 @@ export var createFormType = function createFormType() {
|
|
|
57
59
|
};
|
|
58
60
|
export var updateFormType = function updateFormType() {
|
|
59
61
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
60
|
-
var
|
|
61
|
-
kappSlug = _options$kappSlug4 === void 0 ? bundle.kappSlug() : _options$kappSlug4,
|
|
62
|
-
formType = options.formType,
|
|
62
|
+
var formType = options.formType,
|
|
63
63
|
name = options.name;
|
|
64
64
|
|
|
65
65
|
if (!formType) {
|
|
@@ -71,7 +71,7 @@ export var updateFormType = function updateFormType() {
|
|
|
71
71
|
} // Build URL and update the form type.
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
return axios.put(
|
|
74
|
+
return axios.put(buildEndpoint(options), formType, {
|
|
75
75
|
params: paramBuilder(options),
|
|
76
76
|
headers: headerBuilder(options)
|
|
77
77
|
}).then(function (response) {
|
|
@@ -82,11 +82,8 @@ export var updateFormType = function updateFormType() {
|
|
|
82
82
|
};
|
|
83
83
|
export var deleteFormType = function deleteFormType() {
|
|
84
84
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
name = options.name; // Build URL and delete the form type.
|
|
88
|
-
|
|
89
|
-
return axios["delete"]("".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/formTypes/").concat(name), {
|
|
85
|
+
// Build URL and delete the form type.
|
|
86
|
+
return axios["delete"](buildEndpoint(options), {
|
|
90
87
|
params: paramBuilder(options),
|
|
91
88
|
headers: headerBuilder(options)
|
|
92
89
|
}).then(function (response) {
|
|
@@ -2,9 +2,15 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import { bundle } from '../../helpers';
|
|
4
4
|
import { handleErrors, paramBuilder, headerBuilder } from '../http';
|
|
5
|
+
|
|
6
|
+
var buildEndpoint = function buildEndpoint(_ref) {
|
|
7
|
+
var clientId = _ref.clientId;
|
|
8
|
+
return clientId ? "".concat(bundle.apiLocation(), "/oauthClients/").concat(encodeURIComponent(clientId)) : "".concat(bundle.apiLocation(), "/oauthClients");
|
|
9
|
+
};
|
|
10
|
+
|
|
5
11
|
export var fetchOAuthClients = function fetchOAuthClients() {
|
|
6
12
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7
|
-
return axios.get(
|
|
13
|
+
return axios.get(buildEndpoint(options), {
|
|
8
14
|
params: _objectSpread({}, paramBuilder(options)),
|
|
9
15
|
headers: headerBuilder(options)
|
|
10
16
|
}).then(function (response) {
|
|
@@ -21,7 +27,7 @@ export var fetchOAuthClient = function fetchOAuthClient() {
|
|
|
21
27
|
throw new Error('fetchOAuthClient failed! The option "clientId" is required.');
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
return axios.get(
|
|
30
|
+
return axios.get(buildEndpoint(options), {
|
|
25
31
|
params: _objectSpread({}, paramBuilder(options)),
|
|
26
32
|
headers: headerBuilder(options)
|
|
27
33
|
}).then(function (response) {
|
|
@@ -44,7 +50,7 @@ export var updateOAuthClient = function updateOAuthClient() {
|
|
|
44
50
|
} // Build URL and fetch the space.
|
|
45
51
|
|
|
46
52
|
|
|
47
|
-
return axios.put(
|
|
53
|
+
return axios.put(buildEndpoint(options), client, {
|
|
48
54
|
params: paramBuilder(options),
|
|
49
55
|
headers: headerBuilder(options)
|
|
50
56
|
}).then(function (response) {
|
|
@@ -62,7 +68,7 @@ export var createOAuthClient = function createOAuthClient() {
|
|
|
62
68
|
} // Build URL and fetch the space.
|
|
63
69
|
|
|
64
70
|
|
|
65
|
-
return axios.post(
|
|
71
|
+
return axios.post(buildEndpoint(options), client, {
|
|
66
72
|
params: paramBuilder(options),
|
|
67
73
|
headers: headerBuilder(options)
|
|
68
74
|
}).then(function (response) {
|
|
@@ -80,7 +86,7 @@ export var deleteOAuthClient = function deleteOAuthClient() {
|
|
|
80
86
|
} // Build URL and fetch the space.
|
|
81
87
|
|
|
82
88
|
|
|
83
|
-
return axios["delete"](
|
|
89
|
+
return axios["delete"](buildEndpoint(options), {
|
|
84
90
|
params: paramBuilder(options),
|
|
85
91
|
headers: headerBuilder(options)
|
|
86
92
|
}).then(function (response) {
|
|
@@ -25,7 +25,7 @@ var buildEndpoint = function buildEndpoint(_ref) {
|
|
|
25
25
|
var kappSlug = _ref.kappSlug,
|
|
26
26
|
securityPolicyName = _ref.securityPolicyName;
|
|
27
27
|
var basePath = kappSlug ? "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/securityPolicyDefinitions") : "".concat(bundle.apiLocation(), "/securityPolicyDefinitions");
|
|
28
|
-
return securityPolicyName ? "".concat(basePath, "/").concat(securityPolicyName) : basePath;
|
|
28
|
+
return securityPolicyName ? "".concat(basePath, "/").concat(encodeURIComponent(securityPolicyName)) : basePath;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export var fetchSecurityPolicyDefinitions = function fetchSecurityPolicyDefinitions() {
|
|
@@ -577,4 +577,72 @@ export var deleteSubmission = function deleteSubmission(options) {
|
|
|
577
577
|
}) // Clean up any errors we receive. Make sure this the last thing so that it
|
|
578
578
|
// cleans up any errors.
|
|
579
579
|
["catch"](handleErrors);
|
|
580
|
+
};
|
|
581
|
+
export var exportSubmissions = function exportSubmissions(options) {
|
|
582
|
+
var kappSlug = options.kappSlug,
|
|
583
|
+
formSlug = options.formSlug,
|
|
584
|
+
onDownloadProgress = options.onDownloadProgress;
|
|
585
|
+
|
|
586
|
+
if (!kappSlug) {
|
|
587
|
+
throw new Error('exportSubmissions failed! The option "kappSlug" is required.');
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
if (!formSlug) {
|
|
591
|
+
throw new Error('exportSubmissions failed! The option "formSlug" is required.');
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
var path = "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/forms/").concat(formSlug, "/submissions-search?export");
|
|
595
|
+
return axios.post(path, {}, {
|
|
596
|
+
params: paramBuilder(options),
|
|
597
|
+
headers: headerBuilder(options),
|
|
598
|
+
onDownloadProgress: onDownloadProgress,
|
|
599
|
+
responseType: 'blob'
|
|
600
|
+
});
|
|
601
|
+
};
|
|
602
|
+
export var MODE_IMPORT = 'import';
|
|
603
|
+
export var MODE_BULK = 'bulk';
|
|
604
|
+
|
|
605
|
+
var modeToFn = function modeToFn(mode) {
|
|
606
|
+
return mode === MODE_BULK ? 'post' : 'patch';
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
export var importSubmissions = function importSubmissions(options) {
|
|
610
|
+
var kappSlug = options.kappSlug,
|
|
611
|
+
formSlug = options.formSlug,
|
|
612
|
+
onUploadProgress = options.onUploadProgress,
|
|
613
|
+
file = options.file,
|
|
614
|
+
_options$mode = options.mode,
|
|
615
|
+
mode = _options$mode === void 0 ? MODE_IMPORT : _options$mode,
|
|
616
|
+
cancelToken = options.cancelToken;
|
|
617
|
+
|
|
618
|
+
if (!kappSlug) {
|
|
619
|
+
throw new Error('importSubmissions failed! The option "kappSlug" is required.');
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
if (!formSlug) {
|
|
623
|
+
throw new Error('importSubmissions failed! The option "formSlug" is required.');
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
if (!file) {
|
|
627
|
+
throw new Error('importSubmissions failed! The option "file" is required.');
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
var path = "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/forms/").concat(formSlug, "/submissions?import");
|
|
631
|
+
return axios[modeToFn(mode)](path, file, {
|
|
632
|
+
cancelToken: cancelToken,
|
|
633
|
+
data: file,
|
|
634
|
+
params: paramBuilder(options),
|
|
635
|
+
headers: _objectSpread(_objectSpread({}, headerBuilder(options)), {}, {
|
|
636
|
+
'Content-Type': 'application/csv'
|
|
637
|
+
}),
|
|
638
|
+
onUploadProgress: onUploadProgress
|
|
639
|
+
}).then(function (response) {
|
|
640
|
+
return response.data;
|
|
641
|
+
})["catch"](function (error) {
|
|
642
|
+
if (error.response && error.response.data && error.response.data.errors) {
|
|
643
|
+
return error.response.data;
|
|
644
|
+
} else {
|
|
645
|
+
return handleErrors(error);
|
|
646
|
+
}
|
|
647
|
+
});
|
|
580
648
|
};
|
|
@@ -24,7 +24,7 @@ var buildEndpoint = function buildEndpoint(_ref) {
|
|
|
24
24
|
var kappSlug = _ref.kappSlug,
|
|
25
25
|
webhookName = _ref.webhookName;
|
|
26
26
|
var basePath = kappSlug ? "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/webhooks") : "".concat(bundle.apiLocation(), "/webhooks");
|
|
27
|
-
return webhookName ? "".concat(basePath, "/").concat(webhookName) : basePath;
|
|
27
|
+
return webhookName ? "".concat(basePath, "/").concat(encodeURIComponent(webhookName)) : basePath;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export var fetchWebhooks = function fetchWebhooks() {
|
|
@@ -185,7 +185,7 @@ describe('webhooks api', function () {
|
|
|
185
185
|
|
|
186
186
|
case 3:
|
|
187
187
|
result = _context4.sent;
|
|
188
|
-
expect(axios.get.mock.calls).toEqual([['space/app/api/v1/webhooks/Test
|
|
188
|
+
expect(axios.get.mock.calls).toEqual([['space/app/api/v1/webhooks/Test%20Webhook%20Name', {
|
|
189
189
|
params: {},
|
|
190
190
|
headers: {
|
|
191
191
|
'X-Kinetic-AuthAssumed': 'true'
|
|
@@ -391,7 +391,7 @@ describe('webhooks api', function () {
|
|
|
391
391
|
|
|
392
392
|
case 3:
|
|
393
393
|
result = _context7.sent;
|
|
394
|
-
expect(axios.put.mock.calls).toEqual([['space/app/api/v1/webhooks/Test
|
|
394
|
+
expect(axios.put.mock.calls).toEqual([['space/app/api/v1/webhooks/Test%20Webhook%20Name', {
|
|
395
395
|
authStrategy: null,
|
|
396
396
|
event: 'Login Failure',
|
|
397
397
|
filter: '',
|
package/lib/apis/http.js
CHANGED
|
@@ -17,6 +17,12 @@ export var handleErrors = function handleErrors(error) {
|
|
|
17
17
|
// make a mistake in a `then` block in one of our api functions.
|
|
18
18
|
if (error instanceof Error && !error.response) {
|
|
19
19
|
throw error;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (axios.isCancel(error)) {
|
|
23
|
+
return {
|
|
24
|
+
error: 'Canceled by user request.'
|
|
25
|
+
};
|
|
20
26
|
} // Destructure out the information needed.
|
|
21
27
|
|
|
22
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kineticdata/react",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "A React library for the Kinetic Platform",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"main:src": "src/index.js",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"eslintConfig": {
|
|
93
93
|
"extends": "react-app"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "d53f237edee36bdd6ed9ce00734dbdf045ea3f5b"
|
|
96
96
|
}
|