@shaivpidadi/trends-js 0.0.0-beta.5 → 0.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/constants.d.ts +3 -0
  2. package/{lib → dist/cjs}/constants.js +5 -4
  3. package/dist/cjs/errors/GoogleTrendsError.d.ts +23 -0
  4. package/dist/cjs/errors/GoogleTrendsError.js +45 -0
  5. package/{lib → dist/cjs}/helpers/format.js +36 -9
  6. package/dist/cjs/helpers/googleTrendsAPI.d.ts +26 -0
  7. package/dist/cjs/helpers/googleTrendsAPI.js +211 -0
  8. package/{lib → dist/cjs}/helpers/request.js +14 -18
  9. package/dist/cjs/index.d.ts +9 -0
  10. package/dist/cjs/index.js +14 -0
  11. package/dist/cjs/types/enums.d.ts +12 -0
  12. package/dist/cjs/types/enums.js +17 -0
  13. package/dist/esm/constants.d.ts +3 -0
  14. package/dist/esm/constants.js +36 -0
  15. package/dist/esm/errors/GoogleTrendsError.d.ts +23 -0
  16. package/dist/esm/errors/GoogleTrendsError.js +37 -0
  17. package/dist/esm/helpers/format.d.ts +2 -0
  18. package/dist/esm/helpers/format.js +76 -0
  19. package/dist/esm/helpers/googleTrendsAPI.d.ts +26 -0
  20. package/dist/esm/helpers/googleTrendsAPI.js +207 -0
  21. package/dist/esm/helpers/request.d.ts +9 -0
  22. package/dist/esm/helpers/request.js +75 -0
  23. package/dist/esm/index.d.ts +9 -0
  24. package/dist/esm/index.js +11 -0
  25. package/dist/esm/types/enums.d.ts +12 -0
  26. package/dist/esm/types/enums.js +14 -0
  27. package/package.json +30 -36
  28. package/lib/constants.d.ts +0 -2
  29. package/lib/helpers/googleTrendsAPI.d.ts +0 -10
  30. package/lib/helpers/googleTrendsAPI.js +0 -200
  31. package/lib/index.d.ts +0 -2
  32. package/lib/index.js +0 -7
  33. /package/{lib → dist/cjs}/helpers/format.d.ts +0 -0
  34. /package/{lib → dist/cjs}/helpers/request.d.ts +0 -0
