@kineticdata/react 6.0.4 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/CHANGELOG.md +116 -86
  2. package/lib/apis/core/attributeDefinitions.js +9 -6
  3. package/lib/apis/core/integrations.js +61 -0
  4. package/lib/apis/core/submissions.js +52 -15
  5. package/lib/apis/http.js +16 -2
  6. package/lib/apis/index.js +24 -0
  7. package/lib/apis/integrator/index.js +262 -0
  8. package/lib/apis/system/index.js +64 -12
  9. package/lib/apis/task/index.js +9 -2
  10. package/lib/components/agent/filestore/FilestoreForm.js +1 -1
  11. package/lib/components/common/AttributeSelect.js +10 -2
  12. package/lib/components/common/BridgeSelect.js +2 -1
  13. package/lib/components/common/ConnectionSelect.js +72 -0
  14. package/lib/components/common/FormSelect.js +2 -1
  15. package/lib/components/common/StaticSelect.js +15 -6
  16. package/lib/components/common/TableInput.js +4 -1
  17. package/lib/components/common/TeamSelect.js +2 -1
  18. package/lib/components/common/ToastContainer.js +34 -10
  19. package/lib/components/common/Typeahead.js +59 -23
  20. package/lib/components/common/UserSelect.js +2 -1
  21. package/lib/components/common/authentication/RequestInterceptor.js +1 -1
  22. package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +3 -0
  23. package/lib/components/core/bridge_model/BridgeModelTable.js +19 -0
  24. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +6 -9
  25. package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +0 -4
  26. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +7 -10
  27. package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +2 -15
  28. package/lib/components/core/category/CategoryForm.js +4 -1
  29. package/lib/components/core/category/CategoryTable.js +2 -2
  30. package/lib/components/core/core_form/CoreForm.js +18 -10
  31. package/lib/components/core/file_resource/FileResourceForm.js +2 -1
  32. package/lib/components/core/file_resource/FileResourceTable.js +14 -7
  33. package/lib/components/core/form/FormForm.js +42 -19
  34. package/lib/components/core/form/FormTable.js +14 -14
  35. package/lib/components/core/form_type/FormTypeForm.js +3 -0
  36. package/lib/components/core/i18n/Moment.js +1 -0
  37. package/lib/components/core/integration/IntegrationForm.js +232 -0
  38. package/lib/components/core/integration/IntegrationTable.js +139 -0
  39. package/lib/components/core/kapp/KappForm.js +56 -67
  40. package/lib/components/core/kapp/KappTable.js +3 -3
  41. package/lib/components/core/log/LogTable.js +1 -1
  42. package/lib/components/core/security_definition/SecurityDefinitionForm.js +48 -10
  43. package/lib/components/core/space/SpaceForm.js +97 -111
  44. package/lib/components/core/submission/DatastoreSubmissionTable.js +4 -4
  45. package/lib/components/core/submission/FormSubmissionTable.js +12 -7
  46. package/lib/components/core/submission/KappSubmissionTable.js +4 -4
  47. package/lib/components/core/submission/SubmissionForm.js +3 -1
  48. package/lib/components/core/team/TeamTable.js +17 -7
  49. package/lib/components/core/user/UserTable.js +18 -18
  50. package/lib/components/core/webapi/WebApiForm.js +5 -2
  51. package/lib/components/core/webapi/WebApiTable.js +2 -2
  52. package/lib/components/core/webhook/WebhookForm.js +43 -33
  53. package/lib/components/core/webhook/WebhookTable.js +16 -16
  54. package/lib/components/core/webhook_job/WebhookJobTable.js +17 -6
  55. package/lib/components/form/Form.helpers.js +10 -4
  56. package/lib/components/form/Form.js +250 -168
  57. package/lib/components/form/Form.models.js +6 -1
  58. package/lib/components/form/FormState.js +9 -5
  59. package/lib/components/form/defaults/CodeField.js +44 -1
  60. package/lib/components/index.js +84 -3
  61. package/lib/components/integrator/connection/ConnectionForm.js +112 -0
  62. package/lib/components/integrator/connection/ConnectionTable.js +80 -0
  63. package/lib/components/integrator/connection/config_fields/http.js +570 -0
  64. package/lib/components/integrator/integrationTypes.js +98 -0
  65. package/lib/components/integrator/operation/OperationForm.js +128 -0
  66. package/lib/components/integrator/operation/OperationTable.js +64 -0
  67. package/lib/components/integrator/operation/config_fields/http.js +184 -0
  68. package/lib/components/system/SystemSecurityForm.js +1 -1
  69. package/lib/components/system/SystemTaskAdapterForm.js +9 -9
  70. package/lib/components/system/helpers.js +123 -100
  71. package/lib/components/system/spaces/SystemSpaceForm.js +9 -37
  72. package/lib/components/system/spaces/SystemTenantForm.js +276 -104
  73. package/lib/components/system/spaces/SystemTenantMigrateForm.js +449 -0
  74. package/lib/components/system/spaces/SystemTenantTable.js +20 -16
  75. package/lib/components/table/Table.redux.js +1 -1
  76. package/lib/components/task/builder/ConnectorForm.js +11 -7
  77. package/lib/components/task/builder/Node.js +11 -2
  78. package/lib/components/task/builder/NodeForm.js +93 -22
  79. package/lib/components/task/builder/NodeParametersForm.js +29 -17
  80. package/lib/components/task/builder/TaskDefinitionConfigForm.js +18 -50
  81. package/lib/components/task/builder/TreeBuilder.js +32 -5
  82. package/lib/components/task/builder/builder.redux.js +399 -205
  83. package/lib/components/task/builder/constants.js +10 -2
  84. package/lib/components/task/builder/helpers.js +199 -79
  85. package/lib/components/task/builder/models.js +11 -9
  86. package/lib/components/task/category/TaskCategoryTable.js +3 -3
  87. package/lib/components/task/common/UsageTable.js +1 -1
  88. package/lib/components/task/handlers/HandlerTable.js +35 -19
  89. package/lib/components/task/policy_rule/PolicyRuleTable.js +3 -3
  90. package/lib/components/task/runs/CreateManualTriggerForm.js +2 -0
  91. package/lib/components/task/runs/RunTable.js +4 -4
  92. package/lib/components/task/runs/RunTaskTable.js +1 -1
  93. package/lib/components/task/sources/SourceTable.js +2 -2
  94. package/lib/components/task/triggers/TriggerTable.js +2 -2
  95. package/lib/components/task/workflows/LinkedWorkflowTable.js +2 -2
  96. package/lib/components/task/workflows/WorkflowForm.js +29 -9
  97. package/lib/components/task/workflows/WorkflowTable.js +2 -2
  98. package/lib/helpers/index.js +289 -72
  99. package/package.json +5 -3
  100. package/proxyhelper.js +28 -3
