-
Notifications
You must be signed in to change notification settings - Fork 149
/
types.d.ts
253 lines (231 loc) · 6.08 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
/* eslint-disable no-unused-vars */
type DomainType = {
ID: number,
domain: string,
slug: string,
tags?: string,
notification: boolean,
notification_interval: string,
notification_emails: string,
lastUpdated: string,
added: string,
keywordCount?: number,
keywordsUpdated?: string,
avgPosition?: number,
scVisits?: number,
scImpressions?: number,
scPosition?: number,
search_console?: string,
ideas_settings?: string,
}
type KeywordHistory = {
[date:string] : number
}
type KeywordType = {
ID: number,
keyword: string,
device: string,
country: string,
domain: string,
lastUpdated: string,
added: string,
position: number,
volume: number,
sticky: boolean,
history: KeywordHistory,
lastResult: KeywordLastResult[],
url: string,
tags: string[],
updating: boolean,
lastUpdateError: {date: string, error: string, scraper: string} | false,
scData?: KeywordSCData,
uid?: string
city?: string
}
type KeywordLastResult = {
position: number,
url: string,
title: string
}
type KeywordFilters = {
countries: string[],
tags: string[],
search: string,
}
type countryData = {
[ISO:string] : [countryName:string, cityName:string, language:string, AdWordsID: number]
}
type countryCodeData = {
[ISO:string] : string
}
type DomainSearchConsole = {
property_type: 'domain' | 'url',
url: string,
client_email:string,
private_key:string,
}
type DomainSettings = {
notification_interval: string,
notification_emails: string,
search_console?: DomainSearchConsole
}
type SettingsType = {
scraper_type: string,
scaping_api?: string,
proxy?: string,
notification_interval: string,
notification_email: string,
notification_email_from: string,
notification_email_from_name: string,
smtp_server: string,
smtp_port: string,
smtp_username?: string,
smtp_password?: string,
available_scapers?: { label: string, value: string, allowsCity?: boolean }[],
scrape_interval?: string,
scrape_delay?: string,
scrape_retry?: boolean,
failed_queue?: string[]
version?: string,
screenshot_key?: string,
search_console: boolean,
search_console_client_email: string,
search_console_private_key: string,
search_console_integrated?: boolean,
adwords_client_id?: string,
adwords_client_secret?: string,
adwords_refresh_token?: string,
adwords_developer_token?: string,
adwords_account_id?: string,
keywordsColumns: string[]
}
type KeywordSCDataChild = {
yesterday: number,
threeDays: number,
sevenDays: number,
thirtyDays: number,
avgSevenDays: number,
avgThreeDays: number,
avgThirtyDays: number,
}
type KeywordSCData = {
impressions: KeywordSCDataChild,
visits: KeywordSCDataChild,
ctr: KeywordSCDataChild,
position:KeywordSCDataChild
}
type KeywordAddPayload = {
keyword: string,
device: string,
country: string,
domain: string,
tags?: string,
city?:string
}
type SearchAnalyticsRawItem = {
keys: string[],
clicks: number,
impressions: number,
ctr: number,
position: number,
}
type SearchAnalyticsStat = {
date: string,
clicks: number,
impressions: number,
ctr: number,
position: number,
}
type InsightDataType = {
stats: SearchAnalyticsStat[]|null,
keywords: SCInsightItem[],
countries: SCInsightItem[],
pages: SCInsightItem[],
}
type SCInsightItem = {
clicks: number,
impressions: number,
ctr: number,
position: number,
countries?: number,
country?: string,
keyword?: string,
keywords?: number,
page?: string,
date?: string
}
type SearchAnalyticsItem = {
keyword: string,
uid: string,
device: string,
page: string,
country: string,
clicks: number,
impressions: number,
ctr: number,
position: number,
date?: string
}
type SCDomainDataType = {
threeDays : SearchAnalyticsItem[],
sevenDays : SearchAnalyticsItem[],
thirtyDays : SearchAnalyticsItem[],
lastFetched?: string,
lastFetchError?: string,
stats? : SearchAnalyticsStat[],
}
type SCKeywordType = SearchAnalyticsItem;
type DomainIdeasSettings = {
seedSCKeywords: boolean,
seedCurrentKeywords: boolean,
seedDomain: boolean,
language: string,
countries: string[],
keywords: string
}
type AdwordsCredentials = {
client_id: string,
client_secret: string,
developer_token: string,
account_id: string,
refresh_token: string,
}
type IdeaKeyword = {
uid: string,
keyword: string,
competition: 'UNSPECIFIED' | 'UNKNOWN' | 'HIGH' | 'LOW' | 'MEDIUM',
country: string,
domain: string,
competitionIndex : number,
monthlySearchVolumes: Record<string, string>,
avgMonthlySearches: number,
added: number,
updated: number,
position:number
}
type scraperExtractedItem = {
title: string,
url: string,
position: number,
}
interface ScraperSettings {
/** A Unique ID for the Scraper. eg: myScraper */
id:string,
/** The Name of the Scraper */
name:string,
/** The Website address of the Scraper */
website:string,
/** The result object's key that contains the results of the scraped data. For example,
* if your scraper API the data like this `{scraped:[item1,item2..]}` the resultObjectKey should be "scraped" */
resultObjectKey: string,
/** If the Scraper allows setting a perices location or allows city level scraping set this to true. */
allowsCity?: boolean,
/** Set your own custom HTTP header properties when making the scraper API request.
* The function should return an object that contains all the header properties you want to pass to API request's header.
* Example: `{'Cache-Control': 'max-age=0', 'Content-Type': 'application/json'}` */
headers?(keyword:KeywordType, settings: SettingsType): Object,
/** Construct the API URL for scraping the data through your Scraper's API */
scrapeURL?(keyword:KeywordType, settings:SettingsType, countries:countryData): string,
/** Custom function to extract the serp result from the scraped data. The extracted data should be @return {scraperExtractedItem[]} */
serpExtractor?(content:string): scraperExtractedItem[],
}