refactor: Restructure apps with new data pushing logic
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
IGlobalVariable,
|
||||
IJSONObject,
|
||||
ITriggerOutput,
|
||||
} from '@automatisch/types';
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
import { omitBy, isEmpty } from 'lodash';
|
||||
|
||||
@@ -16,10 +12,6 @@ const getUserFollowers = async (
|
||||
) => {
|
||||
let response;
|
||||
|
||||
const followers: ITriggerOutput = {
|
||||
data: [],
|
||||
};
|
||||
|
||||
do {
|
||||
const params: IJSONObject = {
|
||||
pagination_token: response?.data?.meta?.next_token,
|
||||
@@ -40,18 +32,16 @@ const getUserFollowers = async (
|
||||
if (response.data.meta.result_count > 0) {
|
||||
for (const follower of response.data.data) {
|
||||
if ($.flow.isAlreadyProcessed(follower.id as string)) {
|
||||
return followers;
|
||||
return;
|
||||
}
|
||||
|
||||
followers.data.push({
|
||||
$.pushTriggerItem({
|
||||
raw: follower,
|
||||
meta: { internalId: follower.id as string },
|
||||
});
|
||||
}
|
||||
}
|
||||
} while (response.data.meta.next_token && !$.execution.testRun);
|
||||
|
||||
return followers;
|
||||
};
|
||||
|
||||
export default getUserFollowers;
|
||||
|
Reference in New Issue
Block a user