@@ -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) {
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'), !config)));
77
+ };
78
+ var generateHttpConnectionConfigAuthFields = function generateHttpConnectionConfigAuthFields(auth) {
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 || (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 && 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 || !!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 && 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 || (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 && 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 || !!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 && 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 || (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 && 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 || !!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 && 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']))), [{
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']))), [{
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) {
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) {
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,98 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.integrationTypes = exports.getOperationMetadata = exports.getConnectionMetadata = exports["default"] = void 0;
7
+ var _immutable = require("immutable");
8
+ var integrationTypes = exports.integrationTypes = [{
9
+ label: 'HTTP',
10
+ value: 'http'
11
+ }
12
+ // { label: 'SMTP', value: 'smtp' },
13
+ // { label: 'SQL', value: 'sql' },
14
+ ];
15
+
16
+ // Helper function for getting the label for a given type value
17
+ integrationTypes.getLabel = function (value) {
18
+ var _integrationTypes$fin;
19
+ return ((_integrationTypes$fin = integrationTypes.find(function (t) {
20
+ return t.value === value;
21
+ })) === null || _integrationTypes$fin === void 0 ? void 0 : _integrationTypes$fin.label) || value;
22
+ };
23
+ var _default = exports["default"] = integrationTypes;
24
+ var getConnectionMetadata = exports.getConnectionMetadata = function getConnectionMetadata(connection) {
25
+ var type = (0, _immutable.getIn)(connection, ['config', 'configType']);
26
+ switch (type) {
27
+ case 'http':
28
+ return {
29
+ // Details content to render for each option in a list of connections
30
+ optionDetail: (0, _immutable.getIn)(connection, ['config', 'baseUrl']),
31
+ // Documentation link
32
+ docsLink: (0, _immutable.getIn)(connection, ['documentationLink']),
33
+ // Properties to list in page/modal headings
34
+ headingData: [{
35
+ label: 'Base URL',
36
+ value: (0, _immutable.getIn)(connection, ['config', 'baseUrl'])
37
+ }, {
38
+ label: 'Auth',
39
+ value: {
40
+ basic: 'Basic',
41
+ client_credentials: 'Client Credentials',
42
+ http_bearer_token: 'HTTP Bearer Token',
43
+ raw_bearer_token: 'Raw Bearer Token'
44
+ }[(0, _immutable.getIn)(connection, ['config', 'auth', 'authType'])] || 'None'
45
+ }].filter(function (o) {
46
+ return o.value;
47
+ }),
48
+ // Table columns for the operations table of this type of connection.
49
+ // Objects define columns to add, and strings define default columns to
50
+ // show. The order of the items is defines the order of the columns.
51
+ operationColumns: [{
52
+ value: 'method',
53
+ title: 'Method',
54
+ components: {
55
+ BodyCell: HTTPMethodCell
56
+ },
57
+ toggleable: true
58
+ }, 'name', 'updatedAt', 'actions']
59
+ };
60
+ default:
61
+ return {
62
+ headingData: [],
63
+ operationColumns: ['name', 'updatedAt', 'actions']
64
+ };
65
+ }
66
+ };
67
+ var getOperationMetadata = exports.getOperationMetadata = function getOperationMetadata(operation) {
68
+ var type = (0, _immutable.getIn)(operation, ['config', 'configType']);
69
+ switch (type) {
70
+ case 'http':
71
+ return {
72
+ // Details content to render for each option in a list of operations
73
+ optionDetail: (0, _immutable.getIn)(operation, ['config', 'method']),
74
+ // Documentation link
75
+ docsLink: (0, _immutable.getIn)(operation, ['documentationLink']),
76
+ // Properties to list in page/modal headings
77
+ headingData: [{
78
+ label: 'Request Path',
79
+ value: (0, _immutable.getIn)(operation, ['config', 'path'])
80
+ }, {
81
+ label: 'Method',
82
+ value: (0, _immutable.getIn)(operation, ['config', 'method'])
83
+ }].filter(function (o) {
84
+ return o.value;
85
+ })
86
+ };
87
+ default:
88
+ return {
89
+ headingData: []
90
+ };
91
+ }
92
+ };
93
+ var HTTPMethodCell = function HTTPMethodCell(_ref) {
94
+ var row = _ref.row;
95
+ return /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", {
96
+ className: "badge badge-info"
97
+ }, row.getIn(['config', 'method'])));
98
+ };