@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
@@ -16,6 +16,7 @@ var _store = require("../../../store");
16
16
  var _models = require("./models");
17
17
  var _apis = require("../../../apis");
18
18
  var _helpers = require("./helpers");
19
+ var _constants = require("./constants");
19
20
  var mountTreeBuilder = exports.mountTreeBuilder = function mountTreeBuilder(treeKey) {
20
21
  return (0, _store.dispatch)('TREE_MOUNT', {
21
22
  treeKey: treeKey
@@ -43,145 +44,292 @@ var remember = function remember(state, treeKey) {
43
44
  (0, _store.regSaga)((0, _effects.takeEvery)('TREE_CONFIGURE', function (_ref) {
44
45
  var payload = _ref.payload;
45
46
  return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
46
- var _getPlatformItemSlugs, name, sourceGroup, sourceName, treeKey, webApiProps, _yield$all, _yield$all2, tree, categories, webApi, platformItem, result, _yield$call, workflow;
47
+ var _treeObject$treeJson, _treeObject$treeJson$, name, sourceGroup, sourceName, treeKey, platformSourceName, webApiProps, workflowProps, _yield$all, _yield$all2, _yield$all2$, tree, treeError, _yield$all2$2, workflow, workflowError, categories, _yield$all2$3$connect, connections, _yield$all2$3, webApi, webApiError, kappSlug, formSlug, workflowObject, workflowObjectError, _yield$call, platformItem, platformItemError, _yield$call2, linkedWorkflow, linkedError, slugs, treeObject, loadError, operationIds;
47
48
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
48
49
  while (1) switch (_context.prev = _context.next) {
49
50
  case 0:
50
51
  _context.prev = 0;
51
- name = payload.name, sourceGroup = payload.sourceGroup, sourceName = payload.sourceName, treeKey = payload.treeKey;
52
+ name = payload.name, sourceGroup = payload.sourceGroup, sourceName = payload.sourceName, treeKey = payload.treeKey, platformSourceName = payload.platformSourceName;
52
53
  webApiProps = getWebApiProps(payload);
53
- _context.next = 5;
54
- return (0, _effects.all)([(0, _effects.call)(_apis.fetchTree, {
54
+ workflowProps = getWorkflowProps(payload);
55
+ _context.next = 6;
56
+ return (0, _effects.all)([
57
+ // Fetch the tree if not a linked workflow
58
+ !workflowProps ? (0, _effects.call)(_apis.fetchTree, {
55
59
  name: name,
56
60
  sourceGroup: sourceGroup,
57
61
  sourceName: sourceName,
58
62
  include: 'bindings,categories,details,treeJson,inputs,outputs'
59
- }), (0, _effects.call)(_apis.fetchTaskCategories, {
63
+ }) : {},
64
+ // Fetch the workflow if it is a linked workflow
65
+ workflowProps ? (0, _effects.call)(_apis.fetchWorkflow, (0, _objectSpread2["default"])({}, workflowProps)) : {},
66
+ // Fetch task categories
67
+ (0, _effects.call)(_apis.fetchTaskCategories, {
60
68
  include: 'handlers.results,handlers.parameters,trees.parameters,trees.inputs,trees.outputs'
61
- }), webApiProps ? (0, _effects.call)(_apis.fetchWebApi, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, webApiProps), {}, {
69
+ }),
70
+ // Fetch connections
71
+ (0, _effects.call)(_apis.fetchConnections),
72
+ // Fetch the webAPI if applicable
73
+ webApiProps ? (0, _effects.call)(_apis.fetchWebApi, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, webApiProps), {}, {
62
74
  include: 'details,securityPolicies'
63
75
  })) : {}]);
64
- case 5:
76
+ case 6:
65
77
  _yield$all = _context.sent;
66
- _yield$all2 = (0, _slicedToArray2["default"])(_yield$all, 3);
67
- tree = _yield$all2[0].tree;
68
- categories = _yield$all2[1].categories;
69
- webApi = _yield$all2[2].webApi;
70
- platformItem = null;
71
- if (!tree.event) {
72
- _context.next = 21;
78
+ _yield$all2 = (0, _slicedToArray2["default"])(_yield$all, 5);
79
+ _yield$all2$ = _yield$all2[0];
80
+ tree = _yield$all2$.tree;
81
+ treeError = _yield$all2$.error;
82
+ _yield$all2$2 = _yield$all2[1];
83
+ workflow = _yield$all2$2.workflow;
84
+ workflowError = _yield$all2$2.error;
85
+ categories = _yield$all2[2].categories;
86
+ _yield$all2$3$connect = _yield$all2[3].connections;
87
+ connections = _yield$all2$3$connect === void 0 ? [] : _yield$all2$3$connect;
88
+ _yield$all2$3 = _yield$all2[4];
89
+ webApi = _yield$all2$3.webApi;
90
+ webApiError = _yield$all2$3.error;
91
+ kappSlug = (webApiProps === null || webApiProps === void 0 ? void 0 : webApiProps.kappSlug) || (workflowProps === null || workflowProps === void 0 ? void 0 : workflowProps.kappSlug);
92
+ formSlug = workflowProps === null || workflowProps === void 0 ? void 0 : workflowProps.formSlug;
93
+ workflowObject = workflow;
94
+ workflowObjectError = workflowError; // If a tree was fetched and the tree has platform item data, fetch the
95
+ // platform item and then retrieve the workflow
96
+ if (!(tree && tree.platformItemId && tree.platformItemType)) {
97
+ _context.next = 42;
73
98
  break;
74
99
  }
75
- _context.next = 14;
100
+ _context.next = 27;
76
101
  return (0, _effects.call)(_apis.fetchPlatformItem, {
77
102
  type: tree.platformItemType,
78
103
  id: tree.platformItemId
79
104
  });
80
- case 14:
81
- result = _context.sent;
82
- platformItem = result.platformItem;
83
- _context.next = 18;
105
+ case 27:
106
+ _yield$call = _context.sent;
107
+ platformItem = _yield$call.platformItem;
108
+ platformItemError = _yield$call.error;
109
+ if (!platformItem) {
110
+ _context.next = 41;
111
+ break;
112
+ }
113
+ _context.next = 33;
84
114
  return (0, _effects.call)(_apis.fetchWorkflow, (0, _objectSpread2["default"])({
85
115
  workflowId: sourceGroup
86
116
  }, getPlatformItemSlugs(platformItem)));
87
- case 18:
88
- _yield$call = _context.sent;
89
- workflow = _yield$call.workflow;
90
- // Add workflow filter from core to the tree to be used in the Settings > WorkflowForm
91
- tree['filter'] = workflow ? workflow.filter : '';
92
- case 21:
93
- _context.next = 23;
94
- return (0, _effects.put)((0, _store.action)('TREE_LOADED', {
117
+ case 33:
118
+ _yield$call2 = _context.sent;
119
+ linkedWorkflow = _yield$call2.workflow;
120
+ linkedError = _yield$call2.error;
121
+ workflowObject = linkedWorkflow;
122
+ workflowObjectError = linkedError;
123
+ // If workflow was loaded via the old tree route, set the kapp and
124
+ // form slugs from the platform item
125
+ if (!workflowProps) {
126
+ slugs = getPlatformItemSlugs(platformItem);
127
+ if (!kappSlug) {
128
+ kappSlug = slugs === null || slugs === void 0 ? void 0 : slugs.kappSlug;
129
+ }
130
+ if (!formSlug) {
131
+ formSlug = slugs === null || slugs === void 0 ? void 0 : slugs.formSlug;
132
+ }
133
+ }
134
+ _context.next = 42;
135
+ break;
136
+ case 41:
137
+ // If platform item was not retrieved, show an error because we don't
138
+ // want to render a workflow using a tree route
139
+ workflowObjectError = platformItemError || 'Failed to load linked workflow.';
140
+ case 42:
141
+ // If workflow, set sourceName to platformSourceName since the value is
142
+ // needed when creating new runs
143
+ treeObject = workflowObject ? (0, _objectSpread2["default"])({
144
+ sourceName: platformSourceName
145
+ }, workflowObject) : tree;
146
+ loadError = workflowObjectError || treeError || webApiError; // Find the operation ids of any integration nodes
147
+ operationIds = (treeObject === null || treeObject === void 0 ? void 0 : (_treeObject$treeJson = treeObject.treeJson) === null || _treeObject$treeJson === void 0 ? void 0 : (_treeObject$treeJson$ = _treeObject$treeJson.nodes) === null || _treeObject$treeJson$ === void 0 ? void 0 : _treeObject$treeJson$.map(function (node) {
148
+ var _node$parameters$find;
149
+ return node.definitionId.startsWith("".concat(_constants.ADVANCED_HANDLER_NAME_INTEGRATION, "_v")) ? (_node$parameters$find = node.parameters.find(function (p) {
150
+ return p.id === 'operation';
151
+ })) === null || _node$parameters$find === void 0 ? void 0 : _node$parameters$find.value : null;
152
+ }).filter(Boolean)) || [];
153
+ _context.next = 47;
154
+ return (0, _effects.all)([(0, _effects.put)((0, _store.action)('TREE_LOADED', {
95
155
  categories: categories,
96
- kappSlug: webApiProps && webApiProps.kappSlug || ((_getPlatformItemSlugs = getPlatformItemSlugs(platformItem)) === null || _getPlatformItemSlugs === void 0 ? void 0 : _getPlatformItemSlugs.kappSlug),
97
- platformItem: platformItem,
156
+ connections: connections,
157
+ kappSlug: kappSlug,
158
+ formSlug: formSlug,
98
159
  treeKey: treeKey,
99
- tree: (0, _models.deserializeTree)(tree),
100
- webApi: webApiProps && (0, _models.deserializeWebApi)(webApi, webApiProps.kappSlug)
101
- }));
102
- case 23:
103
- _context.next = 28;
160
+ tree:
161
+ // Don't set the tree if it's for a webApi but the webApi errors
162
+ treeObject && (!webApiProps || webApi) ? (0, _models.deserializeTree)(treeObject) : null,
163
+ webApi: webApi ? (0, _models.deserializeWebApi)(webApi, webApiProps.kappSlug) : null,
164
+ error: loadError ? loadError.message || loadError : null
165
+ })), operationIds.length > 0 ? (0, _effects.put)((0, _store.action)('TREE_LOAD_OPERATIONS', {
166
+ treeKey: treeKey,
167
+ operationIds: operationIds
168
+ })) : null]);
169
+ case 47:
170
+ _context.next = 52;
104
171
  break;
105
- case 25:
106
- _context.prev = 25;
172
+ case 49:
173
+ _context.prev = 49;
107
174
  _context.t0 = _context["catch"](0);
108
175
  console.error('Caught error loading tree', _context.t0);
109
- case 28:
176
+ case 52:
110
177
  case "end":
111
178
  return _context.stop();
112
179
  }
113
- }, _callee, null, [[0, 25]]);
180
+ }, _callee, null, [[0, 49]]);
114
181
  })();
115
182
  }));
