@activepieces/shared 0.10.120 → 0.10.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.d.ts +5 -2
- package/src/index.js +5 -2
- package/src/index.js.map +1 -1
- package/src/lib/app-connection/app-connection.d.ts +10 -0
- package/src/lib/app-connection/app-connection.js +2 -1
- package/src/lib/app-connection/app-connection.js.map +1 -1
- package/src/lib/common/activepieces-error.d.ts +9 -3
- package/src/lib/common/activepieces-error.js +1 -0
- package/src/lib/common/activepieces-error.js.map +1 -1
- package/src/lib/common/utils/utils.d.ts +1 -0
- package/src/lib/common/utils/utils.js +4 -0
- package/src/lib/common/utils/utils.js.map +1 -1
- package/src/lib/engine/requests.d.ts +4 -4
- package/src/lib/flow-run/execution/flow-execution.d.ts +4 -4
- package/src/lib/flow-run/execution/flow-execution.js +2 -2
- package/src/lib/flow-run/execution/flow-execution.js.map +1 -1
- package/src/lib/flow-run/execution/step-output.d.ts +10 -2
- package/src/lib/flow-run/execution/step-output.js +13 -3
- package/src/lib/flow-run/execution/step-output.js.map +1 -1
- package/src/lib/flow-run/test-flow-run-request.d.ts +12 -0
- package/src/lib/flow-run/test-flow-run-request.js +12 -1
- package/src/lib/flow-run/test-flow-run-request.js.map +1 -1
- package/src/lib/flows/actions/action.d.ts +224 -1
- package/src/lib/flows/actions/action.js +70 -10
- package/src/lib/flows/actions/action.js.map +1 -1
- package/src/lib/flows/dto/flow-template-request.d.ts +5 -0
- package/src/lib/flows/dto/flow-template-request.js +1 -1
- package/src/lib/flows/dto/flow-template-request.js.map +1 -1
- package/src/lib/flows/flow-version.d.ts +3 -9
- package/src/lib/flows/flow-version.js +4 -3
- package/src/lib/flows/flow-version.js.map +1 -1
- package/src/lib/flows/flow.d.ts +1 -0
- package/src/lib/flows/operations/add-action.d.ts +4 -0
- package/src/lib/flows/operations/add-action.js +129 -0
- package/src/lib/flows/operations/add-action.js.map +1 -0
- package/src/lib/flows/operations/add-branch.d.ts +4 -0
- package/src/lib/flows/operations/add-branch.js +16 -0
- package/src/lib/flows/operations/add-branch.js.map +1 -0
- package/src/lib/flows/operations/delete-action.d.ts +4 -0
- package/src/lib/flows/operations/delete-action.js +50 -0
- package/src/lib/flows/operations/delete-action.js.map +1 -0
- package/src/lib/flows/operations/delete-branch.d.ts +4 -0
- package/src/lib/flows/operations/delete-branch.js +15 -0
- package/src/lib/flows/operations/delete-branch.js.map +1 -0
- package/src/lib/flows/operations/duplicate-step.d.ts +5 -0
- package/src/lib/flows/operations/duplicate-step.js +115 -0
- package/src/lib/flows/operations/duplicate-step.js.map +1 -0
- package/src/lib/flows/operations/flow-piece-util.d.ts +8 -0
- package/src/lib/flows/operations/flow-piece-util.js +45 -0
- package/src/lib/flows/operations/flow-piece-util.js.map +1 -0
- package/src/lib/flows/operations/import-flow.d.ts +7 -0
- package/src/lib/flows/operations/import-flow.js +159 -0
- package/src/lib/flows/operations/import-flow.js.map +1 -0
- package/src/lib/flows/{flow-operations.d.ts → operations/index.d.ts} +292 -59
- package/src/lib/flows/operations/index.js +282 -0
- package/src/lib/flows/operations/index.js.map +1 -0
- package/src/lib/flows/operations/migrations/index.d.ts +47 -0
- package/src/lib/flows/operations/migrations/index.js +12 -0
- package/src/lib/flows/operations/migrations/index.js.map +1 -0
- package/src/lib/flows/operations/migrations/migrate-branch-to-router.d.ts +2 -0
- package/src/lib/flows/operations/migrations/migrate-branch-to-router.js +50 -0
- package/src/lib/flows/operations/migrations/migrate-branch-to-router.js.map +1 -0
- package/src/lib/flows/operations/move-action.d.ts +3 -0
- package/src/lib/flows/operations/move-action.js +36 -0
- package/src/lib/flows/operations/move-action.js.map +1 -0
- package/src/lib/flows/operations/update-action.d.ts +4 -0
- package/src/lib/flows/operations/update-action.js +33 -0
- package/src/lib/flows/operations/update-action.js.map +1 -0
- package/src/lib/flows/operations/update-trigger.d.ts +4 -0
- package/src/lib/flows/operations/update-trigger.js +38 -0
- package/src/lib/flows/operations/update-trigger.js.map +1 -0
- package/src/lib/flows/util/flow-piece-util.d.ts +8 -0
- package/src/lib/flows/util/flow-piece-util.js +45 -0
- package/src/lib/flows/util/flow-piece-util.js.map +1 -0
- package/src/lib/flows/util/flow-structure-util.d.ts +54 -0
- package/src/lib/flows/util/flow-structure-util.js +164 -0
- package/src/lib/flows/util/flow-structure-util.js.map +1 -0
- package/src/lib/pieces/piece.d.ts +2 -0
- package/src/lib/pieces/piece.js +2 -0
- package/src/lib/pieces/piece.js.map +1 -1
- package/src/lib/platform/platform.model.d.ts +2 -0
- package/src/lib/platform/platform.model.js +2 -2
- package/src/lib/platform/platform.model.js.map +1 -1
- package/src/lib/platform/platform.request.d.ts +1 -0
- package/src/lib/platform/platform.request.js +2 -2
- package/src/lib/platform/platform.request.js.map +1 -1
- package/src/lib/project/project.d.ts +1 -1
- package/src/lib/property/markdown/index.d.ts +6 -0
- package/src/lib/property/markdown/index.js +11 -0
- package/src/lib/property/markdown/index.js.map +1 -0
- package/src/lib/store-entry/dto/store-entry-request.d.ts +1 -1
- package/src/lib/store-entry/dto/store-entry-request.js +1 -1
- package/src/lib/store-entry/dto/store-entry-request.js.map +1 -1
- package/src/lib/user/user-dto.d.ts +1 -1
- package/src/lib/websocket/index.d.ts +2 -2
- package/src/lib/websocket/index.js +1 -1
- package/src/lib/websocket/index.js.map +1 -1
- package/src/lib/flows/flow-helper.d.ts +0 -62
- package/src/lib/flows/flow-helper.js +0 -745
- package/src/lib/flows/flow-helper.js.map +0 -1
- package/src/lib/flows/flow-operations.js +0 -148
- package/src/lib/flows/flow-operations.js.map +0 -1
|
@@ -1,745 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flowHelper = void 0;
|
|
4
|
-
exports.getImportOperations = getImportOperations;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const compiler_1 = require("@sinclair/typebox/compiler");
|
|
7
|
-
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
const activepieces_error_1 = require("../common/activepieces-error");
|
|
10
|
-
const action_1 = require("./actions/action");
|
|
11
|
-
const flow_operations_1 = require("./flow-operations");
|
|
12
|
-
const flow_version_1 = require("./flow-version");
|
|
13
|
-
const sample_data_1 = require("./sample-data");
|
|
14
|
-
const trigger_1 = require("./triggers/trigger");
|
|
15
|
-
const actionSchemaValidator = compiler_1.TypeCompiler.Compile(action_1.SingleActionSchema);
|
|
16
|
-
const triggerSchemaValidation = compiler_1.TypeCompiler.Compile(trigger_1.Trigger);
|
|
17
|
-
function isValid(flowVersion) {
|
|
18
|
-
let valid = true;
|
|
19
|
-
const steps = exports.flowHelper.getAllSteps(flowVersion.trigger);
|
|
20
|
-
for (let i = 0; i < steps.length; i++) {
|
|
21
|
-
const step = steps[i];
|
|
22
|
-
valid = valid && step.valid;
|
|
23
|
-
}
|
|
24
|
-
return valid;
|
|
25
|
-
}
|
|
26
|
-
function isAction(type) {
|
|
27
|
-
return Object.entries(action_1.ActionType).some(([, value]) => value === type);
|
|
28
|
-
}
|
|
29
|
-
function isTrigger(type) {
|
|
30
|
-
return Object.entries(trigger_1.TriggerType).some(([, value]) => value === type);
|
|
31
|
-
}
|
|
32
|
-
function deleteAction(flowVersion, request) {
|
|
33
|
-
return transferFlow(flowVersion, (parentStep) => {
|
|
34
|
-
if (parentStep.nextAction && parentStep.nextAction.name === request.name) {
|
|
35
|
-
const stepToUpdate = parentStep.nextAction;
|
|
36
|
-
parentStep.nextAction = stepToUpdate.nextAction;
|
|
37
|
-
}
|
|
38
|
-
switch (parentStep.type) {
|
|
39
|
-
case action_1.ActionType.BRANCH: {
|
|
40
|
-
if (parentStep.onFailureAction &&
|
|
41
|
-
parentStep.onFailureAction.name === request.name) {
|
|
42
|
-
const stepToUpdate = parentStep.onFailureAction;
|
|
43
|
-
parentStep.onFailureAction = stepToUpdate.nextAction;
|
|
44
|
-
}
|
|
45
|
-
if (parentStep.onSuccessAction &&
|
|
46
|
-
parentStep.onSuccessAction.name === request.name) {
|
|
47
|
-
const stepToUpdate = parentStep.onSuccessAction;
|
|
48
|
-
parentStep.onSuccessAction = stepToUpdate.nextAction;
|
|
49
|
-
}
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case action_1.ActionType.LOOP_ON_ITEMS: {
|
|
53
|
-
if (parentStep.firstLoopAction &&
|
|
54
|
-
parentStep.firstLoopAction.name === request.name) {
|
|
55
|
-
const stepToUpdate = parentStep.firstLoopAction;
|
|
56
|
-
parentStep.firstLoopAction = stepToUpdate.nextAction;
|
|
57
|
-
}
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
default:
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
return parentStep;
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
function getUsedPieces(trigger) {
|
|
67
|
-
return traverseInternal(trigger)
|
|
68
|
-
.filter((step) => step.type === action_1.ActionType.PIECE || step.type === trigger_1.TriggerType.PIECE)
|
|
69
|
-
.map((step) => step.settings.pieceName)
|
|
70
|
-
.filter((value, index, self) => self.indexOf(value) === index);
|
|
71
|
-
}
|
|
72
|
-
function traverseInternal(step) {
|
|
73
|
-
const steps = [];
|
|
74
|
-
while (step !== undefined && step !== null) {
|
|
75
|
-
steps.push(step);
|
|
76
|
-
if (step.type === action_1.ActionType.BRANCH) {
|
|
77
|
-
steps.push(...traverseInternal(step.onSuccessAction));
|
|
78
|
-
steps.push(...traverseInternal(step.onFailureAction));
|
|
79
|
-
}
|
|
80
|
-
if (step.type === action_1.ActionType.LOOP_ON_ITEMS) {
|
|
81
|
-
steps.push(...traverseInternal(step.firstLoopAction));
|
|
82
|
-
}
|
|
83
|
-
step = step.nextAction;
|
|
84
|
-
}
|
|
85
|
-
return steps;
|
|
86
|
-
}
|
|
87
|
-
function updateFlowSecrets(originalFlow, newFlow) {
|
|
88
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
return transferFlow(newFlow.version, (step) => {
|
|
90
|
-
var _a, _b;
|
|
91
|
-
const oldStep = getStep(originalFlow.version, step.name);
|
|
92
|
-
if ((_b = (_a = oldStep === null || oldStep === void 0 ? void 0 : oldStep.settings) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.auth) {
|
|
93
|
-
step.settings.input.auth = oldStep.settings.input.auth;
|
|
94
|
-
}
|
|
95
|
-
return step;
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
function transferStepAsync(step, transferFunction) {
|
|
100
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
const updatedStep = yield transferFunction(step);
|
|
102
|
-
if (updatedStep.type === action_1.ActionType.BRANCH) {
|
|
103
|
-
const { onSuccessAction, onFailureAction } = updatedStep;
|
|
104
|
-
if (onSuccessAction) {
|
|
105
|
-
updatedStep.onSuccessAction = (yield transferStepAsync(onSuccessAction, transferFunction));
|
|
106
|
-
}
|
|
107
|
-
if (onFailureAction) {
|
|
108
|
-
updatedStep.onFailureAction = (yield transferStepAsync(onFailureAction, transferFunction));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else if (updatedStep.type === action_1.ActionType.LOOP_ON_ITEMS) {
|
|
112
|
-
const { firstLoopAction } = updatedStep;
|
|
113
|
-
if (firstLoopAction) {
|
|
114
|
-
updatedStep.firstLoopAction = (yield transferStepAsync(firstLoopAction, transferFunction));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (updatedStep.nextAction) {
|
|
118
|
-
updatedStep.nextAction = (yield transferStepAsync(updatedStep.nextAction, transferFunction));
|
|
119
|
-
}
|
|
120
|
-
return updatedStep;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function transferStep(step, transferFunction) {
|
|
124
|
-
const updatedStep = transferFunction(step);
|
|
125
|
-
if (updatedStep.type === action_1.ActionType.BRANCH) {
|
|
126
|
-
const { onSuccessAction, onFailureAction } = updatedStep;
|
|
127
|
-
if (onSuccessAction) {
|
|
128
|
-
updatedStep.onSuccessAction = transferStep(onSuccessAction, transferFunction);
|
|
129
|
-
}
|
|
130
|
-
if (onFailureAction) {
|
|
131
|
-
updatedStep.onFailureAction = transferStep(onFailureAction, transferFunction);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
else if (updatedStep.type === action_1.ActionType.LOOP_ON_ITEMS) {
|
|
135
|
-
const { firstLoopAction } = updatedStep;
|
|
136
|
-
if (firstLoopAction) {
|
|
137
|
-
updatedStep.firstLoopAction = transferStep(firstLoopAction, transferFunction);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
if (updatedStep.nextAction) {
|
|
141
|
-
updatedStep.nextAction = transferStep(updatedStep.nextAction, transferFunction);
|
|
142
|
-
}
|
|
143
|
-
return updatedStep;
|
|
144
|
-
}
|
|
145
|
-
function transferFlowAsync(flowVersion, transferFunction) {
|
|
146
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const clonedFlow = JSON.parse(JSON.stringify(flowVersion));
|
|
148
|
-
clonedFlow.trigger = (yield transferStepAsync(clonedFlow.trigger, transferFunction));
|
|
149
|
-
return clonedFlow;
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
function transferFlow(flowVersion, transferFunction) {
|
|
153
|
-
const clonedFlow = JSON.parse(JSON.stringify(flowVersion));
|
|
154
|
-
clonedFlow.trigger = transferStep(clonedFlow.trigger, transferFunction);
|
|
155
|
-
return clonedFlow;
|
|
156
|
-
}
|
|
157
|
-
function getAllSteps(trigger) {
|
|
158
|
-
return traverseInternal(trigger);
|
|
159
|
-
}
|
|
160
|
-
function getAllStepsAtFirstLevel(step) {
|
|
161
|
-
const steps = [];
|
|
162
|
-
steps.push(step);
|
|
163
|
-
let nextAction = step.nextAction;
|
|
164
|
-
while (nextAction !== undefined) {
|
|
165
|
-
steps.push(nextAction);
|
|
166
|
-
nextAction = nextAction.nextAction;
|
|
167
|
-
}
|
|
168
|
-
return steps;
|
|
169
|
-
}
|
|
170
|
-
function getAllChildSteps(action) {
|
|
171
|
-
switch (action.type) {
|
|
172
|
-
case action_1.ActionType.LOOP_ON_ITEMS:
|
|
173
|
-
return traverseInternal(action.firstLoopAction);
|
|
174
|
-
default:
|
|
175
|
-
return [
|
|
176
|
-
...traverseInternal(action.onSuccessAction),
|
|
177
|
-
...traverseInternal(action.onFailureAction),
|
|
178
|
-
];
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
function getAllDirectChildStepsForLoop(action) {
|
|
182
|
-
const actions = [];
|
|
183
|
-
let child = action.firstLoopAction;
|
|
184
|
-
while (child) {
|
|
185
|
-
actions.push(child);
|
|
186
|
-
child = child.nextAction;
|
|
187
|
-
}
|
|
188
|
-
return actions;
|
|
189
|
-
}
|
|
190
|
-
function getAllDirectChildStepsForBranch(action, branch) {
|
|
191
|
-
const actions = [];
|
|
192
|
-
if (branch === 'success') {
|
|
193
|
-
let child = action.onSuccessAction;
|
|
194
|
-
while (child) {
|
|
195
|
-
actions.push(child);
|
|
196
|
-
child = child.nextAction;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
let child = action.onFailureAction;
|
|
201
|
-
while (child) {
|
|
202
|
-
actions.push(child);
|
|
203
|
-
child = child.nextAction;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return actions;
|
|
207
|
-
}
|
|
208
|
-
function getStep(flowVersion, stepName) {
|
|
209
|
-
return getAllSteps(flowVersion.trigger).find((step) => step.name === stepName);
|
|
210
|
-
}
|
|
211
|
-
const getStepFromSubFlow = ({ subFlowStartStep, stepName, }) => {
|
|
212
|
-
const subFlowSteps = getAllSteps(subFlowStartStep);
|
|
213
|
-
return subFlowSteps.find((step) => step.name === stepName);
|
|
214
|
-
};
|
|
215
|
-
function updateAction(flowVersion, request) {
|
|
216
|
-
return transferFlow(flowVersion, (parentStep) => {
|
|
217
|
-
if (parentStep.nextAction && parentStep.nextAction.name === request.name) {
|
|
218
|
-
const actions = extractActions(parentStep.nextAction);
|
|
219
|
-
parentStep.nextAction = createAction(request, actions);
|
|
220
|
-
}
|
|
221
|
-
if (parentStep.type === action_1.ActionType.BRANCH) {
|
|
222
|
-
if (parentStep.onFailureAction &&
|
|
223
|
-
parentStep.onFailureAction.name === request.name) {
|
|
224
|
-
const actions = extractActions(parentStep.onFailureAction);
|
|
225
|
-
parentStep.onFailureAction = createAction(request, actions);
|
|
226
|
-
}
|
|
227
|
-
if (parentStep.onSuccessAction &&
|
|
228
|
-
parentStep.onSuccessAction.name === request.name) {
|
|
229
|
-
const actions = extractActions(parentStep.onSuccessAction);
|
|
230
|
-
parentStep.onSuccessAction = createAction(request, actions);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
if (parentStep.type === action_1.ActionType.LOOP_ON_ITEMS) {
|
|
234
|
-
if (parentStep.firstLoopAction &&
|
|
235
|
-
parentStep.firstLoopAction.name === request.name) {
|
|
236
|
-
const actions = extractActions(parentStep.firstLoopAction);
|
|
237
|
-
parentStep.firstLoopAction = createAction(request, actions);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return parentStep;
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
function extractActions(step) {
|
|
244
|
-
const nextAction = step.nextAction;
|
|
245
|
-
const onSuccessAction = step.type === action_1.ActionType.BRANCH ? step.onSuccessAction : undefined;
|
|
246
|
-
const onFailureAction = step.type === action_1.ActionType.BRANCH ? step.onFailureAction : undefined;
|
|
247
|
-
const firstLoopAction = step.type === action_1.ActionType.LOOP_ON_ITEMS ? step.firstLoopAction : undefined;
|
|
248
|
-
return { nextAction, onSuccessAction, onFailureAction, firstLoopAction };
|
|
249
|
-
}
|
|
250
|
-
function moveAction(flowVersion, request) {
|
|
251
|
-
const steps = getAllSteps(flowVersion.trigger);
|
|
252
|
-
const sourceStep = steps.find((step) => step.name === request.name);
|
|
253
|
-
if (!sourceStep || !isAction(sourceStep.type)) {
|
|
254
|
-
throw new activepieces_error_1.ActivepiecesError({
|
|
255
|
-
code: activepieces_error_1.ErrorCode.FLOW_OPERATION_INVALID,
|
|
256
|
-
params: {},
|
|
257
|
-
}, `Source step ${request.name} not found`);
|
|
258
|
-
}
|
|
259
|
-
const destinationStep = steps.find((step) => step.name === request.newParentStep);
|
|
260
|
-
if (!destinationStep) {
|
|
261
|
-
throw new activepieces_error_1.ActivepiecesError({
|
|
262
|
-
code: activepieces_error_1.ErrorCode.FLOW_OPERATION_INVALID,
|
|
263
|
-
params: {},
|
|
264
|
-
}, `Destination step ${request.newParentStep} not found`);
|
|
265
|
-
}
|
|
266
|
-
const childOperation = [];
|
|
267
|
-
const clonedSourceStep = JSON.parse(JSON.stringify(sourceStep));
|
|
268
|
-
if (clonedSourceStep.type === action_1.ActionType.LOOP_ON_ITEMS ||
|
|
269
|
-
clonedSourceStep.type === action_1.ActionType.BRANCH) {
|
|
270
|
-
// Don't Clone the next action for first step only
|
|
271
|
-
clonedSourceStep.nextAction = undefined;
|
|
272
|
-
childOperation.push(...getImportOperations(clonedSourceStep));
|
|
273
|
-
}
|
|
274
|
-
flowVersion = deleteAction(flowVersion, { name: request.name });
|
|
275
|
-
flowVersion = addAction(flowVersion, {
|
|
276
|
-
action: sourceStep,
|
|
277
|
-
parentStep: request.newParentStep,
|
|
278
|
-
stepLocationRelativeToParent: request.stepLocationRelativeToNewParent,
|
|
279
|
-
});
|
|
280
|
-
childOperation.forEach((operation) => {
|
|
281
|
-
flowVersion = exports.flowHelper.apply(flowVersion, operation);
|
|
282
|
-
});
|
|
283
|
-
return flowVersion;
|
|
284
|
-
}
|
|
285
|
-
function addAction(flowVersion, request) {
|
|
286
|
-
return transferFlow(flowVersion, (parentStep) => {
|
|
287
|
-
if (parentStep.name !== request.parentStep) {
|
|
288
|
-
return parentStep;
|
|
289
|
-
}
|
|
290
|
-
if (parentStep.type === action_1.ActionType.LOOP_ON_ITEMS &&
|
|
291
|
-
request.stepLocationRelativeToParent) {
|
|
292
|
-
if (request.stepLocationRelativeToParent ===
|
|
293
|
-
flow_operations_1.StepLocationRelativeToParent.INSIDE_LOOP) {
|
|
294
|
-
parentStep.firstLoopAction = createAction(request.action, {
|
|
295
|
-
nextAction: parentStep.firstLoopAction,
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
else if (request.stepLocationRelativeToParent ===
|
|
299
|
-
flow_operations_1.StepLocationRelativeToParent.AFTER) {
|
|
300
|
-
parentStep.nextAction = createAction(request.action, {
|
|
301
|
-
nextAction: parentStep.nextAction,
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
throw new activepieces_error_1.ActivepiecesError({
|
|
306
|
-
code: activepieces_error_1.ErrorCode.FLOW_OPERATION_INVALID,
|
|
307
|
-
params: {},
|
|
308
|
-
}, `Loop step parent ${request.stepLocationRelativeToParent} not found`);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
else if (parentStep.type === action_1.ActionType.BRANCH &&
|
|
312
|
-
request.stepLocationRelativeToParent) {
|
|
313
|
-
if (request.stepLocationRelativeToParent ===
|
|
314
|
-
flow_operations_1.StepLocationRelativeToParent.INSIDE_TRUE_BRANCH) {
|
|
315
|
-
parentStep.onSuccessAction = createAction(request.action, {
|
|
316
|
-
nextAction: parentStep.onSuccessAction,
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
else if (request.stepLocationRelativeToParent ===
|
|
320
|
-
flow_operations_1.StepLocationRelativeToParent.INSIDE_FALSE_BRANCH) {
|
|
321
|
-
parentStep.onFailureAction = createAction(request.action, {
|
|
322
|
-
nextAction: parentStep.onFailureAction,
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
else if (request.stepLocationRelativeToParent ===
|
|
326
|
-
flow_operations_1.StepLocationRelativeToParent.AFTER) {
|
|
327
|
-
parentStep.nextAction = createAction(request.action, {
|
|
328
|
-
nextAction: parentStep.nextAction,
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
else {
|
|
332
|
-
throw new activepieces_error_1.ActivepiecesError({
|
|
333
|
-
code: activepieces_error_1.ErrorCode.FLOW_OPERATION_INVALID,
|
|
334
|
-
params: {},
|
|
335
|
-
}, `Branch step parernt ${request.stepLocationRelativeToParent} not found`);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
else {
|
|
339
|
-
parentStep.nextAction = createAction(request.action, {
|
|
340
|
-
nextAction: parentStep.nextAction,
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
return parentStep;
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
function createAction(request, { nextAction, onFailureAction, onSuccessAction, firstLoopAction, }) {
|
|
347
|
-
const baseProperties = {
|
|
348
|
-
displayName: request.displayName,
|
|
349
|
-
name: request.name,
|
|
350
|
-
valid: false,
|
|
351
|
-
nextAction,
|
|
352
|
-
};
|
|
353
|
-
let action;
|
|
354
|
-
switch (request.type) {
|
|
355
|
-
case action_1.ActionType.BRANCH:
|
|
356
|
-
action = Object.assign(Object.assign({}, baseProperties), { onFailureAction,
|
|
357
|
-
onSuccessAction, type: action_1.ActionType.BRANCH, settings: request.settings });
|
|
358
|
-
break;
|
|
359
|
-
case action_1.ActionType.LOOP_ON_ITEMS:
|
|
360
|
-
action = Object.assign(Object.assign({}, baseProperties), { firstLoopAction, type: action_1.ActionType.LOOP_ON_ITEMS, settings: request.settings });
|
|
361
|
-
break;
|
|
362
|
-
case action_1.ActionType.PIECE:
|
|
363
|
-
action = Object.assign(Object.assign({}, baseProperties), { type: action_1.ActionType.PIECE, settings: request.settings });
|
|
364
|
-
break;
|
|
365
|
-
case action_1.ActionType.CODE:
|
|
366
|
-
action = Object.assign(Object.assign({}, baseProperties), { type: action_1.ActionType.CODE, settings: request.settings });
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
369
|
-
return Object.assign(Object.assign({}, action), { valid: ((0, common_1.isNil)(request.valid) ? true : request.valid) && actionSchemaValidator.Check(action) });
|
|
370
|
-
}
|
|
371
|
-
function isChildOf(parent, childStepName) {
|
|
372
|
-
switch (parent.type) {
|
|
373
|
-
case action_1.ActionType.LOOP_ON_ITEMS: {
|
|
374
|
-
const children = getAllChildSteps(parent);
|
|
375
|
-
return children.findIndex((c) => c.name === childStepName) > -1;
|
|
376
|
-
}
|
|
377
|
-
default: {
|
|
378
|
-
const children = getAllChildSteps(parent);
|
|
379
|
-
return children.findIndex((c) => c.name === childStepName) > -1;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
function createTrigger(name, request, nextAction) {
|
|
384
|
-
const baseProperties = {
|
|
385
|
-
displayName: request.displayName,
|
|
386
|
-
name,
|
|
387
|
-
valid: false,
|
|
388
|
-
nextAction,
|
|
389
|
-
};
|
|
390
|
-
let trigger;
|
|
391
|
-
switch (request.type) {
|
|
392
|
-
case trigger_1.TriggerType.EMPTY:
|
|
393
|
-
trigger = Object.assign(Object.assign({}, baseProperties), { type: trigger_1.TriggerType.EMPTY, settings: request.settings });
|
|
394
|
-
break;
|
|
395
|
-
case trigger_1.TriggerType.PIECE:
|
|
396
|
-
trigger = Object.assign(Object.assign({}, baseProperties), { type: trigger_1.TriggerType.PIECE, settings: request.settings });
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
return Object.assign(Object.assign({}, trigger), { valid: ((0, common_1.isNil)(request.valid) ? true : request.valid) && triggerSchemaValidation.Check(trigger) });
|
|
400
|
-
}
|
|
401
|
-
function getImportOperations(step) {
|
|
402
|
-
const steps = [];
|
|
403
|
-
while (step) {
|
|
404
|
-
if (step.nextAction) {
|
|
405
|
-
steps.push({
|
|
406
|
-
type: flow_operations_1.FlowOperationType.ADD_ACTION,
|
|
407
|
-
request: {
|
|
408
|
-
parentStep: step.name,
|
|
409
|
-
action: removeAnySubsequentAction(step.nextAction),
|
|
410
|
-
},
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
switch (step.type) {
|
|
414
|
-
case action_1.ActionType.BRANCH: {
|
|
415
|
-
if (step.onFailureAction) {
|
|
416
|
-
steps.push({
|
|
417
|
-
type: flow_operations_1.FlowOperationType.ADD_ACTION,
|
|
418
|
-
request: {
|
|
419
|
-
parentStep: step.name,
|
|
420
|
-
stepLocationRelativeToParent: flow_operations_1.StepLocationRelativeToParent.INSIDE_FALSE_BRANCH,
|
|
421
|
-
action: removeAnySubsequentAction(step.onFailureAction),
|
|
422
|
-
},
|
|
423
|
-
});
|
|
424
|
-
steps.push(...getImportOperations(step.onFailureAction));
|
|
425
|
-
}
|
|
426
|
-
if (step.onSuccessAction) {
|
|
427
|
-
steps.push({
|
|
428
|
-
type: flow_operations_1.FlowOperationType.ADD_ACTION,
|
|
429
|
-
request: {
|
|
430
|
-
parentStep: step.name,
|
|
431
|
-
stepLocationRelativeToParent: flow_operations_1.StepLocationRelativeToParent.INSIDE_TRUE_BRANCH,
|
|
432
|
-
action: removeAnySubsequentAction(step.onSuccessAction),
|
|
433
|
-
},
|
|
434
|
-
});
|
|
435
|
-
steps.push(...getImportOperations(step.onSuccessAction));
|
|
436
|
-
}
|
|
437
|
-
break;
|
|
438
|
-
}
|
|
439
|
-
case action_1.ActionType.LOOP_ON_ITEMS: {
|
|
440
|
-
if (step.firstLoopAction) {
|
|
441
|
-
steps.push({
|
|
442
|
-
type: flow_operations_1.FlowOperationType.ADD_ACTION,
|
|
443
|
-
request: {
|
|
444
|
-
parentStep: step.name,
|
|
445
|
-
stepLocationRelativeToParent: flow_operations_1.StepLocationRelativeToParent.INSIDE_LOOP,
|
|
446
|
-
action: removeAnySubsequentAction(step.firstLoopAction),
|
|
447
|
-
},
|
|
448
|
-
});
|
|
449
|
-
steps.push(...getImportOperations(step.firstLoopAction));
|
|
450
|
-
}
|
|
451
|
-
break;
|
|
452
|
-
}
|
|
453
|
-
case action_1.ActionType.CODE:
|
|
454
|
-
case action_1.ActionType.PIECE:
|
|
455
|
-
case trigger_1.TriggerType.PIECE:
|
|
456
|
-
case trigger_1.TriggerType.EMPTY:
|
|
457
|
-
{
|
|
458
|
-
break;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
step = step.nextAction;
|
|
462
|
-
}
|
|
463
|
-
return steps;
|
|
464
|
-
}
|
|
465
|
-
function removeAnySubsequentAction(action) {
|
|
466
|
-
const clonedAction = JSON.parse(JSON.stringify(action));
|
|
467
|
-
switch (clonedAction.type) {
|
|
468
|
-
case action_1.ActionType.BRANCH: {
|
|
469
|
-
delete clonedAction.onSuccessAction;
|
|
470
|
-
delete clonedAction.onFailureAction;
|
|
471
|
-
break;
|
|
472
|
-
}
|
|
473
|
-
case action_1.ActionType.LOOP_ON_ITEMS: {
|
|
474
|
-
delete clonedAction.firstLoopAction;
|
|
475
|
-
break;
|
|
476
|
-
}
|
|
477
|
-
case action_1.ActionType.PIECE:
|
|
478
|
-
case action_1.ActionType.CODE:
|
|
479
|
-
break;
|
|
480
|
-
}
|
|
481
|
-
delete clonedAction.nextAction;
|
|
482
|
-
return clonedAction;
|
|
483
|
-
}
|
|
484
|
-
function normalize(flowVersion) {
|
|
485
|
-
return transferFlow(flowVersion, (step) => {
|
|
486
|
-
var _a, _b;
|
|
487
|
-
const clonedStep = JSON.parse(JSON.stringify(step));
|
|
488
|
-
clonedStep.settings.inputUiInfo = sample_data_1.DEFAULT_SAMPLE_DATA_SETTINGS;
|
|
489
|
-
if (((_b = (_a = clonedStep === null || clonedStep === void 0 ? void 0 : clonedStep.settings) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.auth) && [action_1.ActionType.PIECE, trigger_1.TriggerType.PIECE].includes(step.type)) {
|
|
490
|
-
clonedStep.settings.input.auth = '';
|
|
491
|
-
}
|
|
492
|
-
return upgradePiece(clonedStep, clonedStep.name);
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
function upgradePiece(step, stepName) {
|
|
496
|
-
if (step.name !== stepName) {
|
|
497
|
-
return step;
|
|
498
|
-
}
|
|
499
|
-
const clonedStep = JSON.parse(JSON.stringify(step));
|
|
500
|
-
switch (step.type) {
|
|
501
|
-
case action_1.ActionType.PIECE:
|
|
502
|
-
case trigger_1.TriggerType.PIECE: {
|
|
503
|
-
const { pieceVersion, pieceName } = step.settings;
|
|
504
|
-
if (isLegacyApp({ pieceName, pieceVersion })) {
|
|
505
|
-
return step;
|
|
506
|
-
}
|
|
507
|
-
if (pieceVersion.startsWith('^') || pieceVersion.startsWith('~')) {
|
|
508
|
-
return step;
|
|
509
|
-
}
|
|
510
|
-
if (semver_1.default.valid(pieceVersion) && semver_1.default.lt(pieceVersion, '1.0.0')) {
|
|
511
|
-
clonedStep.settings.pieceVersion = `~${pieceVersion}`;
|
|
512
|
-
}
|
|
513
|
-
else {
|
|
514
|
-
clonedStep.settings.pieceVersion = `^${pieceVersion}`;
|
|
515
|
-
}
|
|
516
|
-
break;
|
|
517
|
-
}
|
|
518
|
-
default:
|
|
519
|
-
break;
|
|
520
|
-
}
|
|
521
|
-
return clonedStep;
|
|
522
|
-
}
|
|
523
|
-
// TODO Remove this in 2024, these pieces didn't follow the standard versioning where the minor version has to be increased when there is breaking change.
|
|
524
|
-
function isLegacyApp({ pieceName, pieceVersion }) {
|
|
525
|
-
let newVersion = pieceVersion;
|
|
526
|
-
if (newVersion.startsWith('^') || newVersion.startsWith('~')) {
|
|
527
|
-
newVersion = newVersion.substring(1);
|
|
528
|
-
}
|
|
529
|
-
if (pieceName === '@activepieces/piece-google-sheets' &&
|
|
530
|
-
semver_1.default.lt(newVersion, '0.3.0')) {
|
|
531
|
-
return true;
|
|
532
|
-
}
|
|
533
|
-
if (pieceName === '@activepieces/piece-gmail' &&
|
|
534
|
-
semver_1.default.lt(newVersion, '0.3.0')) {
|
|
535
|
-
return true;
|
|
536
|
-
}
|
|
537
|
-
return false;
|
|
538
|
-
}
|
|
539
|
-
function isPartOfInnerFlow({ parentStep, childName, }) {
|
|
540
|
-
const steps = getAllSteps(Object.assign(Object.assign({}, parentStep), { nextAction: undefined }));
|
|
541
|
-
return steps.some((step) => step.name === childName);
|
|
542
|
-
}
|
|
543
|
-
function duplicateStep(stepName, flowVersionWithArtifacts) {
|
|
544
|
-
const clonedStep = JSON.parse(JSON.stringify(exports.flowHelper.getStep(flowVersionWithArtifacts, stepName)));
|
|
545
|
-
clonedStep.nextAction = undefined;
|
|
546
|
-
if (!clonedStep) {
|
|
547
|
-
throw new Error(`step with name '${stepName}' not found`);
|
|
548
|
-
}
|
|
549
|
-
const existingNames = getAllSteps(flowVersionWithArtifacts.trigger).map((step) => step.name);
|
|
550
|
-
const oldStepsNameToReplace = getAllSteps(clonedStep).map((step) => step.name);
|
|
551
|
-
const oldNameToNewName = {};
|
|
552
|
-
oldStepsNameToReplace.forEach((name) => {
|
|
553
|
-
const newName = findUnusedName(existingNames, 'step');
|
|
554
|
-
oldNameToNewName[name] = newName;
|
|
555
|
-
existingNames.push(newName);
|
|
556
|
-
});
|
|
557
|
-
const duplicatedStep = transferStep(clonedStep, (step) => {
|
|
558
|
-
step.displayName = `${step.displayName} Copy`;
|
|
559
|
-
step.name = oldNameToNewName[step.name];
|
|
560
|
-
if (step.settings.inputUiInfo) {
|
|
561
|
-
step.settings.inputUiInfo.currentSelectedData = undefined;
|
|
562
|
-
step.settings.inputUiInfo.sampleDataFileId = undefined;
|
|
563
|
-
step.settings.inputUiInfo.lastTestDate = undefined;
|
|
564
|
-
}
|
|
565
|
-
oldStepsNameToReplace.forEach((oldName) => {
|
|
566
|
-
step.settings.input = (0, common_1.applyFunctionToValuesSync)(step.settings.input, (value) => {
|
|
567
|
-
if ((0, common_1.isString)(value)) {
|
|
568
|
-
return replaceOldStepNameWithNewOne({ input: value, oldStepName: oldName, newStepName: oldNameToNewName[oldName] });
|
|
569
|
-
}
|
|
570
|
-
return value;
|
|
571
|
-
});
|
|
572
|
-
});
|
|
573
|
-
return step;
|
|
574
|
-
});
|
|
575
|
-
let finalFlow = addAction(flowVersionWithArtifacts, {
|
|
576
|
-
action: duplicatedStep,
|
|
577
|
-
parentStep: stepName,
|
|
578
|
-
stepLocationRelativeToParent: flow_operations_1.StepLocationRelativeToParent.AFTER,
|
|
579
|
-
});
|
|
580
|
-
const operations = getImportOperations(duplicatedStep);
|
|
581
|
-
operations.forEach((operation) => {
|
|
582
|
-
finalFlow = exports.flowHelper.apply(finalFlow, operation);
|
|
583
|
-
});
|
|
584
|
-
return finalFlow;
|
|
585
|
-
}
|
|
586
|
-
function replaceOldStepNameWithNewOne({ input, oldStepName, newStepName }) {
|
|
587
|
-
const regex = /{{(.*?)}}/g; // Regular expression to match strings inside {{ }}
|
|
588
|
-
return input.replace(regex, (match, content) => {
|
|
589
|
-
// Replace the content inside {{ }} using the provided function
|
|
590
|
-
const replacedContent = content.replaceAll(new RegExp(`\\b${oldStepName}\\b`, 'g'), `${newStepName}`);
|
|
591
|
-
// Reconstruct the {{ }} with the replaced content
|
|
592
|
-
return `{{${replacedContent}}}`;
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
function doesActionHaveChildren(action) {
|
|
596
|
-
if (action.type === action_1.ActionType.BRANCH || action.type === action_1.ActionType.LOOP_ON_ITEMS) {
|
|
597
|
-
return true;
|
|
598
|
-
}
|
|
599
|
-
return false;
|
|
600
|
-
}
|
|
601
|
-
function findUnusedName(names, stepPrefix) {
|
|
602
|
-
let availableNumber = 1;
|
|
603
|
-
let availableName = `${stepPrefix}_${availableNumber}`;
|
|
604
|
-
while (names.includes(availableName)) {
|
|
605
|
-
availableNumber++;
|
|
606
|
-
availableName = `${stepPrefix}_${availableNumber}`;
|
|
607
|
-
}
|
|
608
|
-
return availableName;
|
|
609
|
-
}
|
|
610
|
-
function findAvailableStepName(flowVersion, stepPrefix) {
|
|
611
|
-
const steps = exports.flowHelper
|
|
612
|
-
.getAllSteps(flowVersion.trigger)
|
|
613
|
-
.map((f) => f.name);
|
|
614
|
-
return findUnusedName(steps, stepPrefix);
|
|
615
|
-
}
|
|
616
|
-
function getDirectParentStep(child, parent) {
|
|
617
|
-
var _a, _b, _c, _d;
|
|
618
|
-
if (!parent) {
|
|
619
|
-
return undefined;
|
|
620
|
-
}
|
|
621
|
-
if (isTrigger(parent.type)) {
|
|
622
|
-
let next = parent.nextAction;
|
|
623
|
-
while (next) {
|
|
624
|
-
if (next.name === child.name) {
|
|
625
|
-
return parent;
|
|
626
|
-
}
|
|
627
|
-
next = next.nextAction;
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
if (parent.type === action_1.ActionType.BRANCH) {
|
|
631
|
-
const isChildOfBranch = isChildOf(parent, child.name);
|
|
632
|
-
if (isChildOfBranch) {
|
|
633
|
-
const directTrueBranchChildren = getAllDirectChildStepsForBranch(parent, 'success');
|
|
634
|
-
const directFalseBranchChildren = getAllDirectChildStepsForBranch(parent, 'failure');
|
|
635
|
-
if (((_a = directTrueBranchChildren.at(-1)) === null || _a === void 0 ? void 0 : _a.name) === child.name || ((_b = directFalseBranchChildren.at(-1)) === null || _b === void 0 ? void 0 : _b.name) === child.name) {
|
|
636
|
-
return parent;
|
|
637
|
-
}
|
|
638
|
-
return (_c = getDirectParentStep(child, parent.onSuccessAction)) !== null && _c !== void 0 ? _c : getDirectParentStep(child, parent.onFailureAction);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
if (parent.type === action_1.ActionType.LOOP_ON_ITEMS) {
|
|
642
|
-
const isChildOfLoop = isChildOf(parent, child.name);
|
|
643
|
-
if (isChildOfLoop) {
|
|
644
|
-
const directChildren = getAllDirectChildStepsForLoop(parent);
|
|
645
|
-
if (((_d = directChildren.at(-1)) === null || _d === void 0 ? void 0 : _d.name) === child.name) {
|
|
646
|
-
return parent;
|
|
647
|
-
}
|
|
648
|
-
return getDirectParentStep(child, parent.firstLoopAction);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
return getDirectParentStep(child, parent.nextAction);
|
|
652
|
-
}
|
|
653
|
-
// TODO remove this function after deprecation angular
|
|
654
|
-
function isStepLastChildOfParent(child, trigger) {
|
|
655
|
-
var _a, _b, _c;
|
|
656
|
-
const parent = getDirectParentStep(child, trigger);
|
|
657
|
-
if (parent) {
|
|
658
|
-
if (doesStepHaveChildren(parent)) {
|
|
659
|
-
if (parent.type === action_1.ActionType.LOOP_ON_ITEMS) {
|
|
660
|
-
const children = getAllDirectChildStepsForLoop(parent);
|
|
661
|
-
return ((_a = children[children.length - 1]) === null || _a === void 0 ? void 0 : _a.name) === child.name;
|
|
662
|
-
}
|
|
663
|
-
const trueBranchChildren = getAllDirectChildStepsForBranch(parent, 'success');
|
|
664
|
-
const falseBranchChildren = getAllDirectChildStepsForBranch(parent, 'failure');
|
|
665
|
-
return ((_b = trueBranchChildren[trueBranchChildren.length - 1]) === null || _b === void 0 ? void 0 : _b.name) === child.name || ((_c = falseBranchChildren[falseBranchChildren.length - 1]) === null || _c === void 0 ? void 0 : _c.name) === child.name;
|
|
666
|
-
}
|
|
667
|
-
let next = parent.nextAction;
|
|
668
|
-
while (next) {
|
|
669
|
-
if (next.nextAction === undefined && next.name === child.name) {
|
|
670
|
-
return true;
|
|
671
|
-
}
|
|
672
|
-
next = next.nextAction;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
return false;
|
|
676
|
-
}
|
|
677
|
-
function doesStepHaveChildren(step) {
|
|
678
|
-
return step.type === action_1.ActionType.BRANCH || step.type === action_1.ActionType.LOOP_ON_ITEMS;
|
|
679
|
-
}
|
|
680
|
-
function findPathToStep({ targetStepName, trigger }) {
|
|
681
|
-
const steps = getAllSteps(trigger).map((step, dfsIndex) => (Object.assign(Object.assign({}, step), { dfsIndex })));
|
|
682
|
-
return steps.filter((step) => {
|
|
683
|
-
const steps = getAllSteps(step);
|
|
684
|
-
return steps.some((s) => s.name === targetStepName);
|
|
685
|
-
}).filter((step) => step.name !== targetStepName);
|
|
686
|
-
}
|
|
687
|
-
exports.flowHelper = {
|
|
688
|
-
isValid,
|
|
689
|
-
apply(flowVersion, operation) {
|
|
690
|
-
let clonedVersion = JSON.parse(JSON.stringify(flowVersion));
|
|
691
|
-
switch (operation.type) {
|
|
692
|
-
case flow_operations_1.FlowOperationType.MOVE_ACTION:
|
|
693
|
-
clonedVersion = moveAction(clonedVersion, operation.request);
|
|
694
|
-
break;
|
|
695
|
-
case flow_operations_1.FlowOperationType.LOCK_FLOW:
|
|
696
|
-
clonedVersion.state = flow_version_1.FlowVersionState.LOCKED;
|
|
697
|
-
break;
|
|
698
|
-
case flow_operations_1.FlowOperationType.CHANGE_NAME:
|
|
699
|
-
clonedVersion.displayName = operation.request.displayName;
|
|
700
|
-
break;
|
|
701
|
-
case flow_operations_1.FlowOperationType.DELETE_ACTION:
|
|
702
|
-
clonedVersion = deleteAction(clonedVersion, operation.request);
|
|
703
|
-
break;
|
|
704
|
-
case flow_operations_1.FlowOperationType.ADD_ACTION: {
|
|
705
|
-
clonedVersion = transferFlow(addAction(clonedVersion, operation.request), (step) => upgradePiece(step, operation.request.action.name));
|
|
706
|
-
break;
|
|
707
|
-
}
|
|
708
|
-
case flow_operations_1.FlowOperationType.UPDATE_ACTION:
|
|
709
|
-
clonedVersion = transferFlow(updateAction(clonedVersion, operation.request), (step) => upgradePiece(step, operation.request.name));
|
|
710
|
-
break;
|
|
711
|
-
case flow_operations_1.FlowOperationType.UPDATE_TRIGGER:
|
|
712
|
-
clonedVersion.trigger = createTrigger(clonedVersion.trigger.name, operation.request, clonedVersion.trigger.nextAction);
|
|
713
|
-
clonedVersion = transferFlow(clonedVersion, (step) => upgradePiece(step, operation.request.name));
|
|
714
|
-
break;
|
|
715
|
-
case flow_operations_1.FlowOperationType.DUPLICATE_ACTION: {
|
|
716
|
-
clonedVersion = duplicateStep(operation.request.stepName, clonedVersion);
|
|
717
|
-
break;
|
|
718
|
-
}
|
|
719
|
-
default:
|
|
720
|
-
break;
|
|
721
|
-
}
|
|
722
|
-
clonedVersion.valid = isValid(clonedVersion);
|
|
723
|
-
return clonedVersion;
|
|
724
|
-
},
|
|
725
|
-
getStep,
|
|
726
|
-
isAction,
|
|
727
|
-
isTrigger,
|
|
728
|
-
getAllSteps,
|
|
729
|
-
isPartOfInnerFlow,
|
|
730
|
-
isStepLastChildOfParent,
|
|
731
|
-
getUsedPieces,
|
|
732
|
-
getImportOperations,
|
|
733
|
-
normalize,
|
|
734
|
-
getStepFromSubFlow,
|
|
735
|
-
isChildOf,
|
|
736
|
-
transferFlowAsync,
|
|
737
|
-
getAllChildSteps,
|
|
738
|
-
getAllStepsAtFirstLevel,
|
|
739
|
-
duplicateStep,
|
|
740
|
-
findAvailableStepName,
|
|
741
|
-
doesActionHaveChildren,
|
|
742
|
-
findPathToStep,
|
|
743
|
-
updateFlowSecrets,
|
|
744
|
-
};
|
|
745
|
-
//# sourceMappingURL=flow-helper.js.map
|