refactor: Introduce IActionOutput and ITriggerOutput types

This commit is contained in:
Faruk AYDIN
2022-10-12 21:10:44 +02:00
committed by Ali BARIN
parent 6895378d33
commit d9192f6e6b
22 changed files with 327 additions and 279 deletions

View File

@@ -1,4 +1,8 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
import {
IGlobalVariable,
IJSONObject,
ITriggerOutput,
} from '@automatisch/types';
import { URLSearchParams } from 'url';
import { omitBy, isEmpty } from 'lodash';
import generateRequest from './generate-request';
@@ -14,12 +18,8 @@ const getUserFollowers = async (
) => {
let response;
const followers: {
data: IJSONObject[];
error: IJSONObject | null;
} = {
const followers: ITriggerOutput = {
data: [],
error: null,
};
do {
@@ -54,7 +54,10 @@ const getUserFollowers = async (
!options.lastInternalId ||
Number(tweet.id) > Number(options.lastInternalId)
) {
followers.data.push(tweet);
followers.data.push({
raw: tweet,
meta: { internalId: tweet.id as string },
});
} else {
return;
}