removeApiKeys migration done

This commit is contained in:
anovazzi1 2023-07-13 18:32:47 -03:00
commit 4c9dc55205
3 changed files with 15 additions and 18 deletions

View file

@ -16,7 +16,7 @@ import { EXPORT_DIALOG_SUBTITLE } from "../../constants";
import { alertContext } from "../../contexts/alertContext";
import { PopUpContext } from "../../contexts/popUpContext";
import { TabsContext } from "../../contexts/tabsContext";
import { removeApiKeys } from "../../utils";
import { removeApiKeys } from "../../utils/reactflowUtils";
export default function ExportModal() {
const [open, setOpen] = useState(true);

View file

@ -5,7 +5,7 @@ import { twMerge } from "tailwind-merge";
import { ADJECTIVES, DESCRIPTIONS, NOUNS } from "./flow_constants";
import { APITemplateType } from "./types/api";
import { IVarHighlightType } from "./types/components";
import { FlowType, NodeType } from "./types/flow";
import { NodeType } from "./types/flow";
export function classNames(...classes: Array<string>) {
return classes.filter(Boolean).join(" ");
@ -70,22 +70,6 @@ export function normalCaseToSnakeCase(str: string) {
.join("_");
}
export function roundNumber(x: number, decimals: number) {
return Math.round(x * Math.pow(10, decimals)) / Math.pow(10, decimals);
}
export function removeApiKeys(flow: FlowType): FlowType {
let cleanFLow = _.cloneDeep(flow);
cleanFLow.data.nodes.forEach((node) => {
for (const key in node.data.node.template) {
if (node.data.node.template[key].password) {
node.data.node.template[key].value = "";
}
}
});
return cleanFLow;
}
export function updateObject<T extends Record<string, any>>(
reference: T,
objectToUpdate: T

View file

@ -1,5 +1,6 @@
import _ from "lodash";
import { Connection, ReactFlowInstance } from "reactflow";
import { FlowType } from "../types/flow";
import { cleanEdgesType } from "../types/utils/reactflowUtils";
export function cleanEdges({
@ -87,3 +88,15 @@ export function isValidConnection(
}
return false;
}
export function removeApiKeys(flow: FlowType): FlowType {
let cleanFLow = _.cloneDeep(flow);
cleanFLow.data.nodes.forEach((node) => {
for (const key in node.data.node.template) {
if (node.data.node.template[key].password) {
node.data.node.template[key].value = "";
}
}
});
return cleanFLow;
}