@kineticdata/react 6.0.5 → 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 (151) 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 +64 -6
  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/integrations.js +61 -0
  22. package/lib/apis/core/kapps.js +49 -0
  23. package/lib/apis/core/kapps.test.js +16 -10
  24. package/lib/apis/core/notices.js +7 -0
  25. package/lib/apis/core/securityPolicyDefinitions.test.js +7 -4
  26. package/lib/apis/core/space.js +18 -0
  27. package/lib/apis/core/space.test.js +16 -10
  28. package/lib/apis/core/submissionActivities.js +38 -0
  29. package/lib/apis/core/submissions.js +114 -15
  30. package/lib/apis/core/translations.test.js +126 -55
  31. package/lib/apis/core/userPreferences.js +59 -0
  32. package/lib/apis/core/webApis.js +32 -2
  33. package/lib/apis/core/webhooks.test.js +7 -4
  34. package/lib/apis/http.js +30 -5
  35. package/lib/apis/index.js +48 -0
  36. package/lib/apis/integrator/index.js +337 -0
  37. package/lib/apis/system/index.js +64 -12
  38. package/lib/apis/task/index.js +9 -2
  39. package/lib/components/agent/filestore/FilestoreForm.js +1 -1
  40. package/lib/components/common/AttributeSelect.js +11 -2
  41. package/lib/components/common/BridgeSelect.js +3 -1
  42. package/lib/components/common/ConnectionSelect.js +73 -0
  43. package/lib/components/common/FormSelect.js +3 -1
  44. package/lib/components/common/NodeSelect.js +1 -0
  45. package/lib/components/common/StaticSelect.js +16 -6
  46. package/lib/components/common/TableInput.js +4 -1
  47. package/lib/components/common/TeamSelect.js +3 -1
  48. package/lib/components/common/ToastContainer.js +34 -10
  49. package/lib/components/common/Typeahead.js +62 -23
  50. package/lib/components/common/UserSelect.js +3 -1
  51. package/lib/components/common/authentication/AuthenticationContainer.js +121 -55
  52. package/lib/components/common/authentication/RequestInterceptor.js +1 -1
  53. package/lib/components/common/preferences/PreferencesProvider.js +461 -0
  54. package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +10 -7
  55. package/lib/components/core/bridge_model/BridgeModelTable.js +19 -0
  56. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +6 -9
  57. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +0 -4
  58. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +7 -10
  59. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +2 -15
  60. package/lib/components/core/category/CategoryForm.js +4 -1
  61. package/lib/components/core/category/CategoryTable.js +2 -2
  62. package/lib/components/core/core_form/CoreForm.js +18 -10
  63. package/lib/components/core/field_definition/FieldDefinitionForm.js +3 -3
  64. package/lib/components/core/file_resource/FileResourceForm.js +2 -1
  65. package/lib/components/core/file_resource/FileResourceTable.js +14 -7
  66. package/lib/components/core/form/FormForm.js +42 -19
  67. package/lib/components/core/form/FormTable.js +13 -14
  68. package/lib/components/core/form_type/FormTypeForm.js +3 -0
  69. package/lib/components/core/i18n/Moment.js +1 -0
  70. package/lib/components/core/integration/IntegrationForm.js +232 -0
  71. package/lib/components/core/integration/IntegrationTable.js +142 -0
  72. package/lib/components/core/kapp/KappForm.js +18 -5
  73. package/lib/components/core/kapp/KappTable.js +3 -3
  74. package/lib/components/core/log/LogTable.js +1 -1
  75. package/lib/components/core/security_definition/SecurityDefinitionForm.js +48 -10
  76. package/lib/components/core/space/SpaceForm.js +17 -36
  77. package/lib/components/core/submission/DatastoreSubmissionTable.js +4 -4
  78. package/lib/components/core/submission/FormSubmissionTable.js +12 -7
  79. package/lib/components/core/submission/KappSubmissionTable.js +4 -4
  80. package/lib/components/core/submission/SubmissionActivityForm.js +79 -0
  81. package/lib/components/core/submission/SubmissionForm.js +15 -3
  82. package/lib/components/core/team/TeamTable.js +17 -7
  83. package/lib/components/core/translation/EntryTable.js +8 -7
  84. package/lib/components/core/user/UserForm.js +2 -0
  85. package/lib/components/core/user/UserTable.js +22 -22
  86. package/lib/components/core/webapi/WebApiForm.js +5 -2
  87. package/lib/components/core/webapi/WebApiTable.js +2 -2
  88. package/lib/components/core/webhook/WebhookForm.js +43 -33
  89. package/lib/components/core/webhook/WebhookTable.js +16 -16
  90. package/lib/components/core/webhook_job/WebhookJobTable.js +17 -6
  91. package/lib/components/form/Form.helpers.js +10 -4
  92. package/lib/components/form/Form.js +264 -171
  93. package/lib/components/form/Form.models.js +6 -1
  94. package/lib/components/form/FormState.js +9 -5
  95. package/lib/components/form/SimpleForm.js +2 -2
  96. package/lib/components/form/defaults/CodeField.js +44 -1
  97. package/lib/components/index.js +152 -3
  98. package/lib/components/integrator/connection/ConnectionForm.js +156 -0
  99. package/lib/components/integrator/connection/ConnectionTable.js +82 -0
  100. package/lib/components/integrator/connection/config_fields/http.js +570 -0
  101. package/lib/components/integrator/connection/config_fields/sql.js +123 -0
  102. package/lib/components/integrator/integrationTypes.js +120 -0
  103. package/lib/components/integrator/operation/OperationForm.js +148 -0
  104. package/lib/components/integrator/operation/OperationTable.js +62 -0
  105. package/lib/components/integrator/operation/config_fields/http.js +185 -0
  106. package/lib/components/integrator/operation/config_fields/sql.js +81 -0
  107. package/lib/components/system/SystemSecurityForm.js +1 -1
  108. package/lib/components/system/SystemTaskAdapterForm.js +9 -9
  109. package/lib/components/system/SystemUserForm.js +2 -0
  110. package/lib/components/system/helpers.js +123 -100
  111. package/lib/components/system/spaces/SystemSpaceForm.js +9 -37
  112. package/lib/components/system/spaces/SystemTenantForm.js +276 -104
  113. package/lib/components/system/spaces/SystemTenantMigrateForm.js +449 -0
  114. package/lib/components/system/spaces/SystemTenantTable.js +20 -16
  115. package/lib/components/table/Table.js +75 -15
  116. package/lib/components/table/Table.redux.js +297 -73
  117. package/lib/components/table/defaults/FilterControl.js +24 -0
  118. package/lib/components/table/defaults/index.js +2 -0
  119. package/lib/components/table/tests/Table.test.js +22 -22
  120. package/lib/components/table/tests/components.js +9 -2
  121. package/lib/components/task/builder/Connector.js +51 -41
  122. package/lib/components/task/builder/ConnectorForm.js +11 -7
  123. package/lib/components/task/builder/Node.js +31 -35
  124. package/lib/components/task/builder/NodeForm.js +93 -22
  125. package/lib/components/task/builder/NodeParametersForm.js +29 -17
  126. package/lib/components/task/builder/SvgCanvas.js +3 -17
  127. package/lib/components/task/builder/TaskDefinitionConfigForm.js +18 -50
  128. package/lib/components/task/builder/TreeBuilder.js +23 -3
  129. package/lib/components/task/builder/builder.redux.js +342 -197
  130. package/lib/components/task/builder/constants.js +10 -2
  131. package/lib/components/task/builder/helpers.js +231 -81
  132. package/lib/components/task/builder/models.js +7 -6
  133. package/lib/components/task/category/TaskCategoryTable.js +3 -3
  134. package/lib/components/task/common/UsageTable.js +9 -2
  135. package/lib/components/task/handlers/HandlerTable.js +44 -37
  136. package/lib/components/task/policy_rule/PolicyRuleTable.js +3 -3
  137. package/lib/components/task/runs/CreateManualTriggerForm.js +2 -0
  138. package/lib/components/task/runs/RunTable.js +10 -14
  139. package/lib/components/task/runs/RunTaskTable.js +1 -1
  140. package/lib/components/task/sources/SourceTable.js +2 -2
  141. package/lib/components/task/triggers/TriggerTable.js +2 -2
  142. package/lib/components/task/workflows/LinkedWorkflowTable.js +16 -11
  143. package/lib/components/task/workflows/WorkflowForm.js +27 -8
  144. package/lib/components/task/workflows/WorkflowTable.js +27 -26
  145. package/lib/helpers/index.js +307 -74
  146. package/lib/index.js +2 -1
  147. package/lib/saga.js +4 -4
  148. package/lib/store.js +2 -1
  149. package/package.json +7 -6
  150. package/proxyhelper.js +201 -176
  151. package/CHANGELOG.md +0 -94
