feat: rm other actions logic

This commit is contained in:
Rohit
2025-04-30 19:24:38 +05:30
parent c7e3a66511
commit f1d0cbdaae
13 changed files with 9 additions and 200 deletions

View File

@@ -589,7 +589,6 @@ async function executeRun(id: string, userId: string) {
const categorizedOutput = {
scrapeSchema: interpretationInfo.scrapeSchemaOutput || {},
scrapeList: interpretationInfo.scrapeListOutput || {},
other: interpretationInfo.otherOutput || {}
};
await destroyRemoteBrowser(plainRun.browserId, userId);
@@ -603,7 +602,6 @@ async function executeRun(id: string, userId: string) {
serializableOutput: {
scrapeSchema: Object.values(categorizedOutput.scrapeSchema),
scrapeList: Object.values(categorizedOutput.scrapeList),
other: Object.values(categorizedOutput.other),
},
binaryOutput: uploadedBinaryOutput,
});

View File

@@ -265,8 +265,7 @@ async function processRunExecution(job: Job<ExecuteRunData>) {
const categorizedOutput = {
scrapeSchema: interpretationInfo.scrapeSchemaOutput || {},
scrapeList: interpretationInfo.scrapeListOutput || {},
other: interpretationInfo.otherOutput || {}
scrapeList: interpretationInfo.scrapeListOutput || {}
};
await run.update({
@@ -278,7 +277,6 @@ async function processRunExecution(job: Job<ExecuteRunData>) {
serializableOutput: {
scrapeSchema: Object.values(categorizedOutput.scrapeSchema),
scrapeList: Object.values(categorizedOutput.scrapeList),
other: Object.values(categorizedOutput.other),
},
binaryOutput: uploadedBinaryOutput,
});
@@ -482,7 +480,6 @@ async function abortRun(runId: string, userId: string): Promise<boolean> {
let categorizedOutput = {
scrapeSchema: {},
scrapeList: {},
other: {}
};
let binaryOutput: Record<string, any> = {};
@@ -496,7 +493,6 @@ async function abortRun(runId: string, userId: string): Promise<boolean> {
categorizedOutput = {
scrapeSchema: collectDataByType(browser.interpreter.serializableDataByType.scrapeSchema || []),
scrapeList: collectDataByType(browser.interpreter.serializableDataByType.scrapeList || []),
other: collectDataByType(browser.interpreter.serializableDataByType.other || [])
};
}
@@ -516,7 +512,6 @@ async function abortRun(runId: string, userId: string): Promise<boolean> {
serializableOutput: {
scrapeSchema: Object.values(categorizedOutput.scrapeSchema),
scrapeList: Object.values(categorizedOutput.scrapeList),
other: Object.values(categorizedOutput.other),
},
binaryOutput,
});

View File

@@ -92,11 +92,9 @@ export class WorkflowInterpreter {
public serializableDataByType: {
scrapeSchema: any[],
scrapeList: any[],
other: any[]
} = {
scrapeSchema: [],
scrapeList: [],
other: []
};
/**
@@ -216,12 +214,7 @@ export class WorkflowInterpreter {
type: 'captureList',
data
});
} else {
this.socket.emit('serializableCallback', {
type: 'other',
data
});
}
}
},
binaryCallback: (data: string, mimetype: string) => {
this.socket.emit('binaryCallback', {
@@ -292,7 +285,6 @@ export class WorkflowInterpreter {
this.serializableDataByType = {
scrapeSchema: [],
scrapeList: [],
other: []
};
this.binaryData = [];
}
@@ -342,9 +334,7 @@ export class WorkflowInterpreter {
}
} else if (this.currentActionType === 'scrapeList') {
this.serializableDataByType.scrapeList.push(data);
} else {
this.serializableDataByType.other.push(data);
}
}
this.socket.emit('serializableCallback', data);
},
@@ -394,12 +384,6 @@ export class WorkflowInterpreter {
...reducedObject,
}
}, {}),
otherOutput: this.serializableDataByType.other.reduce((reducedObject, item, index) => {
return {
[`item-${index}`]: item,
...reducedObject,
}
}, {}),
binaryOutput: this.binaryData.reduce((reducedObject, item, index) => {
return {
[`item-${index}`]: item,

View File

@@ -14,7 +14,6 @@ interface AirtableUpdateTask {
interface SerializableOutput {
scrapeSchema?: any[];
scrapeList?: any[];
other?: any[];
}
const MAX_RETRIES = 3;
@@ -52,7 +51,6 @@ function mergeRelatedData(serializableOutput: SerializableOutput, binaryOutput:
...[
...(serializableOutput.scrapeSchema ?? []).map(arr => arr?.length ?? 0),
...(serializableOutput.scrapeList ?? []).map(arr => arr?.length ?? 0),
...(serializableOutput.other ?? []).map(arr => arr?.length ?? 0),
0
]
);
@@ -83,17 +81,6 @@ function mergeRelatedData(serializableOutput: SerializableOutput, binaryOutput:
}
}
if (serializableOutput.other) {
for (const otherArray of serializableOutput.other) {
if (!Array.isArray(otherArray)) continue;
for (let i = 0; i < otherArray.length; i++) {
if (i >= mergedRecords.length) break;
mergedRecords[i] = { ...mergedRecords[i], ...otherArray[i] };
}
}
}
if (binaryOutput && Object.keys(binaryOutput).length > 0) {
for (let i = 0; i < mergedRecords.length; i++) {
const screenshotKey = `item-${i}`;

View File

@@ -13,7 +13,6 @@ interface GoogleSheetUpdateTask {
interface SerializableOutput {
scrapeSchema?: any[];
scrapeList?: any[];
other?: any[];
}
const MAX_RETRIES = 5;
@@ -69,16 +68,6 @@ export async function updateGoogleSheet(robotId: string, runId: string) {
plainRobot
);
}
if (serializableOutput.other && serializableOutput.other.length > 0) {
await processOutputType(
robotId,
spreadsheetId,
'Other',
serializableOutput.other,
plainRobot
);
}
}
if (plainRun.binaryOutput && Object.keys(plainRun.binaryOutput).length > 0) {

View File

@@ -135,7 +135,6 @@ async function executeRun(id: string, userId: string) {
const categorizedOutput = {
scrapeSchema: interpretationInfo.scrapeSchemaOutput || {},
scrapeList: interpretationInfo.scrapeListOutput || {},
other: interpretationInfo.otherOutput || {}
};
await destroyRemoteBrowser(plainRun.browserId, userId);
@@ -149,7 +148,6 @@ async function executeRun(id: string, userId: string) {
serializableOutput: {
scrapeSchema: Object.values(categorizedOutput.scrapeSchema),
scrapeList: Object.values(categorizedOutput.scrapeList),
other: Object.values(categorizedOutput.other),
},
binaryOutput: uploadedBinaryOutput,
});