|
@@ -27,7 +27,6 @@ class WorkflowEngine {
|
|
|
this.extractedGroup = {};
|
|
|
this.connectionsMap = {};
|
|
|
this.waitConnections = {};
|
|
|
- this.restartWorkersCount = {};
|
|
|
|
|
|
this.isDestroyed = false;
|
|
|
this.isUsingProxy = false;
|
|
@@ -65,6 +64,17 @@ class WorkflowEngine {
|
|
|
}
|
|
|
this.options = options;
|
|
|
|
|
|
+ this.refDataSnapshots = {};
|
|
|
+ this.refDataSnapshotsKeys = {
|
|
|
+ loopData: {
|
|
|
+ index: 0,
|
|
|
+ key: '##loopData0',
|
|
|
+ },
|
|
|
+ variables: {
|
|
|
+ index: 0,
|
|
|
+ key: '##variables0',
|
|
|
+ },
|
|
|
+ };
|
|
|
this.referenceData = {
|
|
|
variables,
|
|
|
table: [],
|
|
@@ -121,6 +131,10 @@ class WorkflowEngine {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (!this.workflow.settings) {
|
|
|
+ this.workflow.settings = {};
|
|
|
+ }
|
|
|
+
|
|
|
blocks = getBlocks();
|
|
|
|
|
|
const checkParams = this.options?.checkParams ?? true;
|
|
@@ -144,7 +158,7 @@ class WorkflowEngine {
|
|
|
browser.windows.create({
|
|
|
type: 'popup',
|
|
|
width: 480,
|
|
|
- height: 650,
|
|
|
+ height: 700,
|
|
|
url: browser.runtime.getURL(
|
|
|
`/params.html?workflowId=${this.workflow.id}`
|
|
|
),
|
|
@@ -174,7 +188,8 @@ class WorkflowEngine {
|
|
|
{}
|
|
|
);
|
|
|
|
|
|
- const workflowTable = this.workflow.table || this.workflow.dataColumns;
|
|
|
+ const workflowTable =
|
|
|
+ this.workflow.table || this.workflow.dataColumns || [];
|
|
|
let columns = Array.isArray(workflowTable)
|
|
|
? workflowTable
|
|
|
: Object.values(workflowTable);
|
|
@@ -259,6 +274,16 @@ class WorkflowEngine {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ addRefDataSnapshot(key) {
|
|
|
+ this.refDataSnapshotsKeys[key].index += 1;
|
|
|
+ this.refDataSnapshotsKeys[
|
|
|
+ key
|
|
|
+ ].key = `##${key}${this.refDataSnapshotsKeys[key].index}`;
|
|
|
+
|
|
|
+ const keyName = this.refDataSnapshotsKeys[key].key;
|
|
|
+ this.refDataSnapshots[keyName] = cloneDeep(this.referenceData[key]);
|
|
|
+ }
|
|
|
+
|
|
|
addWorker(detail) {
|
|
|
this.workerId += 1;
|
|
|
|
|
@@ -272,7 +297,7 @@ class WorkflowEngine {
|
|
|
addLogHistory(detail) {
|
|
|
if (detail.name === 'blocks-group') return;
|
|
|
|
|
|
- const isLimit = this.history?.length >= this.logsLimit;
|
|
|
+ const isLimit = this.history.length >= this.logsLimit;
|
|
|
const notErrorLog = detail.type !== 'error';
|
|
|
|
|
|
if ((isLimit || !this.saveLog) && notErrorLog) return;
|
|
@@ -286,15 +311,13 @@ class WorkflowEngine {
|
|
|
detail.name === 'javascript-code' ||
|
|
|
(blocks[detail.name]?.refDataKeys && this.saveLog)
|
|
|
) {
|
|
|
- const { activeTabUrl, variables, loopData } = JSON.parse(
|
|
|
- JSON.stringify(this.referenceData)
|
|
|
- );
|
|
|
+ const { variables, loopData } = this.refDataSnapshotsKeys;
|
|
|
|
|
|
this.historyCtxData[this.logHistoryId] = {
|
|
|
referenceData: {
|
|
|
- loopData,
|
|
|
- variables,
|
|
|
- activeTabUrl,
|
|
|
+ loopData: loopData.key,
|
|
|
+ variables: variables.key,
|
|
|
+ activeTabUrl: detail.activeTabUrl,
|
|
|
prevBlockData: detail.prevBlockData || '',
|
|
|
},
|
|
|
replacedValue: cloneDeep(detail.replacedValue),
|
|
@@ -482,7 +505,10 @@ class WorkflowEngine {
|
|
|
},
|
|
|
ctxData: {
|
|
|
logId: this.id,
|
|
|
- data: this.historyCtxData,
|
|
|
+ data: {
|
|
|
+ ctxData: this.historyCtxData,
|
|
|
+ dataSnapshot: this.refDataSnapshots,
|
|
|
+ },
|
|
|
},
|
|
|
data: {
|
|
|
logId: this.id,
|