@@ -0,0 +1,570 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.serializeHttpConnectionConfigFields = exports.generateHttpConnectionConfigFields = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
9
+ var _immutable = require("immutable");
10
+ var _integrationTypes = _interopRequireDefault(require("../../integrationTypes"));
11
+ var serializeHttpConnectionConfigFields = exports.serializeHttpConnectionConfigFields = function serializeHttpConnectionConfigFields(configFields) {
12
+ return function (_ref) {
13
+ var values = _ref.values;
14
+ return configFields.reduce(function (serialization, _ref2) {
15
+ var name = _ref2.name,
16
+ type = _ref2.type,
17
+ visible = _ref2.visible,
18
+ _transient = _ref2["transient"];
19
+ if (
20
+ // Field must not be transient
21
+ !_transient && (
22
+ // Field must be visible
23
+ typeof visible === 'function' ? visible({
24
+ values: values
25
+ }) : typeof visible === 'undefined' || !!visible)) {
26
+ // Set password fields to null if their toggle field is
27
+ // false, which means the password wasn't changed
28
+ if (type === 'password' && !values.get("".concat(name, ".toggle"))) {
29
+ return serialization.setIn(name.split('.'), null);
30
+ }
31
+
32
+ // If auth type is not selected, set the auth property to null
33
+ if (name === 'auth.authType' && !values.get(name)) {
34
+ return serialization.setIn(['auth'], null);
35
+ }
36
+
37
+ // Set the following fields to null if they don't have a value
38
+ if (['caCert', 'auth.caCert', 'auth.scope', 'auth.token.connection.caCert', 'auth.transform'].includes(name) && !values.get(name)) {
39
+ return serialization.setIn(name.split('.'), null);
40
+ }
41
+
42
+ // Set the value into the correct structure
43
+ return serialization.setIn(name.split('.'), values.get(name));
44
+ }
45
+ return serialization;
46
+ }, (0, _immutable.Map)());
47
+ };
48
+ };
49
+ var generateHttpConnectionConfigFields = exports.generateHttpConnectionConfigFields = function generateHttpConnectionConfigFields(config, options) {
50
+ return [{
51
+ name: 'configType',
52
+ label: 'Type',
53
+ type: 'select',
54
+ options: _integrationTypes["default"],
55
+ initialValue: 'http',
56
+ required: true,
57
+ enabled: false
58
+ }, {
59
+ name: 'baseUrl',
60
+ label: 'Base URL',
61
+ type: 'text',
62
+ initialValue: (0, _immutable.get)(config, 'baseUrl'),
63
+ required: true,
64
+ placeholder: 'https://www.kineticdata.com'
65
+ }, {
66
+ name: 'testPath',
67
+ label: 'Test Path',
68
+ type: 'text',
69
+ initialValue: (0, _immutable.get)(config, 'testPath'),
70
+ helpText: 'Path to a GET endpoint to be used for testing the connection and checking the health status.'
71
+ }, {
72
+ name: 'caCert',
73
+ label: 'Trusted CA Certificate',
74
+ type: 'text',
75
+ initialValue: (0, _immutable.get)(config, 'caCert') || ''
76
+ }].concat((0, _toConsumableArray2["default"])(generateHttpConnectionConfigAuthFields((0, _immutable.get)(config, 'auth'), options)));
77
+ };
78
+ var generateHttpConnectionConfigAuthFields = function generateHttpConnectionConfigAuthFields(auth, options) {
79
+ return [{
80
+ name: 'auth.authType',
81
+ label: 'Authentication',
82
+ type: 'select',
83
+ options: [{
84
+ value: 'basic',
85
+ label: 'Basic Auth'
86
+ }, {
87
+ value: 'http_bearer_token',
88
+ label: 'HTTP Bearer Token'
89
+ }, {
90
+ value: 'raw_bearer_token',
91
+ label: 'Raw Bearer Token'
92
+ }, {
93
+ value: 'client_credentials',
94
+ label: 'OAuth 2.0'
95
+ }],
96
+ initialValue: (0, _immutable.get)(auth, 'authType'),
97
+ placeholder: 'None'
98
+ },
99
+ // basic
100
+ {
101
+ name: 'auth.username',
102
+ label: 'Username',
103
+ type: 'text',
104
+ initialValue: (0, _immutable.get)(auth, 'username'),
105
+ required: function required(_ref3) {
106
+ var values = _ref3.values;
107
+ return values.get('auth.authType') === 'basic';
108
+ },
109
+ visible: function visible(_ref4) {
110
+ var values = _ref4.values;
111
+ return values.get('auth.authType') === 'basic';
112
+ }
113
+ }, {
114
+ name: 'auth.password.toggle',
115
+ "transient": true,
116
+ label: 'Modify Password',
117
+ type: 'toggle',
118
+ // Set to true if there is no auth config or if the current auth config is
119
+ // set to a different type
120
+ initialValue: !auth || options.isClone || options.isNewImport || (0, _immutable.get)(auth, 'authType') !== 'basic',
121
+ // Show if we're editing a connection and the selected auth type matches
122
+ // the currently saved auth type
123
+ visible: function visible(_ref5) {
124
+ var values = _ref5.values,
125
+ connection = _ref5.connection;
126
+ return !!connection && !options.isClone && values.get('auth.authType') === 'basic' && connection.getIn(['config', 'auth', 'authType']) === 'basic';
127
+ }
128
+ }, {
129
+ name: 'auth.password',
130
+ label: 'Password',
131
+ type: 'password',
132
+ initialValue: '',
133
+ visible: function visible(_ref6) {
134
+ var values = _ref6.values;
135
+ return values.get('auth.authType') === 'basic';
136
+ },
137
+ // Enable if we're creating a new connection or the change toggle is true
138
+ enabled: function enabled(_ref7) {
139
+ var values = _ref7.values,
140
+ connection = _ref7.connection;
141
+ return !connection || options.isClone || !!values.get('auth.password.toggle');
142
+ },
143
+ // Show the placeholder if there is a connection and it matches the saved type
144
+ placeholder: function placeholder(_ref8) {
145
+ var values = _ref8.values,
146
+ connection = _ref8.connection;
147
+ return !!connection && !options.isClone && connection.getIn(['config', 'auth', 'authType']) === 'basic' && !values.get('auth.password.toggle') ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : undefined;
148
+ }
149
+ },
150
+ // client_credentials
151
+ {
152
+ name: 'auth.tokenUrl',
153
+ label: 'Access Token URL',
154
+ type: 'text',
155
+ initialValue: (0, _immutable.get)(auth, 'tokenUrl'),
156
+ required: function required(_ref9) {
157
+ var values = _ref9.values;
158
+ return values.get('auth.authType') === 'client_credentials';
159
+ },
160
+ visible: function visible(_ref10) {
161
+ var values = _ref10.values;
162
+ return values.get('auth.authType') === 'client_credentials';
163
+ }
164
+ }, {
165
+ name: 'auth.clientId',
166
+ label: 'Client ID',
167
+ type: 'text',
168
+ initialValue: (0, _immutable.get)(auth, 'clientId'),
169
+ required: function required(_ref11) {
170
+ var values = _ref11.values;
171
+ return values.get('auth.authType') === 'client_credentials';
172
+ },
173
+ visible: function visible(_ref12) {
174
+ var values = _ref12.values;
175
+ return values.get('auth.authType') === 'client_credentials';
176
+ }
177
+ }, {
178
+ name: 'auth.clientSecret.toggle',
179
+ "transient": true,
180
+ label: 'Modify Client Secret',
181
+ type: 'toggle',
182
+ // Set to true if there is no auth config or if the current auth config is
183
+ // set to a different type
184
+ initialValue: !auth || options.isClone || options.isNewImport || (0, _immutable.get)(auth, 'authType') !== 'client_credentials',
185
+ // Show if we're editing a connection and the selected auth type matches
186
+ // the currently saved auth type
187
+ visible: function visible(_ref13) {
188
+ var values = _ref13.values,
189
+ connection = _ref13.connection;
190
+ return !!connection && !options.isClone && values.get('auth.authType') === 'client_credentials' && connection.getIn(['config', 'auth', 'authType']) === 'client_credentials';
191
+ }
192
+ }, {
193
+ name: 'auth.clientSecret',
194
+ label: 'Client Secret',
195
+ type: 'password',
196
+ visible: function visible(_ref14) {
197
+ var values = _ref14.values;
198
+ return values.get('auth.authType') === 'client_credentials';
199
+ },
200
+ // Enable if we're creating a new connection or the change toggle is true
201
+ enabled: function enabled(_ref15) {
202
+ var values = _ref15.values,
203
+ connection = _ref15.connection;
204
+ return !connection || options.isClone || !!values.get('auth.clientSecret.toggle');
205
+ },
206
+ // Show the placeholder if there is a connection and it matches the saved type
207
+ placeholder: function placeholder(_ref16) {
208
+ var values = _ref16.values,
209
+ connection = _ref16.connection;
210
+ return !!connection && !options.isClone && connection.getIn(['config', 'auth', 'authType']) === 'client_credentials' && !values.get('auth.clientSecret.toggle') ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : undefined;
211
+ }
212
+ }, {
213
+ name: 'auth.scope',
214
+ label: 'Scope',
215
+ type: 'text',
216
+ initialValue: (0, _immutable.get)(auth, 'scope'),
217
+ visible: function visible(_ref17) {
218
+ var values = _ref17.values;
219
+ return values.get('auth.authType') === 'client_credentials';
220
+ }
221
+ }, {
222
+ name: 'auth.clientAuth',
223
+ label: 'Client Auth',
224
+ type: 'select',
225
+ options: [{
226
+ label: 'Basic Auth',
227
+ value: 'basic_auth'
228
+ }, {
229
+ label: 'Form URL Encoded',
230
+ value: 'www_form_urlencoded'
231
+ }],
232
+ initialValue: (0, _immutable.get)(auth, 'clientAuth', 'www_form_urlencoded'),
233
+ required: function required(_ref18) {
234
+ var values = _ref18.values;
235
+ return values.get('auth.authType') === 'client_credentials';
236
+ },
237
+ visible: function visible(_ref19) {
238
+ var values = _ref19.values;
239
+ return values.get('auth.authType') === 'client_credentials';
240
+ }
241
+ }, {
242
+ name: 'auth.caCert',
243
+ label: 'Trusted CA Certificate',
244
+ type: 'text',
245
+ initialValue: (0, _immutable.get)(auth, 'caCert') || '',
246
+ visible: function visible(_ref20) {
247
+ var values = _ref20.values;
248
+ return values.get('auth.authType') === 'client_credentials';
249
+ }
250
+ },
251
+ // bearer_token
252
+ {
253
+ name: 'auth.header',
254
+ label: 'Token Header',
255
+ type: 'text',
256
+ initialValue: (0, _immutable.get)(auth, 'header', 'Authorization'),
257
+ visible: function visible(_ref21) {
258
+ var values = _ref21.values;
259
+ return ['raw_bearer_token', 'http_bearer_token'].includes(values.get('auth.authType'));
260
+ },
261
+ required: function required(_ref22) {
262
+ var values = _ref22.values;
263
+ return ['raw_bearer_token', 'http_bearer_token'].includes(values.get('auth.authType'));
264
+ }
265
+ }, {
266
+ name: 'auth.prefix',
267
+ label: 'Token Prefix',
268
+ type: 'text',
269
+ initialValue: (0, _immutable.get)(auth, 'prefix', 'Bearer'),
270
+ visible: function visible(_ref23) {
271
+ var values = _ref23.values;
272
+ return ['raw_bearer_token', 'http_bearer_token'].includes(values.get('auth.authType'));
273
+ },
274
+ required: function required(_ref24) {
275
+ var values = _ref24.values;
276
+ return ['raw_bearer_token', 'http_bearer_token'].includes(values.get('auth.authType'));
277
+ }
278
+ }, {
279
+ name: 'auth.token.toggle',
280
+ "transient": true,
281
+ label: 'Modify Token',
282
+ type: 'toggle',
283
+ // Set to true if there is no auth config or if the current auth config is
284
+ // set to a different type
285
+ initialValue: !auth || options.isClone || options.isNewImport || (0, _immutable.get)(auth, 'authType') !== 'raw_bearer_token',
286
+ // Show if we're editing a connection and the selected auth type matches
287
+ // the currently saved auth type
288
+ visible: function visible(_ref25) {
289
+ var values = _ref25.values,
290
+ connection = _ref25.connection;
291
+ return !!connection && !options.isClone && values.get('auth.authType') === 'raw_bearer_token' && connection.getIn(['config', 'auth', 'authType']) === 'raw_bearer_token';
292
+ }
293
+ }, {
294
+ name: 'auth.token',
295
+ label: 'Token',
296
+ type: 'password',
297
+ initialValue: '',
298
+ visible: function visible(_ref26) {
299
+ var values = _ref26.values;
300
+ return values.get('auth.authType') === 'raw_bearer_token';
301
+ },
302
+ // Enable if we're creating a new connection or the change toggle is true
303
+ enabled: function enabled(_ref27) {
304
+ var values = _ref27.values,
305
+ connection = _ref27.connection;
306
+ return !connection || options.isClone || !!values.get('auth.token.toggle');
307
+ },
308
+ // Show the placeholder if there is a connection and it matches the saved type
309
+ placeholder: function placeholder(_ref28) {
310
+ var values = _ref28.values,
311
+ connection = _ref28.connection;
312
+ return !!connection && !options.isClone && connection.getIn(['config', 'auth', 'authType']) === 'raw_bearer_token' && !values.get('auth.token.toggle') ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : undefined;
313
+ }
314
+ }].concat((0, _toConsumableArray2["default"])(generateHttpConnectionConfigAuthTokenOperationFields((0, _immutable.getIn)(auth, ['token', 'operation']), options)), [{
315
+ name: 'auth.tokenHttpConn',
316
+ "transient": true,
317
+ label: 'Use different connection for auth',
318
+ type: 'checkbox',
319
+ initialValue: typeof (0, _immutable.getIn)(auth, ['token', 'connection']) === 'object',
320
+ visible: function visible(_ref29) {
321
+ var values = _ref29.values;
322
+ return values.get('auth.authType') === 'http_bearer_token';
323
+ }
324
+ }], (0, _toConsumableArray2["default"])(generateHttpConnectionConfigAuthTokenConnectionFields((0, _immutable.getIn)(auth, ['token', 'connection']), options)), [{
325
+ name: 'auth.token.tokenOutput',
326
+ label: 'Token',
327
+ type: 'code',
328
+ language: 'js-expression',
329
+ initialValue: (0, _immutable.getIn)(auth, ['token', 'tokenOutput']),
330
+ required: function required(_ref30) {
331
+ var values = _ref30.values;
332
+ return values.get('auth.authType') === 'http_bearer_token';
333
+ },
334
+ visible: function visible(_ref31) {
335
+ var values = _ref31.values;
336
+ return values.get('auth.authType') === 'http_bearer_token';
337
+ },
338
+ helpText: /*#__PURE__*/React.createElement(React.Fragment, null, "Define a JavaScript expression that maps the response to the token value. Press ", /*#__PURE__*/React.createElement("code", null, "Ctrl + Space"), " to see the available properties in the field.")
339
+ }, {
340
+ name: 'auth.token.expirationOutput',
341
+ label: 'Expiration',
342
+ type: 'code',
343
+ language: 'js-expression',
344
+ initialValue: (0, _immutable.getIn)(auth, ['token', 'expirationOutput']),
345
+ required: function required(_ref32) {
346
+ var values = _ref32.values;
347
+ return values.get('auth.authType') === 'http_bearer_token';
348
+ },
349
+ visible: function visible(_ref33) {
350
+ var values = _ref33.values;
351
+ return values.get('auth.authType') === 'http_bearer_token';
352
+ },
353
+ helpText: /*#__PURE__*/React.createElement(React.Fragment, null, "Define a JavaScript expression that maps the response to a numeric expiration value in seconds. Press ", /*#__PURE__*/React.createElement("code", null, "Ctrl + Space"), " to see the available properties in the field.")
354
+ }]);
355
+ };
356
+ var generateHttpConnectionConfigAuthTokenOperationFields = function generateHttpConnectionConfigAuthTokenOperationFields(operation, options) {
357
+ return [{
358
+ name: 'auth.token.operation.configType',
359
+ label: 'Type',
360
+ type: 'select',
361
+ options: _integrationTypes["default"],
362
+ initialValue: 'http',
363
+ enabled: false,
364
+ visible: function visible(_ref34) {
365
+ var values = _ref34.values;
366
+ return values.get('auth.authType') === 'http_bearer_token';
367
+ },
368
+ required: function required(_ref35) {
369
+ var values = _ref35.values;
370
+ return values.get('auth.authType') === 'http_bearer_token';
371
+ }
372
+ }, {
373
+ name: 'auth.token.operation.method',
374
+ label: 'Method',
375
+ type: 'select',
376
+ options: [{
377
+ label: 'GET',
378
+ value: 'GET'
379
+ }, {
380
+ label: 'POST',
381
+ value: 'POST'
382
+ }, {
383
+ label: 'PUT',
384
+ value: 'PUT'
385
+ }, {
386
+ label: 'PATCH',
387
+ value: 'PATCH'
388
+ }, {
389
+ label: 'DELETE',
390
+ value: 'DELETE'
391
+ }],
392
+ initialValue: (0, _immutable.get)(operation, 'method'),
393
+ visible: function visible(_ref36) {
394
+ var values = _ref36.values;
395
+ return values.get('auth.authType') === 'http_bearer_token';
396
+ },
397
+ required: function required(_ref37) {
398
+ var values = _ref37.values;
399
+ return values.get('auth.authType') === 'http_bearer_token';
400
+ }
401
+ }, {
402
+ name: 'auth.token.operation.path',
403
+ label: 'Request Path',
404
+ type: 'text',
405
+ initialValue: (0, _immutable.get)(operation, 'path'),
406
+ visible: function visible(_ref38) {
407
+ var values = _ref38.values;
408
+ return values.get('auth.authType') === 'http_bearer_token';
409
+ },
410
+ required: function required(_ref39) {
411
+ var values = _ref39.values;
412
+ return values.get('auth.authType') === 'http_bearer_token';
413
+ },
414
+ helpText: /*#__PURE__*/React.createElement(React.Fragment, null, "Use the ", /*#__PURE__*/React.createElement("code", null, '{{secretKey}}'), " format to insert secrets that have been defined for this connection.")
415
+ }, {
416
+ name: 'auth.token.operation.params',
417
+ label: 'URL Parameters',
418
+ type: 'map',
419
+ initialValue: (0, _immutable.get)(operation, 'params'),
420
+ visible: function visible(_ref40) {
421
+ var values = _ref40.values;
422
+ return values.get('auth.authType') === 'http_bearer_token';
423
+ },
424
+ placeholder: 'Parameter Key',
425
+ helpText: /*#__PURE__*/React.createElement(React.Fragment, null, "Use the ", /*#__PURE__*/React.createElement("code", null, '{{secretKey}}'), " format to insert secrets that have been defined for this connection.")
426
+ }, {
427
+ name: 'auth.token.operation.headers',
428
+ label: 'Headers',
429
+ type: 'map',
430
+ initialValue: (0, _immutable.get)(operation, 'headers'),
431
+ visible: function visible(_ref41) {
432
+ var values = _ref41.values;
433
+ return values.get('auth.authType') === 'http_bearer_token';
434
+ },
435
+ placeholder: 'Header Key',
436
+ helpText: /*#__PURE__*/React.createElement(React.Fragment, null, "Use the ", /*#__PURE__*/React.createElement("code", null, '{{secretKey}}'), " format to insert secrets that have been defined for this connection.")
437
+ }, {
438
+ name: 'auth.token.operation.followRedirect',
439
+ label: 'Follow Redirect',
440
+ type: 'checkbox',
441
+ initialValue: (0, _immutable.get)(operation, 'followRedirect'),
442
+ visible: function visible(_ref42) {
443
+ var values = _ref42.values;
444
+ return values.get('auth.authType') === 'http_bearer_token';
445
+ }
446
+ }, {
447
+ name: 'auth.token.operation.streamResponse',
448
+ label: 'Stream Response',
449
+ type: 'checkbox',
450
+ initialValue: (0, _immutable.get)(operation, 'streamResponse'),
451
+ visible: function visible(_ref43) {
452
+ var values = _ref43.values;
453
+ return values.get('auth.authType') === 'http_bearer_token';
454
+ }
455
+ }, {
456
+ name: 'auth.token.operation.body.bodyType',
457
+ label: 'Body Type',
458
+ type: 'radio',
459
+ options: [{
460
+ label: 'Form URL Encoded',
461
+ value: 'www_form_urlencoded'
462
+ }, {
463
+ label: 'Raw',
464
+ value: 'raw'
465
+ }
466
+ // { label: 'Multipart', value: 'multipart_form' },
467
+ ],
468
+
469
+ initialValue: (0, _immutable.getIn)(operation, ['body', 'bodyType']) || 'www_form_urlencoded',
470
+ required: true,
471
+ visible: function visible(_ref44) {
472
+ var values = _ref44.values;
473
+ return values.get('auth.authType') === 'http_bearer_token';
474
+ }
475
+ }, {
476
+ name: 'auth.token.operation.body.form',
477
+ label: 'Form Body',
478
+ type: 'map',
479
+ initialValue: (0, _immutable.getIn)(operation, ['body', 'form']),
480
+ visible: function visible(_ref45) {
481
+ var values = _ref45.values;
482
+ return values.get('auth.authType') === 'http_bearer_token' && values.get('auth.token.operation.body.bodyType') === 'www_form_urlencoded';
483
+ },
484
+ placeholder: 'Body Key',
485
+ helpText: /*#__PURE__*/React.createElement(React.Fragment, null, "Use the ", /*#__PURE__*/React.createElement("code", null, '{{secretKey}}'), " format to insert secrets that have been defined for this connection.")
486
+ }, {
487
+ name: 'auth.token.operation.body.raw',
488
+ label: 'Raw Body',
489
+ type: 'code',
490
+ language: function language(_ref46) {
491
+ var values = _ref46.values;
492
+ return getLanguageFromContentType(values.get('auth.token.operation.headers').find(function (_, header) {
493
+ return (header === null || header === void 0 ? void 0 : header.toLowerCase()) === 'content-type';
494
+ }));
495
+ },
496
+ initialValue: (0, _immutable.getIn)(operation, ['body', 'raw']),
497
+ visible: function visible(_ref47) {
498
+ var values = _ref47.values;
499
+ return values.get('auth.authType') === 'http_bearer_token' && values.get('auth.token.operation.body.bodyType') === 'raw';
500
+ },
501
+ helpText: /*#__PURE__*/React.createElement(React.Fragment, null, "Use the ", /*#__PURE__*/React.createElement("code", null, '{{secretKey}}'), " format to insert secrets that have been defined for this connection.")
502
+ }, {
503
+ name: 'auth.token.operation.body.parts',
504
+ label: 'Multipart Body',
505
+ type: 'table',
506
+ options: [{
507
+ name: 'name',
508
+ label: 'Name',
509
+ type: 'text'
510
+ }, {
511
+ name: 'contentType',
512
+ label: 'Content Type',
513
+ type: 'text'
514
+ }, {
515
+ name: 'content',
516
+ label: 'Content',
517
+ type: 'code',
518
+ renderAttributes: {
519
+ simple: true,
520
+ max: 'sm'
521
+ }
522
+ }, {
523
+ name: 'fileName',
524
+ label: 'File Name',
525
+ type: 'text'
526
+ }],
527
+ initialValue: (0, _immutable.getIn)(operation, ['body', 'parts'], (0, _immutable.List)()),
528
+ visible: function visible(_ref48) {
529
+ var values = _ref48.values;
530
+ return values.get('auth.authType') === 'http_bearer_token' && values.get('auth.token.operation.body.bodyType') === 'multipart_form';
531
+ },
532
+ helpText: /*#__PURE__*/React.createElement(React.Fragment, null, "Use the ", /*#__PURE__*/React.createElement("code", null, '{{secretKey}}'), " format to insert secrets that have been defined for this connection.")
533
+ }];
534
+ };
535
+ var generateHttpConnectionConfigAuthTokenConnectionFields = function generateHttpConnectionConfigAuthTokenConnectionFields(connection, options) {
536
+ return [{
537
+ name: 'auth.token.connection.baseUrl',
538
+ label: 'Token Base URL',
539
+ type: 'text',
540
+ initialValue: (0, _immutable.get)(connection, 'baseUrl'),
541
+ visible: function visible(_ref49) {
542
+ var values = _ref49.values;
543
+ return values.get('auth.authType') === 'http_bearer_token' && !!values.get('auth.tokenHttpConn');
544
+ },
545
+ required: function required(_ref50) {
546
+ var values = _ref50.values;
547
+ return values.get('auth.authType') === 'http_bearer_token' && !!values.get('auth.tokenHttpConn');
548
+ }
549
+ }, {
550
+ name: 'auth.token.connection.caCert',
551
+ label: 'Token Trusted CA Certificate',
552
+ type: 'text',
553
+ initialValue: (0, _immutable.get)(connection, 'caCert') || '',
554
+ visible: function visible(_ref51) {
555
+ var values = _ref51.values;
556
+ return values.get('auth.authType') === 'http_bearer_token' && !!values.get('auth.tokenHttpConn');
557
+ }
558
+ }];
559
+ };
560
+ function getLanguageFromContentType(contentType) {
561
+ switch (contentType) {
562
+ case 'application/json':
563
+ return 'json';
564
+ case 'application/xml':
565
+ case 'text/xml':
566
+ return 'xml';
567
+ default:
568
+ return 'none';
569
+ }
570
+ }
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.serializeSQLConnectionConfigFields = exports.generateSQLConnectionConfigFields = void 0;
8
+ var _immutable = require("immutable");
9
+ var _integrationTypes = _interopRequireDefault(require("../../integrationTypes"));
10
+ var serializeSQLConnectionConfigFields = exports.serializeSQLConnectionConfigFields = function serializeSQLConnectionConfigFields(configFields) {
11
+ return function (_ref) {
12
+ var values = _ref.values;
13
+ return configFields.reduce(function (serialization, _ref2) {
14
+ var name = _ref2.name,
15
+ type = _ref2.type,
16
+ visible = _ref2.visible,
17
+ _transient = _ref2["transient"];
18
+ if (
19
+ // Field must not be transient
20
+ !_transient && (
21
+ // Field must be visible
22
+ typeof visible === 'function' ? visible({
23
+ values: values
24
+ }) : typeof visible === 'undefined' || !!visible)) {
25
+ // Set password fields to null if their toggle field is
26
+ // false, which means the password wasn't changed
27
+ if (type === 'password' && !values.get("".concat(name, ".toggle"))) {
28
+ return serialization.setIn(name.split('.'), null);
29
+ }
30
+
31
+ // Set the following fields to null if they don't have a value
32
+ if (['caCert'].includes(name) && !values.get(name)) {
33
+ return serialization.setIn(name.split('.'), null);
34
+ }
35
+
36
+ // Set the value into the correct structure
37
+ return serialization.setIn(name.split('.'), values.get(name));
38
+ }
39
+ return serialization;
40
+ }, (0, _immutable.Map)());
41
+ };
42
+ };
43
+ var generateSQLConnectionConfigFields = exports.generateSQLConnectionConfigFields = function generateSQLConnectionConfigFields(config, type, options) {
44
+ return [{
45
+ name: 'configType',
46
+ label: 'Type',
47
+ type: 'select',
48
+ options: _integrationTypes["default"],
49
+ initialValue: type,
50
+ required: true,
51
+ enabled: false
52
+ }, {
53
+ name: 'host',
54
+ label: 'Host',
55
+ type: 'text',
56
+ initialValue: (0, _immutable.get)(config, 'host'),
57
+ required: true
58
+ }, {
59
+ name: 'port',
60
+ label: 'Port',
61
+ type: 'text',
62
+ initialValue: String((0, _immutable.get)(config, 'port') || ''),
63
+ required: true,
64
+ pattern: /^\d*$/,
65
+ patternMessage: 'Port must be numeric'
66
+ }, {
67
+ name: 'database',
68
+ label: 'Database',
69
+ type: 'text',
70
+ initialValue: (0, _immutable.get)(config, 'database'),
71
+ required: true
72
+ }, {
73
+ name: 'poolSize',
74
+ label: 'Connection Pool',
75
+ type: 'number',
76
+ initialValue: (0, _immutable.get)(config, 'poolSize') || 5,
77
+ required: true,
78
+ constraint: function constraint(_ref3) {
79
+ var values = _ref3.values;
80
+ return typeof values.get('poolSize') === 'number' && values.get('poolSize') > 0;
81
+ },
82
+ constraintMessage: 'Connection Pool must be numeric and must be greater than 0'
83
+ }, {
84
+ name: 'username',
85
+ label: 'Username',
86
+ type: 'text',
87
+ initialValue: (0, _immutable.get)(config, 'username'),
88
+ required: true
89
+ }, {
90
+ name: 'password.toggle',
91
+ "transient": true,
92
+ label: 'Modify Password',
93
+ type: 'toggle',
94
+ initialValue: !config || !!options.isClone || !!options.isNewImport,
95
+ // Show if we're editing a connection
96
+ visible: function visible(_ref4) {
97
+ var connection = _ref4.connection;
98
+ return !!connection && !options.isClone;
99
+ }
100
+ }, {
101
+ name: 'password',
102
+ label: 'Password',
103
+ type: 'password',
104
+ initialValue: '',
105
+ // Enable if we're creating a new connection or the change toggle is true
106
+ enabled: function enabled(_ref5) {
107
+ var values = _ref5.values,
108
+ connection = _ref5.connection;
109
+ return !connection || options.isClone || !!values.get('password.toggle');
110
+ },
111
+ // Show the placeholder if there is a connection
112
+ placeholder: function placeholder(_ref6) {
113
+ var values = _ref6.values,
114
+ connection = _ref6.connection;
115
+ return !!connection && !options.isClone && !values.get('password.toggle') ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : undefined;
116
+ }
117
+ }, {
118
+ name: 'caCert',
119
+ label: 'Trusted CA Certificate',
120
+ type: 'text',
121
+ initialValue: (0, _immutable.get)(config, 'caCert') || ''
122
+ }];
123
+ };