116
- var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
117
- return platformItem !== null && platformItem !== void 0 && platformItem.kapp ? {
118
- formSlug: platformItem.slug,
119
- kappSlug: platformItem.kapp.slug
120
- } : platformItem !== null && platformItem !== void 0 && platformItem.space ? {
121
- kappSlug: platformItem.slug
122
- } : {};
123
- };
124
- (0, _store.regSaga)((0, _effects.takeEvery)('TREE_SAVE', function (_ref2) {
183
+ (0, _store.regSaga)((0, _effects.takeEvery)('TREE_LOAD_CONNECTIONS', function (_ref2) {
125
184
  var payload = _ref2.payload;
126
185
  return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
127
- var newName, onError, onSave, overwrite, treeKey, _yield$select, kappSlug, lastSave, lastWebApi, platformItem, tree, webApi, name, sourceGroup, sourceName, _yield, error1, newTree, newWorkflow, _yield2, error2, error;
186
+ var treeKey, _yield$call3, _yield$call3$connecti, connections;
128
187
  return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
129
188
  while (1) switch (_context2.prev = _context2.next) {
130
189
  case 0:
131
190
  _context2.prev = 0;
191
+ treeKey = payload.treeKey;
192
+ _context2.next = 4;
193
+ return (0, _effects.call)(_apis.fetchConnections);
194
+ case 4:
195
+ _yield$call3 = _context2.sent;
196
+ _yield$call3$connecti = _yield$call3.connections;
197
+ connections = _yield$call3$connecti === void 0 ? [] : _yield$call3$connecti;
198
+ _context2.next = 9;
199
+ return (0, _effects.put)((0, _store.action)('TREE_INTEGRATION_DATA_LOADED', {
200
+ connections: connections,
201
+ treeKey: treeKey
202
+ }));
203
+ case 9:
204
+ _context2.next = 14;
205
+ break;
206
+ case 11:
207
+ _context2.prev = 11;
208
+ _context2.t0 = _context2["catch"](0);
209
+ console.error('Caught error loading tree integration data', _context2.t0);
210
+ case 14:
211
+ case "end":
212
+ return _context2.stop();
213
+ }
214
+ }, _callee2, null, [[0, 11]]);
215
+ })();
216
+ }));
217
+ (0, _store.regSaga)((0, _effects.takeEvery)('TREE_LOAD_OPERATIONS', function (_ref3) {
218
+ var payload = _ref3.payload;
219
+ return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3() {
220
+ var treeKey, connectionId, _payload$operationIds, operationIds, _yield, _yield$operations, operations;
221
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
222
+ while (1) switch (_context3.prev = _context3.next) {
223
+ case 0:
224
+ _context3.prev = 0;
225
+ treeKey = payload.treeKey, connectionId = payload.connectionId, _payload$operationIds = payload.operationIds, operationIds = _payload$operationIds === void 0 ? [] : _payload$operationIds;
226
+ _context3.next = 4;
227
+ return connectionId ? (0, _effects.call)(_apis.fetchOperations, {
228
+ connectionId: connectionId
229
+ }) : (0, _effects.call)(_apis.fetchBulkOperations, {
230
+ ids: operationIds
231
+ });
232
+ case 4:
233
+ _yield = _context3.sent;
234
+ _yield$operations = _yield.operations;
235
+ operations = _yield$operations === void 0 ? [] : _yield$operations;
236
+ _context3.next = 9;
237
+ return (0, _effects.put)((0, _store.action)('TREE_INTEGRATION_DATA_LOADED', {
238
+ operations: operations,
239
+ treeKey: treeKey
240
+ }));
241
+ case 9:
242
+ _context3.next = 14;
243
+ break;
244
+ case 11:
245
+ _context3.prev = 11;
246
+ _context3.t0 = _context3["catch"](0);
247
+ console.error('Caught error loading tree integration data', _context3.t0);
248
+ case 14:
249
+ case "end":
250
+ return _context3.stop();
251
+ }
252
+ }, _callee3, null, [[0, 11]]);
253
+ })();
254
+ }));
255
+ var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
256
+ return (
257
+ // If platform item has a kapp property, then it's a form object
258
+ platformItem !== null && platformItem !== void 0 && platformItem.kapp ? {
259
+ formSlug: platformItem.slug,
260
+ kappSlug: platformItem.kapp.slug
261
+ } :
262
+ // If platform item has a space property, than it's a kapp object
263
+ platformItem !== null && platformItem !== void 0 && platformItem.space ? {
264
+ kappSlug: platformItem.slug
265
+ } : {}
266
+ );
267
+ };
268
+ (0, _store.regSaga)((0, _effects.takeEvery)('TREE_SAVE', function (_ref4) {
269
+ var payload = _ref4.payload;
270
+ return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee4() {
271
+ var newName, onError, onSave, overwrite, treeKey, _yield$select, kappSlug, formSlug, lastSave, lastWebApi, tree, webApi, name, sourceGroup, sourceName, _yield2, error1, newTree, newWorkflow, _yield3, error2, error;
272
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context4) {
273
+ while (1) switch (_context4.prev = _context4.next) {
274
+ case 0:
275
+ _context4.prev = 0;
132
276
  // because of the optimistic locking functionality newName / overwrite can
133
277
  // be passed as options to the builder's save function
134
278
  newName = payload.newName, onError = payload.onError, onSave = payload.onSave, overwrite = payload.overwrite, treeKey = payload.treeKey;
135
- _context2.next = 4;
279
+ _context4.next = 4;
136
280
  return (0, _effects.select)(function (state) {
137
281
  return state.getIn(['trees', treeKey]);
138
282
  });
139
283
  case 4:
140
- _yield$select = _context2.sent;
284
+ _yield$select = _context4.sent;
141
285
  kappSlug = _yield$select.kappSlug;
286
+ formSlug = _yield$select.formSlug;
142
287
  lastSave = _yield$select.lastSave;
143
288
  lastWebApi = _yield$select.lastWebApi;
144
- platformItem = _yield$select.platformItem;
145
289
  tree = _yield$select.tree;
146
290
  webApi = _yield$select.webApi;
147
291
  name = lastSave.name, sourceGroup = lastSave.sourceGroup, sourceName = lastSave.sourceName; // if a newName was passed we will be creating a new tree with the builder
148
292
  // contents, otherwise just an update
149
293
  // additionally, if the tree is a linked workflow then we call a core
150
294
  // endpoint to create the workflow
151
- _context2.next = 14;
152
- return newName ? tree.event ? (0, _effects.call)(_apis.createWorkflow, (0, _objectSpread2["default"])({
295
+ _context4.next = 14;
296
+ return newName ? tree.event ? (0, _effects.call)(_apis.createWorkflow, {
153
297
  workflow: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, (0, _models.serializeTree)(tree)), {}, {
154
298
  name: newName
155
- })
156
- }, getPlatformItemSlugs(platformItem))) : (0, _effects.call)(_apis.createTree, {
299
+ }),
300
+ kappSlug: kappSlug,
301
+ formSlug: formSlug
302
+ }) : (0, _effects.call)(_apis.createTree, {
157
303
  tree: (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, (0, _models.serializeTree)(tree, true)), {}, {
158
304
  name: newName
159
305
  })
160
- }) : tree.event ? (0, _effects.call)(_apis.updateWorkflow, (0, _objectSpread2["default"])({
306
+ }) : tree.event ? (0, _effects.call)(_apis.updateWorkflow, {
161
307
  workflowId: sourceGroup,
162
- workflow: (0, _models.serializeTree)(tree, overwrite)
163
- }, getPlatformItemSlugs(platformItem))) : (0, _effects.call)(_apis.updateTree, {
308
+ workflow: (0, _models.serializeTree)(tree, overwrite),
309
+ kappSlug: kappSlug,
310
+ formSlug: formSlug
311
+ }) : (0, _effects.call)(_apis.updateTree, {
164
312
  name: name,
165
313
  sourceGroup: sourceGroup,
166
314
  sourceName: sourceName,
167
315
  tree: (0, _models.serializeTree)(tree, overwrite)
168
316
  });
169
317
  case 14:
170
- _yield = _context2.sent;
171
- error1 = _yield.error;
172
- newTree = _yield.tree;
173
- newWorkflow = _yield.workflow;
174
- _context2.next = 20;
318
+ _yield2 = _context4.sent;
319
+ error1 = _yield2.error;
320
+ newTree = _yield2.tree;
321
+ newWorkflow = _yield2.workflow;
322
+ _context4.next = 20;
175
323
  return webApi && !error1 ? (0, _effects.call)(_apis.updateWebApi, {
176
324
  slug: lastWebApi.get('slug'),
177
325
  kappSlug: kappSlug,
178
326
  webApi: webApi
179
327
  }) : {};
180
328
  case 20:
181
- _yield2 = _context2.sent;
182
- error2 = _yield2.error;
329
+ _yield3 = _context4.sent;
330
+ error2 = _yield3.error;
183
331
  error = error1 || error2; // dispatch the appropriate action based on the result of the call above
184
- _context2.next = 25;
332
+ _context4.next = 25;
185
333
  return (0, _effects.put)(error ? (0, _store.action)('TREE_SAVE_ERROR', {
186
334
  treeKey: treeKey,
187
335
  error: error.message || error,
@@ -191,121 +339,133 @@ var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
191
339
  treeKey: treeKey,
192
340
  tree: newTree || newWorkflow,
193
341
  webApi: webApi,
194
- onSave: onSave
342
+ onSave: onSave,
343
+ scope: tree.event ? {
344
+ kappSlug: kappSlug,
345
+ formSlug: formSlug
346
+ } : undefined
195
347
  }));
196
348
  case 25:
197
- _context2.next = 30;
349
+ _context4.next = 30;
198
350
  break;
199
351
  case 27:
200
- _context2.prev = 27;
201
- _context2.t0 = _context2["catch"](0);
202
- console.error(_context2.t0);
352
+ _context4.prev = 27;
353
+ _context4.t0 = _context4["catch"](0);
354
+ console.error(_context4.t0);
203
355
  case 30:
204
356
  case "end":
205
- return _context2.stop();
357
+ return _context4.stop();
206
358
  }
207
- }, _callee2, null, [[0, 27]]);
359
+ }, _callee4, null, [[0, 27]]);
208
360
  })();