@@ -0,0 +1,76 @@
1
+ import { ParseError } from '../errors/GoogleTrendsError';
2
+ // For future refrence and update: from google trends page rpc call response,
3
+ // 0 "twitter down" The main trending search term.
4
+ // 1 null Unused (reserved for future Google Trends data).
5
+ // 2 "US" Country code (where the trend is happening).
6
+ // 3 [1741599600] Unix timestamp (represents when the search started trending).
7
+ // 4 null Unused (reserved for future data).
8
+ // 5 null Unused (reserved for future data).
9
+ // 6 500000 Search volume index (estimated search interest for the term).
10
+ // 7 null Unused (reserved for future data).
11
+ // 8 1000 Trend ranking score (higher means more popular).
12
+ // 9 ["twitter down", "is twitter down", "is x down", ...] Related searches (other queries that users searched alongside this term).
13
+ // 10 [11] Unclear, possibly a category identifier.
14
+ // 11 [[3606769742, "en", "US"], [3596035008, "en", "US"]] User demographics or trending sources, with numerical IDs, language ("en" for English), and country ("US" for United States).
15
+ // 12 "twitter down" The original trending keyword (sometimes a duplicate of index 0).
16
+ export const extractJsonFromResponse = (text) => {
17
+ const cleanedText = text.replace(/^\)\]\}'/, '').trim();
18
+ try {
19
+ const parsedResponse = JSON.parse(cleanedText);
20
+ if (!Array.isArray(parsedResponse) || parsedResponse.length === 0) {
21
+ throw new ParseError('Invalid response format: empty array');
22
+ }
23
+ const nestedJsonString = parsedResponse[0][2];
24
+ if (!nestedJsonString) {
25
+ throw new ParseError('Invalid response format: missing nested JSON');
26
+ }
27
+ const data = JSON.parse(nestedJsonString);
28
+ if (!data || !Array.isArray(data) || data.length < 2) {
29
+ throw new ParseError('Invalid response format: missing data array');
30
+ }
31
+ return updateResponseObject(data[1]);
32
+ }
33
+ catch (e) {
34
+ if (e instanceof ParseError) {
35
+ throw e;
36
+ }
37
+ throw new ParseError('Failed to parse response');
38
+ }
39
+ };
40
+ const updateResponseObject = (data) => {
41
+ if (!Array.isArray(data)) {
42
+ throw new ParseError('Invalid data format: expected array');
43
+ }
44
+ const allTrendingStories = [];
45
+ const summary = [];
46
+ data.forEach((item) => {
47
+ if (Array.isArray(item)) {
48
+ const story = {
49
+ title: String(item[0] || ''),
50
+ traffic: String(item[6] || '0'),
51
+ articles: Array.isArray(item[9]) ? item[9].map((article) => ({
52
+ title: String(article[0] || ''),
53
+ url: String(article[1] || ''),
54
+ source: String(article[2] || ''),
55
+ time: String(article[3] || ''),
56
+ snippet: String(article[4] || '')
57
+ })) : [],
58
+ shareUrl: String(item[12] || '')
59
+ };
60
+ if (item[1]) {
61
+ story.image = {
62
+ newsUrl: String(item[1][0] || ''),
63
+ source: String(item[1][1] || ''),
64
+ imageUrl: String(item[1][2] || '')
65
+ };
66
+ }
67
+ allTrendingStories.push(story);
68
+ summary.push({
69
+ title: story.title,
70
+ traffic: story.traffic,
71
+ articles: story.articles
72
+ });
73
+ }
74
+ });
75
+ return { allTrendingStories, summary };
76
+ };
@@ -0,0 +1,26 @@
1
+ import { DailyTrendingTopics, DailyTrendingTopicsOptions, RealTimeTrendsOptions, ExploreOptions, ExploreResponse, InterestByRegionOptions, InterestByRegionResponse, GoogleTrendsResponse } from '../types/index';
2
+ export declare class GoogleTrendsApi {
3
+ /**
4
+ * Get autocomplete suggestions for a keyword
5
+ * @param keyword - The keyword to get suggestions for
6
+ * @param hl - Language code (default: 'en-US')
7
+ * @returns Promise with array of suggestion strings
8
+ */
9
+ autocomplete(keyword: string, hl?: string): Promise<GoogleTrendsResponse<string[]>>;
10
+ /**
11
+ * Get daily trending topics
12
+ * @param options - Options for daily trends request
13
+ * @returns Promise with trending topics data
14
+ */
15
+ dailyTrends({ geo, lang }: DailyTrendingTopicsOptions): Promise<GoogleTrendsResponse<DailyTrendingTopics>>;
16
+ /**
17
+ * Get real-time trending topics
18
+ * @param options - Options for real-time trends request
19
+ * @returns Promise with trending topics data
20
+ */
21
+ realTimeTrends({ geo, trendingHours }: RealTimeTrendsOptions): Promise<GoogleTrendsResponse<DailyTrendingTopics>>;
22
+ explore({ keyword, geo, time, category, property, hl, }: ExploreOptions): Promise<ExploreResponse>;
23
+ interestByRegion({ keyword, startTime, endTime, geo, resolution, hl, timezone, category }: InterestByRegionOptions): Promise<InterestByRegionResponse>;
24
+ }
25
+ declare const _default: GoogleTrendsApi;
26
+ export default _default;
@@ -0,0 +1,207 @@
1
+ import { GoogleTrendsEndpoints } from '../types/enums';
2
+ import { request } from './request';
3
+ import { extractJsonFromResponse } from './format';
4
+ import { GOOGLE_TRENDS_MAPPER } from '../constants';
5
+ import { NetworkError, ParseError, UnknownError, } from '../errors/GoogleTrendsError';
6
+ export class GoogleTrendsApi {
7
+ /**
8
+ * Get autocomplete suggestions for a keyword
9
+ * @param keyword - The keyword to get suggestions for
10
+ * @param hl - Language code (default: 'en-US')
11
+ * @returns Promise with array of suggestion strings
12
+ */
13
+ async autocomplete(keyword, hl = 'en-US') {
14
+ if (!keyword) {
15
+ return { data: [] };
16
+ }
17
+ const options = {
18
+ ...GOOGLE_TRENDS_MAPPER[GoogleTrendsEndpoints.autocomplete],
19
+ qs: {
20
+ hl,
21
+ tz: '240',
22
+ },
23
+ };
24
+ try {
25
+ const response = await request(`${options.url}/${encodeURIComponent(keyword)}`, options);
26
+ const text = await response.text();
27
+ // Remove the first 5 characters (JSONP wrapper) and parse
28
+ const data = JSON.parse(text.slice(5));
29
+ return { data: data.default.topics.map((topic) => topic.title) };
30
+ }
31
+ catch (error) {
32
+ if (error instanceof Error) {
33
+ return { error: new NetworkError(error.message) };
34
+ }
35
+ return { error: new UnknownError() };
36
+ }
37
+ }
38
+ /**
39
+ * Get daily trending topics
40
+ * @param options - Options for daily trends request
41
+ * @returns Promise with trending topics data
42
+ */
43
+ async dailyTrends({ geo = 'US', lang = 'en' }) {
44
+ const defaultOptions = GOOGLE_TRENDS_MAPPER[GoogleTrendsEndpoints.dailyTrends];
45
+ const options = {
46
+ ...defaultOptions,
47
+ body: new URLSearchParams({
48
+ 'f.req': `[[["i0OFE","[null,null,\\"${geo}\\",0,\\"${lang}\\",24,1]",null,"generic"]]]`,
49
+ }).toString(),
50
+ contentType: 'form'
51
+ };
52
+ try {
53
+ const response = await request(options.url, options);
54
+ const text = await response.text();
55
+ const trendingTopics = extractJsonFromResponse(text);
56
+ if (!trendingTopics) {
57
+ return { error: new ParseError() };
58
+ }
59
+ return { data: trendingTopics };
60
+ }
61
+ catch (error) {
62
+ if (error instanceof Error) {
63
+ return { error: new NetworkError(error.message) };
64
+ }
65
+ return { error: new UnknownError() };
66
+ }
67
+ }
68
+ /**
69
+ * Get real-time trending topics
70
+ * @param options - Options for real-time trends request
71
+ * @returns Promise with trending topics data
72
+ */
73
+ async realTimeTrends({ geo = 'US', trendingHours = 4 }) {
74
+ const defaultOptions = GOOGLE_TRENDS_MAPPER[GoogleTrendsEndpoints.dailyTrends];
75
+ const options = {
76
+ ...defaultOptions,
77
+ body: new URLSearchParams({
78
+ 'f.req': `[[["i0OFE","[null,null,\\"${geo}\\",0,\\"en\\",${trendingHours},1]",null,"generic"]]]`,
79
+ }).toString(),
80
+ contentType: 'form'
81
+ };
82
+ try {
83
+ const response = await request(options.url, options);
84
+ const text = await response.text();
85
+ const trendingTopics = extractJsonFromResponse(text);
86
+ if (!trendingTopics) {
87
+ return { error: new ParseError() };
88
+ }
89
+ return { data: trendingTopics };
90
+ }
91
+ catch (error) {
92
+ if (error instanceof Error) {
93
+ return { error: new NetworkError(error.message) };
94
+ }
95
+ return { error: new UnknownError() };
96
+ }
97
+ }
98
+ async explore({ keyword, geo = 'US', time = 'now 1-d', category = 0, property = '', hl = 'en-US', }) {
99
+ const options = {
100
+ ...GOOGLE_TRENDS_MAPPER[GoogleTrendsEndpoints.explore],
101
+ qs: {
102
+ hl,
103
+ tz: '240',
104
+ req: JSON.stringify({
105
+ comparisonItem: [
106
+ {
107
+ keyword,
108
+ geo,
109
+ time,
110
+ },
111
+ ],
112
+ category,
113
+ property,
114
+ }),
115
+ },
116
+ contentType: 'form'
117
+ };
118
+ try {
119
+ const response = await request(options.url, options);
120
+ const text = await response.text();
121
+ // Remove the first 5 characters (JSONP wrapper) and parse
122
+ const data = JSON.parse(text.slice(5));
123
+ return data;
124
+ }
125
+ catch (error) {
126
+ console.error('Explore request failed:', error);
127
+ return { widgets: [] };
128
+ }
129
+ }
130
+ //
131
+ async interestByRegion({ keyword, startTime = new Date('2004-01-01'), endTime = new Date(), geo = 'US', resolution = 'REGION', hl = 'en-US', timezone = new Date().getTimezoneOffset(), category = 0 }) {
132
+ const formatDate = (date) => {
133
+ return date.toISOString().split('T')[0];
134
+ };
135
+ const formatTrendsDate = (date) => {
136
+ const pad = (n) => n.toString().padStart(2, '0');
137
+ const yyyy = date.getFullYear();
138
+ const mm = pad(date.getMonth() + 1);
139
+ const dd = pad(date.getDate());
140
+ const hh = pad(date.getHours());
141
+ const min = pad(date.getMinutes());
142
+ const ss = pad(date.getSeconds());
143
+ return `${yyyy}-${mm}-${dd}T${hh}\\:${min}\\:${ss}`;
144
+ };
145
+ const getDateRangeParam = (date) => {
146
+ const yesterday = new Date(date);
147
+ yesterday.setDate(date.getDate() - 1);
148
+ const formattedStart = formatTrendsDate(yesterday);
149
+ const formattedEnd = formatTrendsDate(date);
150
+ return `${formattedStart} ${formattedEnd}`;
151
+ };
152
+ const exploreResponse = await this.explore({
153
+ keyword: Array.isArray(keyword) ? keyword[0] : keyword,
154
+ geo: Array.isArray(geo) ? geo[0] : geo,
155
+ time: `${getDateRangeParam(startTime)} ${getDateRangeParam(endTime)}`,
156
+ category,
157
+ hl
158
+ });
159
+ const widget = exploreResponse.widgets.find(w => w.id === 'GEO_MAP');
160
+ if (!widget) {
161
+ return { default: { geoMapData: [] } };
162
+ }
163
+ const options = {
164
+ ...GOOGLE_TRENDS_MAPPER[GoogleTrendsEndpoints.interestByRegion],
165
+ qs: {
166
+ hl,
167
+ tz: timezone.toString(),
168
+ req: JSON.stringify({
169
+ geo: {
170
+ country: Array.isArray(geo) ? geo[0] : geo
171
+ },
172
+ comparisonItem: [{
173
+ time: `${formatDate(startTime)} ${formatDate(endTime)}`,
174
+ complexKeywordsRestriction: {
175
+ keyword: [{
176
+ type: 'BROAD',
177
+ value: Array.isArray(keyword) ? keyword[0] : keyword
178
+ }]
179
+ }
180
+ }],
181
+ resolution,
182
+ locale: hl,
183
+ requestOptions: {
184
+ property: '',
185
+ backend: 'CM',
186
+ category
187
+ },
188
+ userConfig: {
189
+ userType: 'USER_TYPE_LEGIT_USER'
190
+ }
191
+ }),
192
+ token: widget.token
193
+ }
194
+ };
195
+ try {
196
+ const response = await request(options.url, options);
197
+ const text = await response.text();
198
+ // Remove the first 5 characters (JSONP wrapper) and parse
199
+ const data = JSON.parse(text.slice(5));
200
+ return data;
201
+ }
202
+ catch (error) {
203
+ return { default: { geoMapData: [] } };
204
+ }
205
+ }
206
+ }
207
+ export default new GoogleTrendsApi();
@@ -0,0 +1,9 @@
1
+ export declare const request: (url: string, options: {
2
+ method?: string;
3
+ qs?: Record<string, any>;
4
+ body?: string | Record<string, any>;
5
+ headers?: Record<string, string>;
6
+ contentType?: 'json' | 'form';
7
+ }) => Promise<{
8
+ text: () => Promise<string>;
9
+ }>;
@@ -0,0 +1,75 @@
1
+ import https from 'https';
2
+ import querystring from 'querystring';
3
+ let cookieVal;
4
+ function rereq(options, body) {
5
+ return new Promise((resolve, reject) => {
6
+ const req = https.request(options, (res) => {
7
+ let chunk = '';
8
+ res.on('data', (data) => { chunk += data; });
9
+ res.on('end', () => resolve(chunk));
10
+ });
11
+ req.on('error', reject);
12
+ if (body)
13
+ req.write(body);
14
+ req.end();
15
+ });
16
+ }
17
+ export const request = async (url, options) => {
18
+ const parsedUrl = new URL(url);
19
+ const method = options.method || 'POST';
20
+ // Prepare body
21
+ let bodyString = '';
22
+ const contentType = options.contentType || 'json';
23
+ if (typeof options.body === 'string') {
24
+ bodyString = options.body;
25
+ }
26
+ else if (contentType === 'form') {
27
+ bodyString = querystring.stringify(options.body || {});
28
+ }
29
+ else if (options.body) {
30
+ bodyString = JSON.stringify(options.body);
31
+ }
32
+ const requestOptions = {
33
+ hostname: parsedUrl.hostname,
34
+ port: parsedUrl.port || 443,
35
+ path: `${parsedUrl.pathname}${options.qs ? '?' + querystring.stringify(options.qs) : ''}`,
36
+ method,
37
+ headers: {
38
+ ...(options.headers || {}),
39
+ ...(contentType === 'form'
40
+ ? { 'Content-Type': 'application/x-www-form-urlencoded' }
41
+ : { 'Content-Type': 'application/json' }),
42
+ ...(bodyString ? { 'Content-Length': Buffer.byteLength(bodyString).toString() } : {}),
43
+ ...(cookieVal ? { cookie: cookieVal } : {})
44
+ }
45
+ };
46
+ const response = await new Promise((resolve, reject) => {
47
+ const req = https.request(requestOptions, (res) => {
48
+ let chunk = '';
49
+ res.on('data', (data) => { chunk += data; });
50
+ res.on('end', async () => {
51
+ if (res.statusCode === 429 && res.headers['set-cookie']) {
52
+ cookieVal = res.headers['set-cookie'][0].split(';')[0];
53
+ requestOptions.headers['cookie'] = cookieVal;
54
+ try {
55
+ const retryResponse = await rereq(requestOptions, bodyString);
56
+ resolve(retryResponse);
57
+ }
58
+ catch (err) {
59
+ reject(err);
60
+ }
61
+ }
62
+ else {
63
+ resolve(chunk);
64
+ }
65
+ });
66
+ });
67
+ req.on('error', reject);
68
+ if (bodyString)
69
+ req.write(bodyString);
70
+ req.end();
71
+ });
72
+ return {
73
+ text: () => Promise.resolve(response)
74
+ };
75
+ };
@@ -0,0 +1,9 @@
1
+ export declare const dailyTrends: ({ geo, lang }: import("./types").DailyTrendingTopicsOptions) => Promise<import("./types").GoogleTrendsResponse<import("./types").DailyTrendingTopics>>;
2
+ export declare const realTimeTrends: ({ geo, trendingHours }: import("./types").RealTimeTrendsOptions) => Promise<import("./types").GoogleTrendsResponse<import("./types").DailyTrendingTopics>>;
3
+ export declare const autocomplete: (keyword: string, hl?: string) => Promise<import("./types").GoogleTrendsResponse<string[]>>;
4
+ declare const _default: {
5
+ dailyTrends: ({ geo, lang }: import("./types").DailyTrendingTopicsOptions) => Promise<import("./types").GoogleTrendsResponse<import("./types").DailyTrendingTopics>>;
6
+ realTimeTrends: ({ geo, trendingHours }: import("./types").RealTimeTrendsOptions) => Promise<import("./types").GoogleTrendsResponse<import("./types").DailyTrendingTopics>>;
7
+ autocomplete: (keyword: string, hl?: string) => Promise<import("./types").GoogleTrendsResponse<string[]>>;
8
+ };
9
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { GoogleTrendsApi } from './helpers/googleTrendsAPI';
2
+ const api = new GoogleTrendsApi();
3
+ export const dailyTrends = api.dailyTrends.bind(api);
4
+ export const realTimeTrends = api.realTimeTrends.bind(api);
5
+ export const autocomplete = api.autocomplete.bind(api);
6
+ // Default export for CommonJS compatibility
7
+ export default {
8
+ dailyTrends,
9
+ realTimeTrends,
10
+ autocomplete
11
+ };
@@ -0,0 +1,12 @@
1
+ export declare enum GoogleTrendsEndpoints {
2
+ dailyTrends = "dailyTrends",
3
+ autocomplete = "autocomplete",
4
+ explore = "explore",
5
+ interestByRegion = "interestByRegion"
6
+ }
7
+ export declare enum GoogleTrendsTrendingHours {
8
+ fourHrs = 4,
9
+ oneDay = 24,
10
+ twoDays = 48,
11
+ sevenDays = 168
12
+ }
@@ -0,0 +1,14 @@
1
+ export var GoogleTrendsEndpoints;
2
+ (function (GoogleTrendsEndpoints) {
3
+ GoogleTrendsEndpoints["dailyTrends"] = "dailyTrends";
4
+ GoogleTrendsEndpoints["autocomplete"] = "autocomplete";
5
+ GoogleTrendsEndpoints["explore"] = "explore";
6
+ GoogleTrendsEndpoints["interestByRegion"] = "interestByRegion";
7
+ })(GoogleTrendsEndpoints || (GoogleTrendsEndpoints = {}));
8
+ export var GoogleTrendsTrendingHours;
9
+ (function (GoogleTrendsTrendingHours) {
10
+ GoogleTrendsTrendingHours[GoogleTrendsTrendingHours["fourHrs"] = 4] = "fourHrs";
11
+ GoogleTrendsTrendingHours[GoogleTrendsTrendingHours["oneDay"] = 24] = "oneDay";
12
+ GoogleTrendsTrendingHours[GoogleTrendsTrendingHours["twoDays"] = 48] = "twoDays";
13
+ GoogleTrendsTrendingHours[GoogleTrendsTrendingHours["sevenDays"] = 168] = "sevenDays";
14
+ })(GoogleTrendsTrendingHours || (GoogleTrendsTrendingHours = {}));
package/package.json CHANGED
@@ -1,49 +1,43 @@
1
1
  {
2
2
  "name": "@shaivpidadi/trends-js",
3
- "version": "0.0.0-beta.5",
3
+ "version": "0.0.0-beta.7",
4
4
  "description": "Google Trends API for Node.js",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/esm/index.js",
7
+ "types": "./dist/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/esm/index.js",
11
+ "require": "./dist/cjs/index.js",
12
+ "types": "./dist/types/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
7
18
  "scripts": {
8
- "build": "tsc",
9
- "format": "prettier --write \"src/**/*.(js|ts)\"",
10
- "lint": "eslint src --ext .js,.ts",
11
- "lint:fix": "eslint src --fix --ext .js,.ts",
12
- "test": "jest --config jest.config.js",
13
- "prepare": "npm run build",
14
- "prepublishOnly": "npm test && npm run lint",
15
- "preversion": "npm run lint",
16
- "version": "npm run format && git add -A src",
17
- "postversion": "git push && git push --tags"
19
+ "build": "npm run build:esm && npm run build:cjs",
20
+ "build:esm": "tsc -p tsconfig.json --outDir dist/esm",
21
+ "build:cjs": "tsc -p tsconfig.json --outDir dist/cjs --module commonjs",
22
+ "test": "jest",
23
+ "prepare": "npm run build"
18
24
  },
19
25
  "repository": {
20
26
  "type": "git",
21
27
  "url": "git+https://github.com/Shaivpidadi/trends-js.git"
22
28
  },
23
29
  "keywords": [
24
- "boilerplate",
25
- "typescript",
26
- "npm",
27
- "module"
30
+ "google-trends",
31
+ "api",
32
+ "typescript"
28
33
  ],
29
- "author": "Shaishav Pidadi",
30
- "private": false,
31
- "publishConfig": {
32
- "access": "public"
33
- },
34
+ "author": "",
34
35
  "license": "MIT",
35
36
  "devDependencies": {
36
- "@types/jest": "29.5.14",
37
- "@typescript-eslint/eslint-plugin": "5.62.0",
38
- "@typescript-eslint/parser": "5.62.0",
39
- "eslint": "8.57.1",
40
- "eslint-plugin-jest": "27.9.0",
41
- "jest": "29.7.0",
42
- "prettier": "2.8.8",
43
- "ts-jest": "29.2.5",
44
- "typescript": "4.9.5"
45
- },
46
- "files": [
47
- "lib/**/*"
48
- ]
49
- }
37
+ "@types/jest": "^29.5.0",
38
+ "@types/node": "^20.0.0",
39
+ "jest": "^29.5.0",
40
+ "ts-jest": "^29.1.0",
41
+ "typescript": "^5.0.0"
42
+ }
43
+ }
@@ -1,2 +0,0 @@
1
- import { GoogleTrendsEndpoints, GoogleTrendsMapper } from './types';
2
- export declare const GOOGLE_TRENDS_MAPPER: Record<GoogleTrendsEndpoints, GoogleTrendsMapper>;
@@ -1,10 +0,0 @@
1
- import { DailyTrendingTopics, DailyTrendingTopicsOptions, RealTimeTrendsOptions, ExploreOptions, ExploreResponse, InterestByRegionOptions, InterestByRegionResponse } from '../types/index';
2
- export declare class GoogleTrendsApi {
3
- autocomplete(keyword: string, hl?: string): Promise<string[]>;
4
- dailyTrends({ geo, lang }: DailyTrendingTopicsOptions): Promise<DailyTrendingTopics>;
5
- realTimeTrends({ geo, trendingHours }: RealTimeTrendsOptions): Promise<DailyTrendingTopics>;
6
- explore({ keyword, geo, time, category, property, hl, }: ExploreOptions): Promise<ExploreResponse>;
7
- interestByRegion({ keyword, startTime, endTime, geo, resolution, hl, timezone, category }: InterestByRegionOptions): Promise<InterestByRegionResponse>;
8
- }
9
- declare const _default: GoogleTrendsApi;
10
- export default _default;