@pxp-nd/flow 1.0.66 → 1.0.67
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/dist/controllers/Flow.js +3 -24
- package/package.json +1 -1
package/dist/controllers/Flow.js
CHANGED
|
@@ -62,7 +62,7 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
62
62
|
return restNodes;
|
|
63
63
|
}
|
|
64
64
|
async copyNodeConnections(nodeId, newNodeId, newFlowId, manager) {
|
|
65
|
-
const connections = await (0, core_1.__)(NodeConnection_1.default.find({ nodeIdMaster: nodeId }));
|
|
65
|
+
const connections = await (0, core_1.__)(NodeConnection_1.default.find({ nodeIdMaster: nodeId, isActive: true }));
|
|
66
66
|
for (let connection of connections) {
|
|
67
67
|
const newNodeConnection = new NodeConnection_1.default();
|
|
68
68
|
const { nodeConnectionId, nodeIdMaster, nodeIdChild, createdAt, modifiedAt, ...nodeConnectionToCopy } = connection;
|
|
@@ -171,29 +171,8 @@ let Flow = class Flow extends core_1.Controller {
|
|
|
171
171
|
else {
|
|
172
172
|
flowDataClone = await manager.save(Flow_1.default, { ...flowToClone, name: `${flowData.name} Copy` });
|
|
173
173
|
}
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
const originalNodeIds = nodesToDuplicate.map((node) => node.nodeId);
|
|
177
|
-
const duplicatedNodes = nodesToDuplicate.map((node) => {
|
|
178
|
-
const duplicatedNode = manager.create(Node_1.default, { ...node, nodeId: undefined });
|
|
179
|
-
duplicatedNode.flowId = flowDataClone.flowId;
|
|
180
|
-
return duplicatedNode;
|
|
181
|
-
});
|
|
182
|
-
const savedNodes = await manager.save(duplicatedNodes);
|
|
183
|
-
const newNodeIds = savedNodes.map((node) => node.nodeId);
|
|
184
|
-
const connectionsToDuplicate = await manager.find(NodeConnection_1.default, {
|
|
185
|
-
where: { nodeIdChild: (0, typeorm_1.In)(originalNodeIds), isActive: true }
|
|
186
|
-
});
|
|
187
|
-
const duplicatedConnections = newNodeIds.map((nodeId, index) => {
|
|
188
|
-
const duplicatedConnection = manager.create(NodeConnection_1.default, {
|
|
189
|
-
nodeConnectionId: undefined,
|
|
190
|
-
nodeIdMaster: index === 0 ? null : newNodeIds[index - 1],
|
|
191
|
-
nodeIdChild: nodeId,
|
|
192
|
-
});
|
|
193
|
-
return duplicatedConnection;
|
|
194
|
-
});
|
|
195
|
-
await manager.save(duplicatedConnections);
|
|
196
|
-
}
|
|
174
|
+
const dataNode = await Node_1.default.findOne({ where: { flowId: params.flowId, isInit: 'Y', isActive: true }, order: { nodeId: "ASC" } });
|
|
175
|
+
dataNode && await this.copyNode(dataNode, flowDataClone.flowId, manager);
|
|
197
176
|
return { success: true, flowId: flowDataClone.flowId };
|
|
198
177
|
}
|
|
199
178
|
else {
|