refactor: Use pushTriggerItem utility function for triggers

This commit is contained in:
Faruk AYDIN
2022-10-24 18:20:55 +02:00
committed by Ali BARIN
parent bda7ad9f2f
commit ea76b5b762
8 changed files with 11 additions and 9 deletions

View File

@@ -44,7 +44,7 @@ const newIssues = async ($: IGlobalVariable) => {
}, },
}; };
$.triggerOutput.data.push(dataItem); $.pushTriggerItem(dataItem);
} }
} }
} while (links.next && !$.execution.testRun); } while (links.next && !$.execution.testRun);

View File

@@ -55,7 +55,7 @@ const newStargazers = async ($: IGlobalVariable) => {
}, },
}; };
$.triggerOutput.data.push(dataItem); $.pushTriggerItem(dataItem);
} }
} }
} while (pathname && !$.execution.testRun); } while (pathname && !$.execution.testRun);

View File

@@ -171,6 +171,6 @@ export default defineTrigger({
}, },
}; };
$.triggerOutput.data.push(dataItem); $.pushTriggerItem(dataItem);
}, },
}); });

View File

@@ -65,6 +65,6 @@ export default defineTrigger({
}, },
}; };
$.triggerOutput.data.push(dataItem); $.pushTriggerItem(dataItem);
}, },
}); });

View File

@@ -287,6 +287,6 @@ export default defineTrigger({
}, },
}; };
$.triggerOutput.data.push(dataItem); $.pushTriggerItem(dataItem);
}, },
}); });

View File

@@ -191,6 +191,6 @@ export default defineTrigger({
}, },
}; };
$.triggerOutput.data.push(dataItem); $.pushTriggerItem(dataItem);
}, },
}); });

View File

@@ -30,12 +30,14 @@ const fetchTweets = async ($: IGlobalVariable, username: string) => {
if (response.data.meta.result_count > 0) { if (response.data.meta.result_count > 0) {
response.data.data.forEach((tweet: IJSONObject) => { response.data.data.forEach((tweet: IJSONObject) => {
$.triggerOutput.data.push({ const dataItem = {
raw: tweet, raw: tweet,
meta: { meta: {
internalId: tweet.id as string, internalId: tweet.id as string,
}, },
}); };
$.pushTriggerItem(dataItem);
}); });
} }
} while (response.data.meta.next_token && !$.execution.testRun); } while (response.data.meta.next_token && !$.execution.testRun);

View File

@@ -35,7 +35,7 @@ const searchTweets = async ($: IGlobalVariable) => {
}, },
}; };
$.triggerOutput.data.push(dataItem); $.pushTriggerItem(dataItem);
}); });
} }
} while (response.data.meta.next_token && !$.execution.testRun); } while (response.data.meta.next_token && !$.execution.testRun);