feat: use robot model to save new workflow
This commit is contained in:
@@ -14,6 +14,8 @@ import {
|
|||||||
} from "../selector";
|
} from "../selector";
|
||||||
import { CustomActions } from "../../../../src/shared/types";
|
import { CustomActions } from "../../../../src/shared/types";
|
||||||
import { workflow } from "../../routes";
|
import { workflow } from "../../routes";
|
||||||
|
import Robot from "../../models/Robot";
|
||||||
|
import Run from "../../models/Run";
|
||||||
import { saveFile } from "../storage";
|
import { saveFile } from "../storage";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { getBestSelectorForAction } from "../utils";
|
import { getBestSelectorForAction } from "../utils";
|
||||||
@@ -486,11 +488,12 @@ export class WorkflowGenerator {
|
|||||||
updatedAt: new Date().toLocaleString(),
|
updatedAt: new Date().toLocaleString(),
|
||||||
params: this.getParams() || [],
|
params: this.getParams() || [],
|
||||||
}
|
}
|
||||||
fs.mkdirSync('../storage/recordings', { recursive: true })
|
const robot = await Robot.create({
|
||||||
await saveFile(
|
recording_meta: this.recordingMeta,
|
||||||
`../storage/recordings/${fileName}.json`,
|
recording: recording,
|
||||||
JSON.stringify({ recording_meta: this.recordingMeta, recording }, null, 2)
|
});
|
||||||
);
|
|
||||||
|
logger.log('info', `Robot saved with id: ${robot.id}`);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
const { message } = e as Error;
|
const { message } = e as Error;
|
||||||
|
|||||||
Reference in New Issue
Block a user