fix: format

This commit is contained in:
karishmas6
2024-08-21 05:29:41 +05:30
parent f8346f8985
commit dd12d136af

View File

@@ -9,6 +9,9 @@ import { operators } from './types/logic';
*/ */
export default class Preprocessor { export default class Preprocessor {
static validateWorkflow(workflow: WorkflowFile): any { static validateWorkflow(workflow: WorkflowFile): any {
console.log(`Workflow from preprocessor: ${workflow}`)
const regex = Joi.object({ const regex = Joi.object({
$regex: Joi.string().required(), $regex: Joi.string().required(),
}); });
@@ -46,11 +49,11 @@ export default class Preprocessor {
return error; return error;
} }
/** /**
* Extracts parameter names from the workflow. * Extracts parameter names from the workflow.
* @param {WorkflowFile} workflow The given workflow * @param {WorkflowFile} workflow The given workflow
* @returns {String[]} List of parameters' names. * @returns {String[]} List of parameters' names.
*/ */
static getParams(workflow: WorkflowFile): string[] { static getParams(workflow: WorkflowFile): string[] {
const getParamsRecurse = (object: any): string[] => { const getParamsRecurse = (object: any): string[] => {
if (typeof object === 'object') { if (typeof object === 'object') {
@@ -69,10 +72,10 @@ export default class Preprocessor {
return getParamsRecurse(workflow.workflow); return getParamsRecurse(workflow.workflow);
} }
/** /**
* List all the selectors used in the given workflow (only literal "selector" * List all the selectors used in the given workflow (only literal "selector"
* field in WHERE clauses so far) * field in WHERE clauses so far)
*/ */
// TODO : add recursive selector search (also in click/fill etc. events?) // TODO : add recursive selector search (also in click/fill etc. events?)
static extractSelectors(workflow: Workflow): SelectorArray { static extractSelectors(workflow: Workflow): SelectorArray {
/** /**
@@ -107,11 +110,11 @@ export default class Preprocessor {
], []); ], []);
} }
/** /**
* Recursively crawl `object` and initializes params - replaces the `{$param : paramName}` objects * Recursively crawl `object` and initializes params - replaces the `{$param : paramName}` objects
* with the defined value. * with the defined value.
* @returns {Workflow} Copy of the given workflow, modified (the initial workflow is left untouched). * @returns {Workflow} Copy of the given workflow, modified (the initial workflow is left untouched).
*/ */
static initWorkflow(workflow: Workflow, params?: ParamType): Workflow { static initWorkflow(workflow: Workflow, params?: ParamType): Workflow {
const paramNames = this.getParams({ workflow }); const paramNames = this.getParams({ workflow });