@kineticdata/react 6.0.0 → 6.0.2
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/agent/adapters.js +2 -3
- package/lib/apis/agent/bridges.js +7 -13
- package/lib/apis/agent/handlers.js +7 -13
- package/lib/apis/core/activity.js +2 -3
- package/lib/apis/core/attributeDefinitions.js +6 -11
- package/lib/apis/core/attributeDefinitions.test.js +201 -213
- package/lib/apis/core/authentication.js +74 -84
- package/lib/apis/core/backgroundJobs.js +5 -9
- package/lib/apis/core/bridgeModelAttributeMappings.js +5 -10
- package/lib/apis/core/bridgeModelAttributes.js +6 -11
- package/lib/apis/core/bridgeModelMappings.js +5 -10
- package/lib/apis/core/bridgeModelQualificationMappings.js +5 -10
- package/lib/apis/core/bridgeModelQualifications.js +5 -10
- package/lib/apis/core/bridgeModels.js +7 -13
- package/lib/apis/core/bridgeModels.test.js +313 -333
- package/lib/apis/core/bridgedresources.js +7 -13
- package/lib/apis/core/categories.js +6 -11
- package/lib/apis/core/fileResources.js +5 -10
- package/lib/apis/core/filestores.js +5 -10
- package/lib/apis/core/formTypes.js +6 -11
- package/lib/apis/core/forms.js +6 -11
- package/lib/apis/core/forms.test.js +201 -213
- package/lib/apis/core/kapps.js +6 -11
- package/lib/apis/core/kapps.test.js +122 -130
- package/lib/apis/core/logs.js +3 -5
- package/lib/apis/core/memberships.js +3 -5
- package/lib/apis/core/meta.js +6 -11
- package/lib/apis/core/notices.js +2 -3
- package/lib/apis/core/oauthClients.js +6 -11
- package/lib/apis/core/platformComponents.js +10 -19
- package/lib/apis/core/platformItems.js +2 -3
- package/lib/apis/core/profile.js +3 -5
- package/lib/apis/core/securityPolicyDefinitions.js +6 -11
- package/lib/apis/core/securityPolicyDefinitions.test.js +254 -268
- package/lib/apis/core/space.js +3 -5
- package/lib/apis/core/space.test.js +106 -114
- package/lib/apis/core/submissions.js +17 -33
- package/lib/apis/core/teams.js +6 -11
- package/lib/apis/core/translations.js +18 -35
- package/lib/apis/core/translations.test.js +1343 -1437
- package/lib/apis/core/users.js +6 -11
- package/lib/apis/core/version.js +2 -3
- package/lib/apis/core/webApis.js +5 -10
- package/lib/apis/core/webhooks.js +6 -11
- package/lib/apis/core/webhooks.test.js +243 -257
- package/lib/apis/core/webhooksJobs.js +3 -5
- package/lib/apis/core/workflows.js +7 -13
- package/lib/apis/http.js +47 -30
- package/lib/apis/http.test.js +100 -0
- package/lib/apis/system/index.js +167 -81
- package/lib/apis/task/index.js +73 -118
- package/lib/components/agent/bridge/BridgeForm.js +1 -2
- package/lib/components/agent/bridge/BridgeTable.js +5 -3
- package/lib/components/agent/filestore/FilestoreForm.js +1 -2
- package/lib/components/agent/filestore/FilestoreTable.js +5 -3
- package/lib/components/agent/handler/AgentHandlerForm.js +1 -2
- package/lib/components/agent/handler/AgentHandlerTable.js +6 -4
- package/lib/components/common/AttributeSelect.js +2 -3
- package/lib/components/common/BridgeSelect.js +16 -17
- package/lib/components/common/ComponentConfigContext.js +1 -2
- package/lib/components/common/ContentEditable.js +23 -3
- package/lib/components/common/FormSelect.js +16 -17
- package/lib/components/common/NodeSelect.js +2 -3
- package/lib/components/common/Scroller.js +2 -3
- package/lib/components/common/StaticSelect.js +14 -15
- package/lib/components/common/TableInput.js +276 -63
- package/lib/components/common/TeamSelect.js +16 -17
- package/lib/components/common/ToastContainer.js +165 -0
- package/lib/components/common/Typeahead.js +15 -2
- package/lib/components/common/UserSelect.js +16 -17
- package/lib/components/common/authentication/AuthInterceptor.js +2 -3
- package/lib/components/common/authentication/AuthInterceptor.test.js +141 -153
- package/lib/components/common/authentication/AuthenticationContainer.js +332 -343
- package/lib/components/common/authentication/RequestInterceptor.js +2 -10
- package/lib/components/common/code_input/CodeInput.js +4 -9
- package/lib/components/common/code_input/draftHelpers.js +20 -37
- package/lib/components/common/code_input/languageHelpers.js +6 -12
- package/lib/components/common/code_input/languageHelpers.test.js +10 -8
- package/lib/components/common/defaults/Toast.js +25 -0
- package/lib/components/common/defaults/index.js +12 -0
- package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +1 -2
- package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +8 -5
- package/lib/components/core/bridge_model/BridgeModelForm.js +52 -55
- package/lib/components/core/bridge_model/BridgeModelTable.js +6 -4
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +1 -2
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +1 -2
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +1 -2
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +1 -2
- package/lib/components/core/category/CategoryForm.js +1 -2
- package/lib/components/core/category/CategoryTable.js +14 -8
- package/lib/components/core/core_form/CoreForm.js +11 -22
- package/lib/components/core/core_form/defaults/index.js +11 -19
- package/lib/components/core/core_form/globals.js +3 -5
- package/lib/components/core/field_definition/FieldDefinitionForm.js +1 -2
- package/lib/components/core/field_definition/FieldDefinitionTable.js +13 -9
- package/lib/components/core/file_resource/FileResourceForm.js +1 -2
- package/lib/components/core/file_resource/FileResourceTable.js +1 -2
- package/lib/components/core/form/FormForm.js +1 -2
- package/lib/components/core/form/FormTable.js +23 -13
- package/lib/components/core/form_type/FormTypeForm.js +1 -2
- package/lib/components/core/form_type/FormTypeTable.js +4 -3
- package/lib/components/core/i18n/I18n.js +2 -4
- package/lib/components/core/i18n/I18nContext.js +1 -2
- package/lib/components/core/i18n/I18nProvider.js +2 -3
- package/lib/components/core/i18n/Moment.js +10 -9
- package/lib/components/core/index_definition/IndexDefinitionForm.js +1 -2
- package/lib/components/core/index_definition/IndexDefinitionTable.js +13 -7
- package/lib/components/core/index_job/IndexJobTable.js +1 -2
- package/lib/components/core/kapp/KappForm.js +1 -2
- package/lib/components/core/kapp/KappTable.js +18 -34
- package/lib/components/core/log/LogTable.js +10 -6
- package/lib/components/core/oauth_client/OAuthClientForm.js +1 -2
- package/lib/components/core/oauth_client/OAuthClientTable.js +1 -2
- package/lib/components/core/platform_component/AgentComponentForm.js +1 -2
- package/lib/components/core/platform_component/AgentComponentTable.js +1 -2
- package/lib/components/core/platform_component/TaskComponentForm.js +1 -2
- package/lib/components/core/profile/ProfileForm.js +1 -2
- package/lib/components/core/security_definition/SecurityDefinitionForm.js +3 -6
- package/lib/components/core/security_definition/SecurityDefinitionTable.js +10 -6
- package/lib/components/core/space/SpaceForm.js +1 -2
- package/lib/components/core/submission/DatastoreSubmissionFilters.js +3 -5
- package/lib/components/core/submission/DatastoreSubmissionTable.js +2 -4
- package/lib/components/core/submission/FormSubmissionFilters.js +4 -7
- package/lib/components/core/submission/FormSubmissionTable.js +39 -23
- package/lib/components/core/submission/KappSubmissionTable.js +39 -23
- package/lib/components/core/submission/SubmissionForm.js +1 -2
- package/lib/components/core/submission/SubmissionTable.js +2 -3
- package/lib/components/core/submission/helpers.js +4 -7
- package/lib/components/core/team/TeamForm.js +2 -3
- package/lib/components/core/team/TeamTable.js +12 -7
- package/lib/components/core/translation/ContextForm.js +1 -2
- package/lib/components/core/translation/ContextTable.js +1 -2
- package/lib/components/core/translation/EntryForm.js +1 -2
- package/lib/components/core/translation/EntryTable.js +1 -2
- package/lib/components/core/translation/LocaleForm.js +1 -2
- package/lib/components/core/translation/LocaleTable.js +1 -2
- package/lib/components/core/user/UserForm.js +1 -2
- package/lib/components/core/user/UserTable.js +24 -7
- package/lib/components/core/webapi/WebApiForm.js +138 -123
- package/lib/components/core/webapi/WebApiTable.js +15 -9
- package/lib/components/core/webhook/WebhookForm.js +1 -2
- package/lib/components/core/webhook/WebhookTable.js +20 -11
- package/lib/components/core/webhook_job/WebhookJobTable.js +40 -21
- package/lib/components/form/Form.helpers.js +91 -38
- package/lib/components/form/Form.js +312 -355
- package/lib/components/form/Form.models.js +7 -11
- package/lib/components/form/FormState.js +1 -2
- package/lib/components/form/KitchenSinkForm.js +23 -3
- package/lib/components/form/SimpleForm.helpers.js +262 -0
- package/lib/components/form/SimpleForm.js +462 -0
- package/lib/components/form/SimpleForm.models.js +62 -0
- package/lib/components/form/defaults/AttributesField.js +3 -4
- package/lib/components/form/defaults/CheckboxField.js +2 -3
- package/lib/components/form/defaults/CodeField.js +2 -3
- package/lib/components/form/defaults/FormButtons.js +2 -3
- package/lib/components/form/defaults/FormError.js +2 -3
- package/lib/components/form/defaults/FormField.js +2 -3
- package/lib/components/form/defaults/FormLayout.js +2 -3
- package/lib/components/form/defaults/FormMultiField.js +2 -3
- package/lib/components/form/defaults/PasswordField.js +2 -3
- package/lib/components/form/defaults/RadioField.js +2 -3
- package/lib/components/form/defaults/SampleTeamsRolesFIeld.js +2 -3
- package/lib/components/form/defaults/SelectField.js +2 -3
- package/lib/components/form/defaults/SelectMultiField.js +2 -3
- package/lib/components/form/defaults/TableField.js +2 -3
- package/lib/components/form/defaults/TeamField.js +2 -3
- package/lib/components/form/defaults/TeamMultiField.js +2 -3
- package/lib/components/form/defaults/TextField.js +2 -3
- package/lib/components/form/defaults/TextMultiField.js +2 -3
- package/lib/components/form/defaults/UserField.js +2 -3
- package/lib/components/form/defaults/UserMultiField.js +2 -3
- package/lib/components/form/defaults/index.js +2 -3
- package/lib/components/form/tests/Form.test.js +3865 -4257
- package/lib/components/form/tests/components.js +2 -3
- package/lib/components/index.js +60 -0
- package/lib/components/system/SystemBackgroundTasksTable.js +1 -2
- package/lib/components/system/SystemCassandraForm.js +97 -0
- package/lib/components/system/SystemElasticSearchForm.js +97 -0
- package/lib/components/system/SystemFilestoreForm.js +12 -8
- package/lib/components/system/SystemForm.js +1 -2
- package/lib/components/system/SystemIngressForm.js +78 -31
- package/lib/components/system/SystemSecurityForm.js +1 -2
- package/lib/components/system/SystemSmtpForm.js +1 -2
- package/lib/components/system/SystemTaskAdapterForm.js +30 -7
- package/lib/components/system/SystemTrustedCertificateForm.js +39 -0
- package/lib/components/system/SystemTrustedCertificatesTable.js +73 -0
- package/lib/components/system/SystemUserForm.js +1 -2
- package/lib/components/system/helpers.js +236 -65
- package/lib/components/system/spaces/SystemSpaceForm.js +2 -3
- package/lib/components/system/spaces/SystemTenantForm.js +77 -37
- package/lib/components/system/spaces/SystemTenantTable.js +1 -2
- package/lib/components/table/Table.js +132 -54
- package/lib/components/table/Table.redux.js +229 -235
- package/lib/components/table/Table.test.js +154 -123
- package/lib/components/table/defaults/BodyCell.js +1 -2
- package/lib/components/table/defaults/BodyRow.js +1 -2
- package/lib/components/table/defaults/BooleanFilter.js +1 -2
- package/lib/components/table/defaults/ColumnControl.js +25 -0
- package/lib/components/table/defaults/EmptyBodyRow.js +1 -2
- package/lib/components/table/defaults/FilterLayout.js +1 -2
- package/lib/components/table/defaults/Footer.js +1 -2
- package/lib/components/table/defaults/FooterCell.js +1 -2
- package/lib/components/table/defaults/FooterRow.js +1 -2
- package/lib/components/table/defaults/Header.js +1 -2
- package/lib/components/table/defaults/HeaderCell.js +1 -2
- package/lib/components/table/defaults/HeaderRow.js +1 -2
- package/lib/components/table/defaults/PaginationControl.js +2 -4
- package/lib/components/table/defaults/TableBody.js +1 -2
- package/lib/components/table/defaults/TableLayout.js +1 -2
- package/lib/components/table/defaults/TextFilter.js +1 -2
- package/lib/components/table/defaults/index.js +5 -4
- package/lib/components/task/builder/Connector.js +26 -11
- package/lib/components/task/builder/ConnectorForm.js +1 -2
- package/lib/components/task/builder/Node.js +18 -9
- package/lib/components/task/builder/NodeForm.js +1 -2
- package/lib/components/task/builder/NodeParametersForm.js +1 -2
- package/lib/components/task/builder/SvgCanvas.js +2 -3
- package/lib/components/task/builder/SvgText.js +2 -3
- package/lib/components/task/builder/TaskDefinitionConfigForm.js +3 -6
- package/lib/components/task/builder/TreeBuilder.js +10 -4
- package/lib/components/task/builder/builder.redux.js +171 -182
- package/lib/components/task/builder/constants.js +38 -76
- package/lib/components/task/builder/helpers.js +23 -40
- package/lib/components/task/builder/models.js +19 -35
- package/lib/components/task/category/TaskCategoryForm.js +2 -3
- package/lib/components/task/category/TaskCategoryTable.js +1 -2
- package/lib/components/task/common/UsageTable.js +1 -2
- package/lib/components/task/engine/EngineSettingsForm.js +2 -3
- package/lib/components/task/errors/RunErrorTable.js +35 -17
- package/lib/components/task/errors/SystemErrorsTable.js +1 -2
- package/lib/components/task/handlers/HandlerForm.js +2 -3
- package/lib/components/task/handlers/HandlerTable.js +24 -13
- package/lib/components/task/handlers/MissingHandlerTable.js +1 -2
- package/lib/components/task/policy_rule/PolicyRuleForm.js +2 -3
- package/lib/components/task/policy_rule/PolicyRuleTable.js +1 -2
- package/lib/components/task/runs/CreateManualTriggerForm.js +1 -2
- package/lib/components/task/runs/RunTable.js +24 -12
- package/lib/components/task/runs/RunTaskTable.js +1 -2
- package/lib/components/task/sources/SourceForm.js +1 -2
- package/lib/components/task/sources/SourceTable.js +16 -9
- package/lib/components/task/triggers/TriggerTable.js +52 -26
- package/lib/components/task/workflows/LinkedWorkflowForm.js +3 -5
- package/lib/components/task/workflows/LinkedWorkflowTable.js +33 -18
- package/lib/components/task/workflows/MissingRoutineTable.js +1 -2
- package/lib/components/task/workflows/WorkflowForm.js +2 -3
- package/lib/components/task/workflows/WorkflowTable.js +31 -17
- package/lib/helpers/SearchBuilder.js +2 -4
- package/lib/helpers/index.js +13 -26
- package/lib/index.js +7 -9
- package/lib/reducer.js +3 -5
- package/lib/saga.js +32 -48
- package/lib/store.js +32 -42
- package/package.json +26 -16
- package/proxyhelper.js +17 -11
- package/lib/components/core/CoreFormModal.js +0 -64
- package/lib/components/core/CoreModal.js +0 -114
package/lib/apis/http.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.validateOptions = exports.transformCoreResult = exports.submissionPath = exports.paramBuilder = exports.operations = exports.headerBuilder = exports.handleErrors = exports.generateSortParams = exports.generatePaginationParams = exports.generateCESearchParams = exports.formPath = exports.corePath = exports.apiGroup = exports.apiFunction = void 0;
|
|
7
|
+
exports.validateOptions = exports.transformCoreResult = exports.submissionPath = exports.paramBuilder = exports.operations = exports.headerBuilder = exports.handleErrors = exports.generateSortParams = exports.generatePaginationParams = exports.generateCESearchParams = exports.formPath = exports.formDataBuilder = exports.corePath = exports.apiGroup = exports.apiFunction = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
@@ -20,7 +20,7 @@ var types = {
|
|
|
20
20
|
404: 'notFound',
|
|
21
21
|
405: 'methodNotAllowed'
|
|
22
22
|
};
|
|
23
|
-
var handleErrors = function handleErrors(error) {
|
|
23
|
+
var handleErrors = exports.handleErrors = function handleErrors(error) {
|
|
24
24
|
// handle a javascript runtime exception by re-throwing it, this is in case we
|
|
25
25
|
// make a mistake in a `then` block in one of our api functions.
|
|
26
26
|
if (error instanceof Error && !error.response) {
|
|
@@ -67,8 +67,7 @@ var handleErrors = function handleErrors(error) {
|
|
|
67
67
|
error: result
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
|
-
exports.
|
|
71
|
-
var paramBuilder = function paramBuilder(options) {
|
|
70
|
+
var paramBuilder = exports.paramBuilder = function paramBuilder(options) {
|
|
72
71
|
var params = {};
|
|
73
72
|
if (options.include) params.include = options.include;
|
|
74
73
|
if (options.limit >= 0) params.limit = options.limit;
|
|
@@ -82,16 +81,45 @@ var paramBuilder = function paramBuilder(options) {
|
|
|
82
81
|
if (options.count) params.count = options.count;
|
|
83
82
|
return params;
|
|
84
83
|
};
|
|
85
|
-
exports.
|
|
86
|
-
var headerBuilder = function headerBuilder(options) {
|
|
84
|
+
var headerBuilder = exports.headerBuilder = function headerBuilder(options) {
|
|
87
85
|
var headers = {};
|
|
88
86
|
if (!options["public"]) {
|
|
89
87
|
headers['X-Kinetic-AuthAssumed'] = 'true';
|
|
90
88
|
}
|
|
91
89
|
return headers;
|
|
92
90
|
};
|
|
93
|
-
exports.
|
|
94
|
-
var
|
|
91
|
+
var formDataBuilder = exports.formDataBuilder = function formDataBuilder(data, prefix) {
|
|
92
|
+
var formData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new FormData();
|
|
93
|
+
return Object.keys(data).reduce(function (result, property) {
|
|
94
|
+
// Reduce the data object into a FormData object
|
|
95
|
+
if (Array.isArray(data[property])) {
|
|
96
|
+
// If value of property is an array of non-file objects, recursively add
|
|
97
|
+
// each object in the array
|
|
98
|
+
if (data[property].some(function (value) {
|
|
99
|
+
return typeof value === 'object' && !(value instanceof File);
|
|
100
|
+
})) {
|
|
101
|
+
data[property].forEach(function (value, index) {
|
|
102
|
+
return formDataBuilder(value, prefix ? "".concat(prefix, "[").concat(property, "][").concat(index, "]") : "".concat(property, "[").concat(index, "]"), result);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
// If it's an array of other types, add each value
|
|
106
|
+
else {
|
|
107
|
+
data[property].forEach(function (value) {
|
|
108
|
+
return result.append(prefix ? "".concat(prefix, "[").concat(property, "]") : property, value);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
} else if (typeof data[property] === 'object' && !(data[property] instanceof File)) {
|
|
112
|
+
// If value of property is an object that's not a file, append the
|
|
113
|
+
// object's nested properties recursively
|
|
114
|
+
formDataBuilder(data[property], prefix ? "".concat(prefix, "[").concat(property, "]") : property, result);
|
|
115
|
+
} else {
|
|
116
|
+
// Otherwise append the value
|
|
117
|
+
result.set(prefix ? "".concat(prefix, "[").concat(property, "]") : property, data[property]);
|
|
118
|
+
}
|
|
119
|
+
return result;
|
|
120
|
+
}, formData);
|
|
121
|
+
};
|
|
122
|
+
var validateOptions = exports.validateOptions = function validateOptions(functionName, requiredOptions, options) {
|
|
95
123
|
var missing = requiredOptions.filter(function (requiredOption) {
|
|
96
124
|
return !options[requiredOption];
|
|
97
125
|
});
|
|
@@ -99,8 +127,7 @@ var validateOptions = function validateOptions(functionName, requiredOptions, op
|
|
|
99
127
|
throw new Error("".concat(functionName, " failed! The following required options are missing: ").concat(missing));
|
|
100
128
|
}
|
|
101
129
|
};
|
|
102
|
-
exports.
|
|
103
|
-
var apiFunction = function apiFunction(_ref) {
|
|
130
|
+
var apiFunction = exports.apiFunction = function apiFunction(_ref) {
|
|
104
131
|
var name = _ref.name,
|
|
105
132
|
method = _ref.method,
|
|
106
133
|
dataOption = _ref.dataOption,
|
|
@@ -120,8 +147,7 @@ var apiFunction = function apiFunction(_ref) {
|
|
|
120
147
|
}).then(transform)["catch"](handleErrors);
|
|
121
148
|
};
|
|
122
149
|
};
|
|
123
|
-
exports.
|
|
124
|
-
var apiGroup = function apiGroup(_ref2) {
|
|
150
|
+
var apiGroup = exports.apiGroup = function apiGroup(_ref2) {
|
|
125
151
|
var _ref3;
|
|
126
152
|
var dataOption = _ref2.dataOption,
|
|
127
153
|
name = _ref2.name,
|
|
@@ -148,20 +174,17 @@ var apiGroup = function apiGroup(_ref2) {
|
|
|
148
174
|
method: 'delete'
|
|
149
175
|
}, singular))), _ref3;
|
|
150
176
|
};
|
|
151
|
-
exports.
|
|
152
|
-
var formPath = function formPath(_ref4) {
|
|
177
|
+
var formPath = exports.formPath = function formPath(_ref4) {
|
|
153
178
|
var form = _ref4.form,
|
|
154
179
|
kapp = _ref4.kapp;
|
|
155
180
|
return !kapp ? form ? "".concat(_helpers.bundle.spaceLocation(), "/app/forms/").concat(form) : "".concat(_helpers.bundle.spaceLocation(), "/app/forms") : form ? "".concat(_helpers.bundle.spaceLocation(), "/").concat(kapp || _helpers.bundle.kappSlug(), "/").concat(form) : "".concat(_helpers.bundle.spaceLocation(), "/").concat(kapp || _helpers.bundle.kappSlug());
|
|
156
181
|
};
|
|
157
|
-
exports.
|
|
158
|
-
var submissionPath = function submissionPath(_ref5) {
|
|
182
|
+
var submissionPath = exports.submissionPath = function submissionPath(_ref5) {
|
|
159
183
|
var submission = _ref5.submission,
|
|
160
184
|
datastore = _ref5.datastore;
|
|
161
185
|
return datastore ? submission ? "".concat(_helpers.bundle.spaceLocation(), "/app/datastore/submissions/").concat(submission) : "".concat(_helpers.bundle.spaceLocation(), "/app/datastore/submissions") : submission ? "".concat(_helpers.bundle.spaceLocation(), "/submissions/").concat(submission) : "".concat(_helpers.bundle.spaceLocation(), "/submissions");
|
|
162
186
|
};
|
|
163
|
-
exports.
|
|
164
|
-
var corePath = function corePath(_ref6) {
|
|
187
|
+
var corePath = exports.corePath = function corePath(_ref6) {
|
|
165
188
|
var submission = _ref6.submission,
|
|
166
189
|
kapp = _ref6.kapp,
|
|
167
190
|
form = _ref6.form,
|
|
@@ -174,8 +197,7 @@ var corePath = function corePath(_ref6) {
|
|
|
174
197
|
kapp: kapp
|
|
175
198
|
});
|
|
176
199
|
};
|
|
177
|
-
exports.
|
|
178
|
-
var operations = (0, _immutable.Map)({
|
|
200
|
+
var operations = exports.operations = (0, _immutable.Map)({
|
|
179
201
|
startsWith: function startsWith(field, value) {
|
|
180
202
|
return "".concat(field, " =* \"").concat(value, "\"");
|
|
181
203
|
},
|
|
@@ -203,7 +225,6 @@ var operations = (0, _immutable.Map)({
|
|
|
203
225
|
return "".concat(field, " BETWEEN (\"").concat(value.get(0), "\", \"").concat(value.get(1), "\")");
|
|
204
226
|
}
|
|
205
227
|
});
|
|
206
|
-
exports.operations = operations;
|
|
207
228
|
var searchFilters = function searchFilters(filters) {
|
|
208
229
|
var q = (0, _immutable.Map)(filters).filter(function (filter) {
|
|
209
230
|
return filter.getIn(['value'], '') !== '';
|
|
@@ -216,7 +237,7 @@ var searchFilters = function searchFilters(filters) {
|
|
|
216
237
|
q: q
|
|
217
238
|
} : {};
|
|
218
239
|
};
|
|
219
|
-
var generateSortParams = function generateSortParams(_ref7) {
|
|
240
|
+
var generateSortParams = exports.generateSortParams = function generateSortParams(_ref7) {
|
|
220
241
|
var sortColumn = _ref7.sortColumn,
|
|
221
242
|
sortDirection = _ref7.sortDirection;
|
|
222
243
|
return sortColumn ? {
|
|
@@ -224,8 +245,7 @@ var generateSortParams = function generateSortParams(_ref7) {
|
|
|
224
245
|
direction: sortDirection
|
|
225
246
|
} : {};
|
|
226
247
|
};
|
|
227
|
-
exports.
|
|
228
|
-
var generatePaginationParams = function generatePaginationParams(_ref8) {
|
|
248
|
+
var generatePaginationParams = exports.generatePaginationParams = function generatePaginationParams(_ref8) {
|
|
229
249
|
var pageSize = _ref8.pageSize,
|
|
230
250
|
nextPageToken = _ref8.nextPageToken;
|
|
231
251
|
return pageSize && nextPageToken ? {
|
|
@@ -235,14 +255,13 @@ var generatePaginationParams = function generatePaginationParams(_ref8) {
|
|
|
235
255
|
limit: pageSize
|
|
236
256
|
} : {};
|
|
237
257
|
};
|
|
238
|
-
exports.generatePaginationParams = generatePaginationParams;
|
|
239
258
|
var sortParams = function sortParams(sortColumn, sortDirection) {
|
|
240
259
|
return sortColumn ? {
|
|
241
260
|
orderBy: sortColumn,
|
|
242
261
|
direction: sortDirection
|
|
243
262
|
} : {};
|
|
244
263
|
};
|
|
245
|
-
var generateCESearchParams = function generateCESearchParams(_ref9) {
|
|
264
|
+
var generateCESearchParams = exports.generateCESearchParams = function generateCESearchParams(_ref9) {
|
|
246
265
|
var pageSize = _ref9.pageSize,
|
|
247
266
|
filters = _ref9.filters,
|
|
248
267
|
sortColumn = _ref9.sortColumn,
|
|
@@ -253,8 +272,7 @@ var generateCESearchParams = function generateCESearchParams(_ref9) {
|
|
|
253
272
|
pageToken: nextPageToken
|
|
254
273
|
}, searchFilters(filters)), sortParams(sortColumn, sortDirection));
|
|
255
274
|
};
|
|
256
|
-
exports.
|
|
257
|
-
var transformCoreResult = function transformCoreResult(envelope) {
|
|
275
|
+
var transformCoreResult = exports.transformCoreResult = function transformCoreResult(envelope) {
|
|
258
276
|
return function (result, paramData) {
|
|
259
277
|
var count = paramData.nextPageToken ? result.count + paramData.pageTokens.size * paramData.pageSize : result.count;
|
|
260
278
|
return {
|
|
@@ -263,5 +281,4 @@ var transformCoreResult = function transformCoreResult(envelope) {
|
|
|
263
281
|
count: count
|
|
264
282
|
};
|
|
265
283
|
};
|
|
266
|
-
};
|
|
267
|
-
exports.transformCoreResult = transformCoreResult;
|
|
284
|
+
};
|
package/lib/apis/http.test.js
CHANGED
|
@@ -162,4 +162,104 @@ describe('http module', function () {
|
|
|
162
162
|
expect(op('field', (0, _immutable.List)(['v1', 'v2']))).toEqual('field IN ("v1", "v2")');
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
|
+
|
|
166
|
+
// The `paramBuilder` only strips out unnecessary options.
|
|
167
|
+
describe('#formDataBuilder', function () {
|
|
168
|
+
test('simple values only', function () {
|
|
169
|
+
var data = {
|
|
170
|
+
name: 'foo'
|
|
171
|
+
};
|
|
172
|
+
var formData = (0, _http.formDataBuilder)(data);
|
|
173
|
+
expect(formData.getAll('name')).toContain('foo');
|
|
174
|
+
});
|
|
175
|
+
test('with array values', function () {
|
|
176
|
+
var data = {
|
|
177
|
+
name: ['foo', 'bar']
|
|
178
|
+
};
|
|
179
|
+
var formData = (0, _http.formDataBuilder)(data);
|
|
180
|
+
expect(formData.getAll('name')).toContain('foo');
|
|
181
|
+
expect(formData.getAll('name')).toContain('bar');
|
|
182
|
+
});
|
|
183
|
+
test('with array of objects', function () {
|
|
184
|
+
var data = {
|
|
185
|
+
array: [{
|
|
186
|
+
name: 'foo'
|
|
187
|
+
}, {
|
|
188
|
+
name: 'bar'
|
|
189
|
+
}]
|
|
190
|
+
};
|
|
191
|
+
var formData = (0, _http.formDataBuilder)(data);
|
|
192
|
+
expect(formData.getAll('array[0][name]')).toContain('foo');
|
|
193
|
+
expect(formData.getAll('array[1][name]')).toContain('bar');
|
|
194
|
+
});
|
|
195
|
+
test('with File', function () {
|
|
196
|
+
var data = {
|
|
197
|
+
file: new File(['test'], 'test')
|
|
198
|
+
};
|
|
199
|
+
var formData = (0, _http.formDataBuilder)(data);
|
|
200
|
+
expect(formData.get('file') instanceof File).toBeTruthy();
|
|
201
|
+
});
|
|
202
|
+
test('with multiple Files', function () {
|
|
203
|
+
var data = {
|
|
204
|
+
files: [new File(['test'], 'test'), new File(['test2'], 'test2')]
|
|
205
|
+
};
|
|
206
|
+
var formData = (0, _http.formDataBuilder)(data);
|
|
207
|
+
expect(formData.getAll('files')[0] instanceof File).toBeTruthy();
|
|
208
|
+
expect(formData.getAll('files')[1] instanceof File).toBeTruthy();
|
|
209
|
+
});
|
|
210
|
+
test('nested values', function () {
|
|
211
|
+
var data = {
|
|
212
|
+
name: 'foo',
|
|
213
|
+
child: {
|
|
214
|
+
name: 'bar'
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
var formData = (0, _http.formDataBuilder)(data);
|
|
218
|
+
expect(formData.getAll('name')).toContain('foo');
|
|
219
|
+
expect(formData.get('child')).toBeNull();
|
|
220
|
+
expect(formData.getAll('child[name]')).toContain('bar');
|
|
221
|
+
});
|
|
222
|
+
test('nested values with array', function () {
|
|
223
|
+
var data = {
|
|
224
|
+
child: {
|
|
225
|
+
name: ['bar', 'baz']
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
var formData = (0, _http.formDataBuilder)(data);
|
|
229
|
+
expect(formData.getAll('child[name]')).toContain('bar');
|
|
230
|
+
expect(formData.getAll('child[name]')).toContain('baz');
|
|
231
|
+
});
|
|
232
|
+
test('nested values with File', function () {
|
|
233
|
+
var data = {
|
|
234
|
+
child: {
|
|
235
|
+
file: new File(['test'], 'test')
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
var formData = (0, _http.formDataBuilder)(data);
|
|
239
|
+
expect(formData.get('child[file]') instanceof File).toBeTruthy();
|
|
240
|
+
});
|
|
241
|
+
test('deeply nested data', function () {
|
|
242
|
+
var data = {
|
|
243
|
+
name: 'foo',
|
|
244
|
+
child: {
|
|
245
|
+
array: ['bar', 'baz'],
|
|
246
|
+
sub: {
|
|
247
|
+
file: new File(['test'], 'test'),
|
|
248
|
+
last: {
|
|
249
|
+
slug: 'foobar'
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var formData = (0, _http.formDataBuilder)(data);
|
|
255
|
+
expect(formData.getAll('name')).toContain('foo');
|
|
256
|
+
expect(formData.get('child')).toBeNull();
|
|
257
|
+
expect(formData.getAll('child[array]')).toContain('bar');
|
|
258
|
+
expect(formData.getAll('child[array]')).toContain('baz');
|
|
259
|
+
expect(formData.get('child[sub]')).toBeNull();
|
|
260
|
+
expect(formData.get('child[sub][file]') instanceof File).toBeTruthy();
|
|
261
|
+
expect(formData.get('child[sub][last]')).toBeNull();
|
|
262
|
+
expect(formData.getAll('child[sub][last][slug]')).toContain('foobar');
|
|
263
|
+
});
|
|
264
|
+
});
|
|
165
265
|
});
|