209
361
  }));
210
- (0, _store.regSaga)((0, _effects.takeEvery)('TREE_SAVE_ERROR', function (_ref3) {
211
- var _ref3$payload = _ref3.payload,
212
- error = _ref3$payload.error,
213
- onError = _ref3$payload.onError;
214
- return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3() {
215
- return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
216
- while (1) switch (_context3.prev = _context3.next) {
362
+ (0, _store.regSaga)((0, _effects.takeEvery)('TREE_SAVE_ERROR', function (_ref5) {
363
+ var _ref5$payload = _ref5.payload,
364
+ error = _ref5$payload.error,
365
+ onError = _ref5$payload.onError;
366
+ return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee5() {
367
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee5$(_context5) {
368
+ while (1) switch (_context5.prev = _context5.next) {
217
369
  case 0:
218
- _context3.prev = 0;
370
+ _context5.prev = 0;
219
371
  if (!(0, _lodashEs.isFunction)(onError)) {
220
- _context3.next = 4;
372
+ _context5.next = 4;
221
373
  break;
222
374
  }
223
- _context3.next = 4;
375
+ _context5.next = 4;
224
376
  return (0, _effects.call)(onError, error);
225
377
  case 4:
226
- _context3.next = 9;
378
+ _context5.next = 9;
227
379
  break;
228
380
  case 6:
229
- _context3.prev = 6;
230
- _context3.t0 = _context3["catch"](0);
231
- console.error(_context3.t0);
381
+ _context5.prev = 6;
382
+ _context5.t0 = _context5["catch"](0);
383
+ console.error(_context5.t0);
232
384
  case 9:
233
385
  case "end":
234
- return _context3.stop();
386
+ return _context5.stop();
235
387
  }
236
- }, _callee3, null, [[0, 6]]);
388
+ }, _callee5, null, [[0, 6]]);
237
389
  })();
238
390
  }));
239
- (0, _store.regSaga)((0, _effects.takeEvery)('TREE_SAVE_SUCCESS', function (_ref4) {
240
- var _ref4$payload = _ref4.payload,
241
- onSave = _ref4$payload.onSave,
242
- previousTree = _ref4$payload.previousTree,
243
- treeKey = _ref4$payload.treeKey;
244
- return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee4() {
391
+ (0, _store.regSaga)((0, _effects.takeEvery)('TREE_SAVE_SUCCESS', function (_ref6) {
392
+ var _ref6$payload = _ref6.payload,
393
+ onSave = _ref6$payload.onSave,
394
+ previousTree = _ref6$payload.previousTree,
395
+ treeKey = _ref6$payload.treeKey,
396
+ scope = _ref6$payload.scope;
397
+ return /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee6() {
245
398
  var tree;
246
- return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context4) {
247
- while (1) switch (_context4.prev = _context4.next) {
399
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee6$(_context6) {
400
+ while (1) switch (_context6.prev = _context6.next) {
248
401
  case 0:
249
- _context4.prev = 0;
402
+ _context6.prev = 0;
250
403
  if (!(0, _lodashEs.isFunction)(onSave)) {
251
- _context4.next = 7;
404
+ _context6.next = 7;
252
405
  break;
253
406
  }
254
- _context4.next = 4;
407
+ _context6.next = 4;
255
408
  return (0, _effects.select)(function (state) {
256
409
  return state.getIn(['trees', treeKey, 'tree']);
257
410
  });
258
411
  case 4:
259
- tree = _context4.sent;
260
- _context4.next = 7;
261
- return (0, _effects.call)(onSave, tree, previousTree);
412
+ tree = _context6.sent;
413
+ _context6.next = 7;
414
+ return (0, _effects.call)(onSave, tree, previousTree, scope);
262
415
  case 7:
263
- _context4.next = 12;
416
+ _context6.next = 12;
264
417
  break;
265
418
  case 9:
266
- _context4.prev = 9;
267
- _context4.t0 = _context4["catch"](0);
268
- console.error(_context4.t0);
419
+ _context6.prev = 9;
420
+ _context6.t0 = _context6["catch"](0);
421
+ console.error(_context6.t0);
269
422
  case 12:
270
423
  case "end":
271
- return _context4.stop();
424
+ return _context6.stop();
272
425
  }
273
- }, _callee4, null, [[0, 9]]);
426
+ }, _callee6, null, [[0, 9]]);
274
427
  })();
275
428
  }));
276
429
  (0, _store.regHandlers)({
277
430
  // the TreeBuilder component does nothing while the tree state is undefined,
278
431
  // on mount we set it to null to signal to the component to dispatch the
279
432
  // configure action with its configuration props
280
- TREE_MOUNT: function TREE_MOUNT(state, _ref5) {
281
- var treeKey = _ref5.payload.treeKey;
433
+ TREE_MOUNT: function TREE_MOUNT(state, _ref7) {
434
+ var treeKey = _ref7.payload.treeKey;
282
435
  return state.setIn(['trees', treeKey], null);
283
436
  },
284
- TREE_CONFIGURE: function TREE_CONFIGURE(state, _ref6) {
285
- var treeKey = _ref6.payload.treeKey;
437
+ TREE_CONFIGURE: function TREE_CONFIGURE(state, _ref8) {
438
+ var treeKey = _ref8.payload.treeKey;
286
439
  return state.setIn(['trees', treeKey], (0, _models.TreeBuilderState)());
287
440
  },
288
- TREE_UNMOUNT: function TREE_UNMOUNT(state, _ref7) {
289
- var treeKey = _ref7.payload.treeKey;
441
+ TREE_UNMOUNT: function TREE_UNMOUNT(state, _ref9) {
442
+ var treeKey = _ref9.payload.treeKey;
290
443
  return state.deleteIn(['trees', treeKey]);
291
444
  },
292
- TREE_LOADED: function TREE_LOADED(state, _ref8) {
293
- var _ref8$payload = _ref8.payload,
294
- categories = _ref8$payload.categories,
295
- kappSlug = _ref8$payload.kappSlug,
296
- platformItem = _ref8$payload.platformItem,
297
- treeKey = _ref8$payload.treeKey,
298
- tree = _ref8$payload.tree,
299
- webApi = _ref8$payload.webApi;
445
+ TREE_LOADED: function TREE_LOADED(state, _ref10) {
446
+ var _ref10$payload = _ref10.payload,
447
+ categories = _ref10$payload.categories,
448
+ connections = _ref10$payload.connections,
449
+ kappSlug = _ref10$payload.kappSlug,
450
+ formSlug = _ref10$payload.formSlug,
451
+ treeKey = _ref10$payload.treeKey,
452
+ tree = _ref10$payload.tree,
453
+ webApi = _ref10$payload.webApi,
454
+ error = _ref10$payload.error;
300
455
  return state.mergeIn(['trees', treeKey], {
456
+ connections: (0, _immutable.fromJS)(connections).sortBy(function (conn) {
457
+ return conn.name;
458
+ }).reduce(function (reduction, conn) {
459
+ return reduction.set(conn.get('id'), conn.set('operations', (0, _immutable.OrderedMap)()));
460
+ }, (0, _immutable.OrderedMap)()),
301
461
  kappSlug: kappSlug,
462
+ formSlug: formSlug,
302
463
  lastSave: tree,
303
464
  lastWebApi: webApi,
304
465
  loading: false,
305
- platformItem: platformItem,
306
466
  tasks: (0, _immutable.List)(categories).map(function (category) {
307
467
  return category.name === 'System Controls' ? (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, category), {}, {
308
- handlers: [].concat((0, _toConsumableArray2["default"])(category.handlers), [(0, _helpers.treeReturnTask)(tree)])
468
+ handlers: [].concat((0, _toConsumableArray2["default"])(category.handlers), [tree ? (0, _helpers.treeReturnTask)(tree) : null]).filter(Boolean)
309
469
  }) : category;
310
470
  }).flatMap(function (category) {
311
471
  return [].concat((0, _toConsumableArray2["default"])(category.handlers), (0, _toConsumableArray2["default"])(category.trees));
@@ -315,29 +475,49 @@ var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
315
475
  return reduction.set(task.definitionId, task);
316
476
  }, (0, _immutable.OrderedMap)()),
317
477
  tree: tree,
318
- webApi: webApi
478
+ webApi: webApi,
479
+ error: error
319
480
  });
320
481
  },
321
- TREE_SAVE: function TREE_SAVE(state, _ref9) {
322
- var treeKey = _ref9.payload.treeKey;
482
+ TREE_INTEGRATION_DATA_LOADED: function TREE_INTEGRATION_DATA_LOADED(state, _ref11) {
483
+ var _ref11$payload = _ref11.payload,
484
+ treeKey = _ref11$payload.treeKey,
485
+ connections = _ref11$payload.connections,
486
+ operations = _ref11$payload.operations;
487
+ return state.updateIn(['trees', treeKey, 'connections'], function (connectionsMap) {
488
+ // Update connections map in state if data was provided
489
+ var newConnectionsMap = connections ? (0, _immutable.fromJS)(connections).sortBy(function (conn) {
490
+ return conn.name;
491
+ }).reduce(function (reduction, conn) {
492
+ return reduction.set(conn.get('id'), conn.set('operations', connectionsMap.getIn([conn.get('id'), 'operations']) || (0, _immutable.OrderedMap)()));
493
+ }, (0, _immutable.OrderedMap)()) : connectionsMap;
494
+
495
+ // Update the operations maps in each connection if data was provided
496
+ return operations ? (0, _immutable.fromJS)(operations).reduce(function (map, op) {
497
+ return map.setIn([op.get('connectionId'), 'operations', op.get('id')], op);
498
+ }, newConnectionsMap) : newConnectionsMap;
499
+ });
500
+ },
501
+ TREE_SAVE: function TREE_SAVE(state, _ref12) {
502
+ var treeKey = _ref12.payload.treeKey;
323
503
  return state.mergeIn(['trees', treeKey], {
324
504
  saving: true
325
505
  });
326
506
  },
327
- TREE_SAVE_ERROR: function TREE_SAVE_ERROR(state, _ref10) {
328
- var _ref10$payload = _ref10.payload,
329
- treeKey = _ref10$payload.treeKey,
330
- error = _ref10$payload.error;
507
+ TREE_SAVE_ERROR: function TREE_SAVE_ERROR(state, _ref13) {
508
+ var _ref13$payload = _ref13.payload,
509
+ treeKey = _ref13$payload.treeKey,
510
+ error = _ref13$payload.error;
331
511
  return state.mergeIn(['trees', treeKey], {
332
512
  error: error,
333
513
  saving: false
334
514
  });
335
515
  },
336
- TREE_SAVE_SUCCESS: function TREE_SAVE_SUCCESS(state, _ref11) {
337
- var _ref11$payload = _ref11.payload,
338
- tree = _ref11$payload.tree,
339
- treeKey = _ref11$payload.treeKey,
340
- webApi = _ref11$payload.webApi;
516
+ TREE_SAVE_SUCCESS: function TREE_SAVE_SUCCESS(state, _ref14) {
517
+ var _ref14$payload = _ref14.payload,
518
+ tree = _ref14$payload.tree,
519
+ treeKey = _ref14$payload.treeKey,
520
+ webApi = _ref14$payload.webApi;
341
521
  var newTree = state.getIn(['trees', treeKey, 'tree']).merge({
342
522
  name: tree.name,
343
523
  sourceGroup: tree.sourceGroup,
@@ -353,8 +533,8 @@ var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
353
533
  webApi: webApi
354
534
  });
355
535
  },
356
- TREE_UNDO: function TREE_UNDO(state, _ref12) {
357
- var treeKey = _ref12.payload.treeKey;
536
+ TREE_UNDO: function TREE_UNDO(state, _ref15) {
537
+ var treeKey = _ref15.payload.treeKey;
358
538
  return state.getIn(['trees', treeKey, 'undoStack']).isEmpty() ? state : state.updateIn(['trees', treeKey], function (builderState) {
359
539
  return builderState.merge({
360
540
  tree: builderState.undoStack.last().tree,
@@ -367,8 +547,8 @@ var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
367
547
  });
368
548
  }).updateIn(['trees', treeKey], synchronizeRoutineDefinition);
369
549
  },
370
- TREE_REDO: function TREE_REDO(state, _ref13) {
371
- var treeKey = _ref13.payload.treeKey;
550
+ TREE_REDO: function TREE_REDO(state, _ref16) {
551
+ var treeKey = _ref16.payload.treeKey;
372
552
  return state.getIn(['trees', treeKey, 'redoStack']).isEmpty() ? state : state.updateIn(['trees', treeKey], function (builderState) {
373
553
  return builderState.merge({
374
554
  tree: builderState.redoStack.last().tree,
@@ -381,24 +561,24 @@ var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
381
561
  });
382
562
  }).updateIn(['trees', treeKey], synchronizeRoutineDefinition);
383
563
  },
384
- TREE_UPDATE: function TREE_UPDATE(state, _ref14) {
385
- var _ref14$payload = _ref14.payload,
386
- tree = _ref14$payload.tree,
387
- treeKey = _ref14$payload.treeKey;
564
+ TREE_UPDATE: function TREE_UPDATE(state, _ref17) {
565
+ var _ref17$payload = _ref17.payload,
566
+ tree = _ref17$payload.tree,
567
+ treeKey = _ref17$payload.treeKey;
388
568
  return remember(state, treeKey).setIn(['trees', treeKey, 'tree'], tree);
389
569
  },
390
- TREE_UPDATE_NODE: function TREE_UPDATE_NODE(state, _ref15) {
391
- var _ref15$payload = _ref15.payload,
392
- treeKey = _ref15$payload.treeKey,
393
- id = _ref15$payload.id,
394
- messages = _ref15$payload.messages,
395
- deferrable = _ref15$payload.deferrable,
396
- defers = _ref15$payload.defers,
397
- definitionId = _ref15$payload.definitionId,
398
- dependencies = _ref15$payload.dependencies,
399
- name = _ref15$payload.name,
400
- parameters = _ref15$payload.parameters,
401
- visible = _ref15$payload.visible;
570
+ TREE_UPDATE_NODE: function TREE_UPDATE_NODE(state, _ref18) {
571
+ var _ref18$payload = _ref18.payload,
572
+ treeKey = _ref18$payload.treeKey,
573
+ id = _ref18$payload.id,
574
+ messages = _ref18$payload.messages,
575
+ deferrable = _ref18$payload.deferrable,
576
+ defers = _ref18$payload.defers,
577
+ definitionId = _ref18$payload.definitionId,
578
+ dependencies = _ref18$payload.dependencies,
579
+ name = _ref18$payload.name,
580
+ parameters = _ref18$payload.parameters,
581
+ visible = _ref18$payload.visible;
402
582
  return remember(state, treeKey).mergeIn(['trees', treeKey, 'tree', 'nodes', id], {
403
583
  deferrable: deferrable,
404
584
  defers: defers,
@@ -409,28 +589,28 @@ var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
409
589
  visible: visible
410
590
  }).updateIn(['trees', treeKey, 'tree'], (0, _helpers.renameDependencies)(dependencies, name));
411
591
  },
412
- TREE_UPDATE_NODE_POSITION: function TREE_UPDATE_NODE_POSITION(state, _ref16) {
413
- var _ref16$payload = _ref16.payload,
414
- treeKey = _ref16$payload.treeKey,
415
- id = _ref16$payload.id,
416
- position = _ref16$payload.position;
592
+ TREE_UPDATE_NODE_POSITION: function TREE_UPDATE_NODE_POSITION(state, _ref19) {
593
+ var _ref19$payload = _ref19.payload,
594
+ treeKey = _ref19$payload.treeKey,
595
+ id = _ref19$payload.id,
596
+ position = _ref19$payload.position;
417
597
  return remember(state, treeKey).setIn(['trees', treeKey, 'tree', 'nodes', id, 'position'], position);
418
598
  },
419
- TREE_REMOVE_NODE: function TREE_REMOVE_NODE(state, _ref17) {
420
- var _ref17$payload = _ref17.payload,
421
- treeKey = _ref17$payload.treeKey,
422
- id = _ref17$payload.id;
599
+ TREE_REMOVE_NODE: function TREE_REMOVE_NODE(state, _ref20) {
600
+ var _ref20$payload = _ref20.payload,
601
+ treeKey = _ref20$payload.treeKey,
602
+ id = _ref20$payload.id;
423
603
  return remember(state, treeKey).deleteIn(['trees', treeKey, 'tree', 'nodes', id]).updateIn(['trees', treeKey, 'tree', 'connectors'], function (connectors) {
424
604
  return connectors.filter(function (connector) {
425
605
  return connector.headId !== id && connector.tailId !== id;
426
606
  });
427
607
  });
428
608
  },
429
- TREE_ADD_CONNECTOR: function TREE_ADD_CONNECTOR(state, _ref18) {
430
- var _ref18$payload = _ref18.payload,
431
- treeKey = _ref18$payload.treeKey,
432
- headId = _ref18$payload.headId,
433
- tailId = _ref18$payload.tailId;
609
+ TREE_ADD_CONNECTOR: function TREE_ADD_CONNECTOR(state, _ref21) {
610
+ var _ref21$payload = _ref21.payload,
611
+ treeKey = _ref21$payload.treeKey,
612
+ headId = _ref21$payload.headId,
613
+ tailId = _ref21$payload.tailId;
434
614
  return remember(state, treeKey).updateIn(['trees', treeKey, 'tree'], function (tree) {
435
615
  return tree.update('connectors', function (connectors) {
436
616
  return connectors.set(tree.nextConnectorId, (0, _models.Connector)({
@@ -443,43 +623,43 @@ var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
443
623
  });
444
624
  });
445
625
  },
446
- TREE_UPDATE_CONNECTOR: function TREE_UPDATE_CONNECTOR(state, _ref19) {
447
- var _ref19$payload = _ref19.payload,
448
- treeKey = _ref19$payload.treeKey,
449
- id = _ref19$payload.id,
450
- type = _ref19$payload.type,
451
- label = _ref19$payload.label,
452
- condition = _ref19$payload.condition;
626
+ TREE_UPDATE_CONNECTOR: function TREE_UPDATE_CONNECTOR(state, _ref22) {
627
+ var _ref22$payload = _ref22.payload,
628
+ treeKey = _ref22$payload.treeKey,
629
+ id = _ref22$payload.id,
630
+ type = _ref22$payload.type,
631
+ label = _ref22$payload.label,
632
+ condition = _ref22$payload.condition;
453
633
  return state.hasIn(['trees', treeKey, 'tree', 'connectors', id]) ? remember(state, treeKey).mergeIn(['trees', treeKey, 'tree', 'connectors', id], {
454
634
  type: type,
455
635
  label: label,
456
636
  condition: condition
457
637
  }) : state;
458
638
  },
459
- TREE_REMOVE_CONNECTOR: function TREE_REMOVE_CONNECTOR(state, _ref20) {
460
- var _ref20$payload = _ref20.payload,
461
- treeKey = _ref20$payload.treeKey,
462
- id = _ref20$payload.id;
639
+ TREE_REMOVE_CONNECTOR: function TREE_REMOVE_CONNECTOR(state, _ref23) {
640
+ var _ref23$payload = _ref23.payload,
641
+ treeKey = _ref23$payload.treeKey,
642
+ id = _ref23$payload.id;
463
643
  return remember(state, treeKey).deleteIn(['trees', treeKey, 'tree', 'connectors', id]);
464
644
  },
465
- TREE_UPDATE_CONNECTOR_HEAD: function TREE_UPDATE_CONNECTOR_HEAD(state, _ref21) {
466
- var _ref21$payload = _ref21.payload,
467
- treeKey = _ref21$payload.treeKey,
468
- id = _ref21$payload.id,
469
- nodeId = _ref21$payload.nodeId;
645
+ TREE_UPDATE_CONNECTOR_HEAD: function TREE_UPDATE_CONNECTOR_HEAD(state, _ref24) {
646
+ var _ref24$payload = _ref24.payload,
647
+ treeKey = _ref24$payload.treeKey,
648
+ id = _ref24$payload.id,
649
+ nodeId = _ref24$payload.nodeId;
470
650
  return remember(state, treeKey).setIn(['trees', treeKey, 'tree', 'connectors', id, 'headId'], nodeId);
471
651
  },
472
- TREE_UPDATE_CONNECTOR_TAIL: function TREE_UPDATE_CONNECTOR_TAIL(state, _ref22) {
473
- var _ref22$payload = _ref22.payload,
474
- treeKey = _ref22$payload.treeKey,
475
- id = _ref22$payload.id,
476
- nodeId = _ref22$payload.nodeId;
652
+ TREE_UPDATE_CONNECTOR_TAIL: function TREE_UPDATE_CONNECTOR_TAIL(state, _ref25) {
653
+ var _ref25$payload = _ref25.payload,
654
+ treeKey = _ref25$payload.treeKey,
655
+ id = _ref25$payload.id,
656
+ nodeId = _ref25$payload.nodeId;
477
657
  return remember(state, treeKey).setIn(['trees', treeKey, 'tree', 'connectors', id, 'tailId'], nodeId);
478
658
  },
479
- TREE_UPDATE_SETTINGS: function TREE_UPDATE_SETTINGS(state, _ref23) {
480
- var _ref23$payload = _ref23.payload,
481
- treeKey = _ref23$payload.treeKey,
482
- values = _ref23$payload.values;
659
+ TREE_UPDATE_SETTINGS: function TREE_UPDATE_SETTINGS(state, _ref26) {
660
+ var _ref26$payload = _ref26.payload,
661
+ treeKey = _ref26$payload.treeKey,
662
+ values = _ref26$payload.values;
483
663
  // If the updated settings are for a routine we rebuild the "Tree Input"
484
664
  // bindings.
485
665
  var bindings = values.inputs ? (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state.getIn(['trees', treeKey, 'tree', 'bindings'])), {}, {
@@ -495,10 +675,10 @@ var getPlatformItemSlugs = function getPlatformItemSlugs(platformItem) {
495
675
  bindings: bindings
496
676
  })).updateIn(['trees', treeKey], synchronizeRoutineDefinition);
497
677
  },
498
- TREE_UPDATE_WEB_API: function TREE_UPDATE_WEB_API(state, _ref24) {
499
- var _ref24$payload = _ref24.payload,
500
- treeKey = _ref24$payload.treeKey,
501
- values = _ref24$payload.values;
678
+ TREE_UPDATE_WEB_API: function TREE_UPDATE_WEB_API(state, _ref27) {
679
+ var _ref27$payload = _ref27.payload,
680
+ treeKey = _ref27$payload.treeKey,
681
+ values = _ref27$payload.values;
502
682
  return remember(state, treeKey).mergeIn(['trees', treeKey, 'webApi'], values).setIn(['trees', treeKey, 'tree', 'name'], values.slug).setIn(['trees', treeKey, 'tree', 'ownerEmail'], values.ownerEmail);
503
683
  }
504
684
  });
@@ -516,11 +696,11 @@ var synchronizeRoutineDefinition = function synchronizeRoutineDefinition(treeBui
516
696
  });
517
697
  });
518
698
  };
519
- var getWebApiProps = function getWebApiProps(_ref25) {
520
- var name = _ref25.name,
521
- platformSourceName = _ref25.platformSourceName,
522
- sourceGroup = _ref25.sourceGroup,
523
- sourceName = _ref25.sourceName;
699
+ var getWebApiProps = function getWebApiProps(_ref28) {
700
+ var name = _ref28.name,
701
+ platformSourceName = _ref28.platformSourceName,
702
+ sourceGroup = _ref28.sourceGroup,
703
+ sourceName = _ref28.sourceName;
524
704
  if (sourceName === platformSourceName && sourceGroup.startsWith('WebApis')) {
525
705
  var kappSlug = sourceGroup.startsWith('WebApis > ') ? sourceGroup.replace('WebApis > ', '') : undefined;
526
706
  var slug = name;
@@ -530,4 +710,18 @@ var getWebApiProps = function getWebApiProps(_ref25) {
530
710
  };
531
711
  }
532
712
  return null;
713
+ };
714
+ var getWorkflowProps = function getWorkflowProps(_ref29) {
715
+ var type = _ref29.type,
716
+ sourceGroup = _ref29.sourceGroup,
717
+ kappSlug = _ref29.kappSlug,
718
+ formSlug = _ref29.formSlug;
719
+ if (type === 'workflow') {
720
+ return {
721
+ workflowId: sourceGroup,
722
+ kappSlug: kappSlug,
723
+ formSlug: formSlug
724
+ };
725
+ }
726
+ return null;
533
727
  };