gdelt-ts-client 1.0.0
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.
- package/README.md +455 -0
- package/dist/client.d.ts +228 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +478 -0
- package/dist/client.js.map +1 -0
- package/dist/constants/index.d.ts +184 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +193 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/api-parameters.d.ts +201 -0
- package/dist/interfaces/api-parameters.d.ts.map +1 -0
- package/dist/interfaces/api-parameters.js +3 -0
- package/dist/interfaces/api-parameters.js.map +1 -0
- package/dist/interfaces/api-responses.d.ts +258 -0
- package/dist/interfaces/api-responses.d.ts.map +1 -0
- package/dist/interfaces/api-responses.js +6 -0
- package/dist/interfaces/api-responses.js.map +1 -0
- package/dist/types/enhanced-types.d.ts +227 -0
- package/dist/types/enhanced-types.d.ts.map +1 -0
- package/dist/types/enhanced-types.js +89 -0
- package/dist/types/enhanced-types.js.map +1 -0
- package/dist/types/query-builder.d.ts +252 -0
- package/dist/types/query-builder.d.ts.map +1 -0
- package/dist/types/query-builder.js +458 -0
- package/dist/types/query-builder.js.map +1 -0
- package/dist/types/type-guards.d.ts +110 -0
- package/dist/types/type-guards.d.ts.map +1 -0
- package/dist/types/type-guards.js +271 -0
- package/dist/types/type-guards.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for the GDELT API
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base URL for the GDELT API
|
|
6
|
+
*/
|
|
7
|
+
export declare const API_BASE_URL = "https://api.gdeltproject.org/api/v2/doc/doc";
|
|
8
|
+
/**
|
|
9
|
+
* Enum for the different output modes of the GDELT API
|
|
10
|
+
* @enum {string}
|
|
11
|
+
*/
|
|
12
|
+
export declare enum EMode {
|
|
13
|
+
/**
|
|
14
|
+
* Simple list of news articles that matched the query
|
|
15
|
+
*/
|
|
16
|
+
articleList = "artlist",
|
|
17
|
+
/**
|
|
18
|
+
* High design visual layout of articles with social sharing images
|
|
19
|
+
*/
|
|
20
|
+
articleGallery = "artgallery",
|
|
21
|
+
/**
|
|
22
|
+
* Displays all matching images processed by GDELT Visual Global Knowledge Graph
|
|
23
|
+
*/
|
|
24
|
+
imageCollage = "imagecollage",
|
|
25
|
+
/**
|
|
26
|
+
* Same as imageCollage but with additional information about each image
|
|
27
|
+
*/
|
|
28
|
+
imageCollageInfo = "imagecollageinfo",
|
|
29
|
+
/**
|
|
30
|
+
* High design visual layout of images
|
|
31
|
+
*/
|
|
32
|
+
imageGallery = "imagegallery",
|
|
33
|
+
/**
|
|
34
|
+
* List of social sharing images from matching articles
|
|
35
|
+
*/
|
|
36
|
+
imageCollageShare = "imagecollagesshare",
|
|
37
|
+
/**
|
|
38
|
+
* Timeline of news coverage volume by day/hour/15 minutes
|
|
39
|
+
*/
|
|
40
|
+
timelineVolume = "timelinevol",
|
|
41
|
+
/**
|
|
42
|
+
* Same as timelineVolume but returns raw counts instead of percentages
|
|
43
|
+
*/
|
|
44
|
+
timelineVolumeRaw = "timelinevolraw",
|
|
45
|
+
/**
|
|
46
|
+
* Same as timelineVolume but displays top 10 most relevant articles for each time step
|
|
47
|
+
*/
|
|
48
|
+
timelineVolumeInfo = "timelinevolinfo",
|
|
49
|
+
/**
|
|
50
|
+
* Timeline of average tone of matching coverage
|
|
51
|
+
*/
|
|
52
|
+
timelineTone = "timelinetone",
|
|
53
|
+
/**
|
|
54
|
+
* Timeline of coverage volume broken down by language
|
|
55
|
+
*/
|
|
56
|
+
timelineLanguage = "timelinelang",
|
|
57
|
+
/**
|
|
58
|
+
* Timeline of coverage volume broken down by source country
|
|
59
|
+
*/
|
|
60
|
+
timelineSourceCountry = "timelinesourcecountry",
|
|
61
|
+
/**
|
|
62
|
+
* Emotional histogram showing tonal distribution of coverage
|
|
63
|
+
*/
|
|
64
|
+
toneChart = "tonechart",
|
|
65
|
+
/**
|
|
66
|
+
* Word cloud of image tags from VGKG-processed images
|
|
67
|
+
*/
|
|
68
|
+
wordCloudImageTags = "wordcloudimagetags",
|
|
69
|
+
/**
|
|
70
|
+
* Word cloud of image web tags from VGKG-processed images
|
|
71
|
+
*/
|
|
72
|
+
wordCloudImageWebTags = "wordcloudimagewebtags"
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Enum for the different output formats of the GDELT API
|
|
76
|
+
* @enum {string}
|
|
77
|
+
*/
|
|
78
|
+
export declare enum EFormat {
|
|
79
|
+
/**
|
|
80
|
+
* Browser-based visualization or display
|
|
81
|
+
*/
|
|
82
|
+
html = "html",
|
|
83
|
+
/**
|
|
84
|
+
* Comma-delimited format
|
|
85
|
+
*/
|
|
86
|
+
csv = "csv",
|
|
87
|
+
/**
|
|
88
|
+
* RSS 2.0 format (only available in ArticleList mode)
|
|
89
|
+
*/
|
|
90
|
+
rss = "rss",
|
|
91
|
+
/**
|
|
92
|
+
* Extended RSS format with mobile/AMP versions (only available in ArticleList mode)
|
|
93
|
+
*/
|
|
94
|
+
rssArchive = "rssarchive",
|
|
95
|
+
/**
|
|
96
|
+
* JSON format
|
|
97
|
+
*/
|
|
98
|
+
json = "json",
|
|
99
|
+
/**
|
|
100
|
+
* JSONP format
|
|
101
|
+
*/
|
|
102
|
+
jsonp = "jsonp",
|
|
103
|
+
/**
|
|
104
|
+
* JSONFeed 1.0 format (only available in ArticleList mode)
|
|
105
|
+
*/
|
|
106
|
+
jsonFeed = "jsonfeed"
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Enum for the different timespan units of the GDELT API
|
|
110
|
+
* @enum {string}
|
|
111
|
+
*/
|
|
112
|
+
export declare enum ETimespanUnit {
|
|
113
|
+
/**
|
|
114
|
+
* Minutes
|
|
115
|
+
*/
|
|
116
|
+
minutes = "min",
|
|
117
|
+
/**
|
|
118
|
+
* Hours
|
|
119
|
+
*/
|
|
120
|
+
hours = "h",
|
|
121
|
+
/**
|
|
122
|
+
* Days
|
|
123
|
+
*/
|
|
124
|
+
days = "d",
|
|
125
|
+
/**
|
|
126
|
+
* Weeks
|
|
127
|
+
*/
|
|
128
|
+
weeks = "w",
|
|
129
|
+
/**
|
|
130
|
+
* Months
|
|
131
|
+
*/
|
|
132
|
+
months = "m"
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Enum for the different sort options of the GDELT API
|
|
136
|
+
* @enum {string}
|
|
137
|
+
*/
|
|
138
|
+
export declare enum ESort {
|
|
139
|
+
/**
|
|
140
|
+
* Sort by date, newest first
|
|
141
|
+
*/
|
|
142
|
+
dateDesc = "datedesc",
|
|
143
|
+
/**
|
|
144
|
+
* Sort by date, oldest first
|
|
145
|
+
*/
|
|
146
|
+
dateAsc = "dateasc",
|
|
147
|
+
/**
|
|
148
|
+
* Sort by tone, most positive first
|
|
149
|
+
*/
|
|
150
|
+
toneDesc = "tonedesc",
|
|
151
|
+
/**
|
|
152
|
+
* Sort by tone, most negative first
|
|
153
|
+
*/
|
|
154
|
+
toneAsc = "toneasc",
|
|
155
|
+
/**
|
|
156
|
+
* Default relevance sorting mode
|
|
157
|
+
*/
|
|
158
|
+
hybridRelevance = "hybridrel"
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Enum for the different translation options of the GDELT API
|
|
162
|
+
* @enum {string}
|
|
163
|
+
*/
|
|
164
|
+
export declare enum ETranslation {
|
|
165
|
+
/**
|
|
166
|
+
* Google Translate Widget
|
|
167
|
+
*/
|
|
168
|
+
googleTranslate = "googtrans"
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Enum for the different time zoom options of the GDELT API
|
|
172
|
+
* @enum {string}
|
|
173
|
+
*/
|
|
174
|
+
export declare enum ETimeZoom {
|
|
175
|
+
/**
|
|
176
|
+
* Enable interactive zooming
|
|
177
|
+
*/
|
|
178
|
+
enabled = "yes",
|
|
179
|
+
/**
|
|
180
|
+
* Disable interactive zooming
|
|
181
|
+
*/
|
|
182
|
+
disabled = "no"
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,gDAAgD,CAAC;AAE1E;;;GAGG;AACH,oBAAY,KAAK;IACf;;OAEG;IACH,WAAW,YAAY;IAEvB;;OAEG;IACH,cAAc,eAAe;IAE7B;;OAEG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,gBAAgB,qBAAqB;IAErC;;OAEG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,iBAAiB,uBAAuB;IAExC;;OAEG;IACH,cAAc,gBAAgB;IAE9B;;OAEG;IACH,iBAAiB,mBAAmB;IAEpC;;OAEG;IACH,kBAAkB,oBAAoB;IAEtC;;OAEG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,gBAAgB,iBAAiB;IAEjC;;OAEG;IACH,qBAAqB,0BAA0B;IAE/C;;OAEG;IACH,SAAS,cAAc;IAEvB;;OAEG;IACH,kBAAkB,uBAAuB;IAEzC;;OAEG;IACH,qBAAqB,0BAA0B;CAChD;AAED;;;GAGG;AACH,oBAAY,OAAO;IACjB;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,GAAG,QAAQ;IAEX;;OAEG;IACH,GAAG,QAAQ;IAEX;;OAEG;IACH,UAAU,eAAe;IAEzB;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,KAAK,UAAU;IAEf;;OAEG;IACH,QAAQ,aAAa;CACtB;AAED;;;GAGG;AACH,oBAAY,aAAa;IACvB;;OAEG;IACH,OAAO,QAAQ;IAEf;;OAEG;IACH,KAAK,MAAM;IAEX;;OAEG;IACH,IAAI,MAAM;IAEV;;OAEG;IACH,KAAK,MAAM;IAEX;;OAEG;IACH,MAAM,MAAM;CACb;AAED;;;GAGG;AACH,oBAAY,KAAK;IACf;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,eAAe,cAAc;CAC9B;AAED;;;GAGG;AACH,oBAAY,YAAY;IACtB;;OAEG;IACH,eAAe,cAAc;CAC9B;AAED;;;GAGG;AACH,oBAAY,SAAS;IACnB;;OAEG;IACH,OAAO,QAAQ;IAEf;;OAEG;IACH,QAAQ,OAAO;CAChB"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Constants for the GDELT API
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ETimeZoom = exports.ETranslation = exports.ESort = exports.ETimespanUnit = exports.EFormat = exports.EMode = exports.API_BASE_URL = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Base URL for the GDELT API
|
|
9
|
+
*/
|
|
10
|
+
exports.API_BASE_URL = 'https://api.gdeltproject.org/api/v2/doc/doc';
|
|
11
|
+
/**
|
|
12
|
+
* Enum for the different output modes of the GDELT API
|
|
13
|
+
* @enum {string}
|
|
14
|
+
*/
|
|
15
|
+
var EMode;
|
|
16
|
+
(function (EMode) {
|
|
17
|
+
/**
|
|
18
|
+
* Simple list of news articles that matched the query
|
|
19
|
+
*/
|
|
20
|
+
EMode["articleList"] = "artlist";
|
|
21
|
+
/**
|
|
22
|
+
* High design visual layout of articles with social sharing images
|
|
23
|
+
*/
|
|
24
|
+
EMode["articleGallery"] = "artgallery";
|
|
25
|
+
/**
|
|
26
|
+
* Displays all matching images processed by GDELT Visual Global Knowledge Graph
|
|
27
|
+
*/
|
|
28
|
+
EMode["imageCollage"] = "imagecollage";
|
|
29
|
+
/**
|
|
30
|
+
* Same as imageCollage but with additional information about each image
|
|
31
|
+
*/
|
|
32
|
+
EMode["imageCollageInfo"] = "imagecollageinfo";
|
|
33
|
+
/**
|
|
34
|
+
* High design visual layout of images
|
|
35
|
+
*/
|
|
36
|
+
EMode["imageGallery"] = "imagegallery";
|
|
37
|
+
/**
|
|
38
|
+
* List of social sharing images from matching articles
|
|
39
|
+
*/
|
|
40
|
+
EMode["imageCollageShare"] = "imagecollagesshare";
|
|
41
|
+
/**
|
|
42
|
+
* Timeline of news coverage volume by day/hour/15 minutes
|
|
43
|
+
*/
|
|
44
|
+
EMode["timelineVolume"] = "timelinevol";
|
|
45
|
+
/**
|
|
46
|
+
* Same as timelineVolume but returns raw counts instead of percentages
|
|
47
|
+
*/
|
|
48
|
+
EMode["timelineVolumeRaw"] = "timelinevolraw";
|
|
49
|
+
/**
|
|
50
|
+
* Same as timelineVolume but displays top 10 most relevant articles for each time step
|
|
51
|
+
*/
|
|
52
|
+
EMode["timelineVolumeInfo"] = "timelinevolinfo";
|
|
53
|
+
/**
|
|
54
|
+
* Timeline of average tone of matching coverage
|
|
55
|
+
*/
|
|
56
|
+
EMode["timelineTone"] = "timelinetone";
|
|
57
|
+
/**
|
|
58
|
+
* Timeline of coverage volume broken down by language
|
|
59
|
+
*/
|
|
60
|
+
EMode["timelineLanguage"] = "timelinelang";
|
|
61
|
+
/**
|
|
62
|
+
* Timeline of coverage volume broken down by source country
|
|
63
|
+
*/
|
|
64
|
+
EMode["timelineSourceCountry"] = "timelinesourcecountry";
|
|
65
|
+
/**
|
|
66
|
+
* Emotional histogram showing tonal distribution of coverage
|
|
67
|
+
*/
|
|
68
|
+
EMode["toneChart"] = "tonechart";
|
|
69
|
+
/**
|
|
70
|
+
* Word cloud of image tags from VGKG-processed images
|
|
71
|
+
*/
|
|
72
|
+
EMode["wordCloudImageTags"] = "wordcloudimagetags";
|
|
73
|
+
/**
|
|
74
|
+
* Word cloud of image web tags from VGKG-processed images
|
|
75
|
+
*/
|
|
76
|
+
EMode["wordCloudImageWebTags"] = "wordcloudimagewebtags";
|
|
77
|
+
})(EMode || (exports.EMode = EMode = {}));
|
|
78
|
+
/**
|
|
79
|
+
* Enum for the different output formats of the GDELT API
|
|
80
|
+
* @enum {string}
|
|
81
|
+
*/
|
|
82
|
+
var EFormat;
|
|
83
|
+
(function (EFormat) {
|
|
84
|
+
/**
|
|
85
|
+
* Browser-based visualization or display
|
|
86
|
+
*/
|
|
87
|
+
EFormat["html"] = "html";
|
|
88
|
+
/**
|
|
89
|
+
* Comma-delimited format
|
|
90
|
+
*/
|
|
91
|
+
EFormat["csv"] = "csv";
|
|
92
|
+
/**
|
|
93
|
+
* RSS 2.0 format (only available in ArticleList mode)
|
|
94
|
+
*/
|
|
95
|
+
EFormat["rss"] = "rss";
|
|
96
|
+
/**
|
|
97
|
+
* Extended RSS format with mobile/AMP versions (only available in ArticleList mode)
|
|
98
|
+
*/
|
|
99
|
+
EFormat["rssArchive"] = "rssarchive";
|
|
100
|
+
/**
|
|
101
|
+
* JSON format
|
|
102
|
+
*/
|
|
103
|
+
EFormat["json"] = "json";
|
|
104
|
+
/**
|
|
105
|
+
* JSONP format
|
|
106
|
+
*/
|
|
107
|
+
EFormat["jsonp"] = "jsonp";
|
|
108
|
+
/**
|
|
109
|
+
* JSONFeed 1.0 format (only available in ArticleList mode)
|
|
110
|
+
*/
|
|
111
|
+
EFormat["jsonFeed"] = "jsonfeed";
|
|
112
|
+
})(EFormat || (exports.EFormat = EFormat = {}));
|
|
113
|
+
/**
|
|
114
|
+
* Enum for the different timespan units of the GDELT API
|
|
115
|
+
* @enum {string}
|
|
116
|
+
*/
|
|
117
|
+
var ETimespanUnit;
|
|
118
|
+
(function (ETimespanUnit) {
|
|
119
|
+
/**
|
|
120
|
+
* Minutes
|
|
121
|
+
*/
|
|
122
|
+
ETimespanUnit["minutes"] = "min";
|
|
123
|
+
/**
|
|
124
|
+
* Hours
|
|
125
|
+
*/
|
|
126
|
+
ETimespanUnit["hours"] = "h";
|
|
127
|
+
/**
|
|
128
|
+
* Days
|
|
129
|
+
*/
|
|
130
|
+
ETimespanUnit["days"] = "d";
|
|
131
|
+
/**
|
|
132
|
+
* Weeks
|
|
133
|
+
*/
|
|
134
|
+
ETimespanUnit["weeks"] = "w";
|
|
135
|
+
/**
|
|
136
|
+
* Months
|
|
137
|
+
*/
|
|
138
|
+
ETimespanUnit["months"] = "m";
|
|
139
|
+
})(ETimespanUnit || (exports.ETimespanUnit = ETimespanUnit = {}));
|
|
140
|
+
/**
|
|
141
|
+
* Enum for the different sort options of the GDELT API
|
|
142
|
+
* @enum {string}
|
|
143
|
+
*/
|
|
144
|
+
var ESort;
|
|
145
|
+
(function (ESort) {
|
|
146
|
+
/**
|
|
147
|
+
* Sort by date, newest first
|
|
148
|
+
*/
|
|
149
|
+
ESort["dateDesc"] = "datedesc";
|
|
150
|
+
/**
|
|
151
|
+
* Sort by date, oldest first
|
|
152
|
+
*/
|
|
153
|
+
ESort["dateAsc"] = "dateasc";
|
|
154
|
+
/**
|
|
155
|
+
* Sort by tone, most positive first
|
|
156
|
+
*/
|
|
157
|
+
ESort["toneDesc"] = "tonedesc";
|
|
158
|
+
/**
|
|
159
|
+
* Sort by tone, most negative first
|
|
160
|
+
*/
|
|
161
|
+
ESort["toneAsc"] = "toneasc";
|
|
162
|
+
/**
|
|
163
|
+
* Default relevance sorting mode
|
|
164
|
+
*/
|
|
165
|
+
ESort["hybridRelevance"] = "hybridrel";
|
|
166
|
+
})(ESort || (exports.ESort = ESort = {}));
|
|
167
|
+
/**
|
|
168
|
+
* Enum for the different translation options of the GDELT API
|
|
169
|
+
* @enum {string}
|
|
170
|
+
*/
|
|
171
|
+
var ETranslation;
|
|
172
|
+
(function (ETranslation) {
|
|
173
|
+
/**
|
|
174
|
+
* Google Translate Widget
|
|
175
|
+
*/
|
|
176
|
+
ETranslation["googleTranslate"] = "googtrans";
|
|
177
|
+
})(ETranslation || (exports.ETranslation = ETranslation = {}));
|
|
178
|
+
/**
|
|
179
|
+
* Enum for the different time zoom options of the GDELT API
|
|
180
|
+
* @enum {string}
|
|
181
|
+
*/
|
|
182
|
+
var ETimeZoom;
|
|
183
|
+
(function (ETimeZoom) {
|
|
184
|
+
/**
|
|
185
|
+
* Enable interactive zooming
|
|
186
|
+
*/
|
|
187
|
+
ETimeZoom["enabled"] = "yes";
|
|
188
|
+
/**
|
|
189
|
+
* Disable interactive zooming
|
|
190
|
+
*/
|
|
191
|
+
ETimeZoom["disabled"] = "no";
|
|
192
|
+
})(ETimeZoom || (exports.ETimeZoom = ETimeZoom = {}));
|
|
193
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACU,QAAA,YAAY,GAAG,6CAA6C,CAAC;AAE1E;;;GAGG;AACH,IAAY,KA2EX;AA3ED,WAAY,KAAK;IACf;;OAEG;IACH,gCAAuB,CAAA;IAEvB;;OAEG;IACH,sCAA6B,CAAA;IAE7B;;OAEG;IACH,sCAA6B,CAAA;IAE7B;;OAEG;IACH,8CAAqC,CAAA;IAErC;;OAEG;IACH,sCAA6B,CAAA;IAE7B;;OAEG;IACH,iDAAwC,CAAA;IAExC;;OAEG;IACH,uCAA8B,CAAA;IAE9B;;OAEG;IACH,6CAAoC,CAAA;IAEpC;;OAEG;IACH,+CAAsC,CAAA;IAEtC;;OAEG;IACH,sCAA6B,CAAA;IAE7B;;OAEG;IACH,0CAAiC,CAAA;IAEjC;;OAEG;IACH,wDAA+C,CAAA;IAE/C;;OAEG;IACH,gCAAuB,CAAA;IAEvB;;OAEG;IACH,kDAAyC,CAAA;IAEzC;;OAEG;IACH,wDAA+C,CAAA;AACjD,CAAC,EA3EW,KAAK,qBAAL,KAAK,QA2EhB;AAED;;;GAGG;AACH,IAAY,OAmCX;AAnCD,WAAY,OAAO;IACjB;;OAEG;IACH,wBAAa,CAAA;IAEb;;OAEG;IACH,sBAAW,CAAA;IAEX;;OAEG;IACH,sBAAW,CAAA;IAEX;;OAEG;IACH,oCAAyB,CAAA;IAEzB;;OAEG;IACH,wBAAa,CAAA;IAEb;;OAEG;IACH,0BAAe,CAAA;IAEf;;OAEG;IACH,gCAAqB,CAAA;AACvB,CAAC,EAnCW,OAAO,uBAAP,OAAO,QAmClB;AAED;;;GAGG;AACH,IAAY,aAyBX;AAzBD,WAAY,aAAa;IACvB;;OAEG;IACH,gCAAe,CAAA;IAEf;;OAEG;IACH,4BAAW,CAAA;IAEX;;OAEG;IACH,2BAAU,CAAA;IAEV;;OAEG;IACH,4BAAW,CAAA;IAEX;;OAEG;IACH,6BAAY,CAAA;AACd,CAAC,EAzBW,aAAa,6BAAb,aAAa,QAyBxB;AAED;;;GAGG;AACH,IAAY,KAyBX;AAzBD,WAAY,KAAK;IACf;;OAEG;IACH,8BAAqB,CAAA;IAErB;;OAEG;IACH,4BAAmB,CAAA;IAEnB;;OAEG;IACH,8BAAqB,CAAA;IAErB;;OAEG;IACH,4BAAmB,CAAA;IAEnB;;OAEG;IACH,sCAA6B,CAAA;AAC/B,CAAC,EAzBW,KAAK,qBAAL,KAAK,QAyBhB;AAED;;;GAGG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB;;OAEG;IACH,6CAA6B,CAAA;AAC/B,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED;;;GAGG;AACH,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB;;OAEG;IACH,4BAAe,CAAA;IAEf;;OAEG;IACH,4BAAe,CAAA;AACjB,CAAC,EAVW,SAAS,yBAAT,SAAS,QAUpB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GDELT API TypeScript Client
|
|
3
|
+
* A strongly-typed client for interacting with the GDELT API
|
|
4
|
+
*/
|
|
5
|
+
export * from './constants';
|
|
6
|
+
export * from './interfaces/api-parameters';
|
|
7
|
+
export * from './interfaces/api-responses';
|
|
8
|
+
export * from './client';
|
|
9
|
+
export * from './types/enhanced-types';
|
|
10
|
+
export * from './types/type-guards';
|
|
11
|
+
export * from './types/query-builder';
|
|
12
|
+
export { GdeltClient as EnhancedGdeltClient } from './client';
|
|
13
|
+
export declare function createEnhancedGdeltClient(config?: import('./interfaces/api-parameters').IGdeltClientConfig): import('./client').GdeltClient;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,aAAa,CAAC;AAG5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAG3C,cAAc,UAAU,CAAC;AAGzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AAGtC,OAAO,EAAE,WAAW,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC9D,wBAAgB,yBAAyB,CAAC,MAAM,CAAC,EAAE,OAAO,6BAA6B,EAAE,kBAAkB,GAAG,OAAO,UAAU,EAAE,WAAW,CAE3I"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GDELT API TypeScript Client
|
|
4
|
+
* A strongly-typed client for interacting with the GDELT API
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.EnhancedGdeltClient = void 0;
|
|
22
|
+
exports.createEnhancedGdeltClient = createEnhancedGdeltClient;
|
|
23
|
+
// Export constants
|
|
24
|
+
__exportStar(require("./constants"), exports);
|
|
25
|
+
// Export interfaces
|
|
26
|
+
__exportStar(require("./interfaces/api-parameters"), exports);
|
|
27
|
+
__exportStar(require("./interfaces/api-responses"), exports);
|
|
28
|
+
// Export main client
|
|
29
|
+
__exportStar(require("./client"), exports);
|
|
30
|
+
// Export enhanced TypeScript features as utilities
|
|
31
|
+
__exportStar(require("./types/enhanced-types"), exports);
|
|
32
|
+
__exportStar(require("./types/type-guards"), exports);
|
|
33
|
+
__exportStar(require("./types/query-builder"), exports);
|
|
34
|
+
// Export factory function for backward compatibility
|
|
35
|
+
var client_1 = require("./client");
|
|
36
|
+
Object.defineProperty(exports, "EnhancedGdeltClient", { enumerable: true, get: function () { return client_1.GdeltClient; } });
|
|
37
|
+
function createEnhancedGdeltClient(config) {
|
|
38
|
+
return new (require('./client').GdeltClient)(config);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAmBH,8DAEC;AAnBD,mBAAmB;AACnB,8CAA4B;AAE5B,oBAAoB;AACpB,8DAA4C;AAC5C,6DAA2C;AAE3C,qBAAqB;AACrB,2CAAyB;AAEzB,mDAAmD;AACnD,yDAAuC;AACvC,sDAAoC;AACpC,wDAAsC;AAEtC,qDAAqD;AACrD,mCAA8D;AAArD,6GAAA,WAAW,OAAuB;AAC3C,SAAgB,yBAAyB,CAAC,MAAiE;IACzG,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { EFormat, EMode, ESort, ETimeZoom, ETranslation, ETimespanUnit } from '../constants';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for the GDELT API query operators
|
|
4
|
+
* These operators are used within the query parameter
|
|
5
|
+
*/
|
|
6
|
+
export interface IQueryOperators {
|
|
7
|
+
/**
|
|
8
|
+
* Returns all coverage from the specified domain
|
|
9
|
+
* @example domain:cnn.com
|
|
10
|
+
*/
|
|
11
|
+
domain?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Requires an exact match for domain, allowing searching for common short domains
|
|
14
|
+
* @example domainis:un.org
|
|
15
|
+
*/
|
|
16
|
+
domainIs?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Searches the average "tone" of human facial emotions in each image
|
|
19
|
+
* @example imagefacetone<-1.5
|
|
20
|
+
*/
|
|
21
|
+
imageFaceTone?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Searches the total number of foreground human faces in the image
|
|
24
|
+
* @example imagenumfaces>3
|
|
25
|
+
*/
|
|
26
|
+
imageNumFaces?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Searches a combination of OCR results, metadata, and caption
|
|
29
|
+
* @example imageocrmeta:"zika"
|
|
30
|
+
*/
|
|
31
|
+
imageOCRMeta?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Searches for images with specific tags assigned by Google's algorithms
|
|
34
|
+
* @example imagetag:"safesearchviolence"
|
|
35
|
+
*/
|
|
36
|
+
imageTag?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Searches for images that have appeared a certain number of times on the web
|
|
39
|
+
* @example imagewebcount<10
|
|
40
|
+
*/
|
|
41
|
+
imageWebCount?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Searches for images with specific tags derived from web captions
|
|
44
|
+
* @example imagewebtag:"drone"
|
|
45
|
+
*/
|
|
46
|
+
imageWebTag?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Allows specifying words that must appear within a given distance of each other
|
|
49
|
+
* @example near20:"trump putin"
|
|
50
|
+
*/
|
|
51
|
+
near?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Requires a word to appear at least a certain number of times in a document
|
|
54
|
+
* @example repeat3:"trump"
|
|
55
|
+
*/
|
|
56
|
+
repeat?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Searches for articles published in outlets located in a particular country
|
|
59
|
+
* @example sourcecountry:france
|
|
60
|
+
*/
|
|
61
|
+
sourceCountry?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Searches for articles originally published in the given language
|
|
64
|
+
* @example sourcelang:spanish
|
|
65
|
+
*/
|
|
66
|
+
sourceLang?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Searches for any of the GDELT Global Knowledge Graph (GKG) Themes
|
|
69
|
+
* @example theme:TERROR
|
|
70
|
+
*/
|
|
71
|
+
theme?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Filters for articles above or below a particular tone score
|
|
74
|
+
* @example tone<-5
|
|
75
|
+
*/
|
|
76
|
+
tone?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Searches for high emotion or low emotion articles, regardless of positive/negative
|
|
79
|
+
* @example toneabs>10
|
|
80
|
+
*/
|
|
81
|
+
toneAbs?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Interface for the GDELT API base parameters
|
|
85
|
+
*/
|
|
86
|
+
export interface IGdeltApiBaseParams {
|
|
87
|
+
/**
|
|
88
|
+
* The search query
|
|
89
|
+
* Can include keywords, phrases, and operators
|
|
90
|
+
*/
|
|
91
|
+
query: string;
|
|
92
|
+
/**
|
|
93
|
+
* The output mode
|
|
94
|
+
* Determines the type of visualization or data returned
|
|
95
|
+
*/
|
|
96
|
+
mode?: EMode;
|
|
97
|
+
/**
|
|
98
|
+
* The output format
|
|
99
|
+
* Determines the format of the returned data (HTML, JSON, CSV, etc.)
|
|
100
|
+
*/
|
|
101
|
+
format?: EFormat;
|
|
102
|
+
/**
|
|
103
|
+
* The timespan to search
|
|
104
|
+
* Specifies the number of months, weeks, days, hours, or minutes to search
|
|
105
|
+
* @example "1d" for 1 day, "2h" for 2 hours, "30min" for 30 minutes
|
|
106
|
+
*/
|
|
107
|
+
timespan?: string;
|
|
108
|
+
/**
|
|
109
|
+
* The start date/time to search
|
|
110
|
+
* Format: YYYYMMDDHHMMSS
|
|
111
|
+
* Must be within the last 3 months
|
|
112
|
+
*/
|
|
113
|
+
startdatetime?: string;
|
|
114
|
+
/**
|
|
115
|
+
* The end date/time to search
|
|
116
|
+
* Format: YYYYMMDDHHMMSS
|
|
117
|
+
* Must be within the last 3 months
|
|
118
|
+
*/
|
|
119
|
+
enddatetime?: string;
|
|
120
|
+
/**
|
|
121
|
+
* The maximum number of records to return
|
|
122
|
+
* Only applies to ArticleList and ImageCollage modes
|
|
123
|
+
* Default: 75, Maximum: 250
|
|
124
|
+
*/
|
|
125
|
+
maxrecords?: number;
|
|
126
|
+
/**
|
|
127
|
+
* The number of time steps to smooth over
|
|
128
|
+
* Only available in Timeline modes
|
|
129
|
+
* Maximum: 30
|
|
130
|
+
*/
|
|
131
|
+
timelinesmooth?: number;
|
|
132
|
+
/**
|
|
133
|
+
* The translation widget to embed
|
|
134
|
+
* Only available in ArticleList mode with HTML output
|
|
135
|
+
*/
|
|
136
|
+
trans?: ETranslation;
|
|
137
|
+
/**
|
|
138
|
+
* The sort order for results
|
|
139
|
+
* Default: relevance
|
|
140
|
+
*/
|
|
141
|
+
sort?: ESort;
|
|
142
|
+
/**
|
|
143
|
+
* Whether to enable interactive zooming of the timeline
|
|
144
|
+
* Only available for timeline modes in HTML format
|
|
145
|
+
*/
|
|
146
|
+
timezoom?: ETimeZoom;
|
|
147
|
+
/**
|
|
148
|
+
* The callback function name for JSONP format
|
|
149
|
+
* Only used when format is JSONP
|
|
150
|
+
*/
|
|
151
|
+
callback?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Interface for creating a timespan parameter
|
|
155
|
+
*/
|
|
156
|
+
export interface ITimespan {
|
|
157
|
+
/**
|
|
158
|
+
* The value of the timespan
|
|
159
|
+
*/
|
|
160
|
+
value: number;
|
|
161
|
+
/**
|
|
162
|
+
* The unit of the timespan
|
|
163
|
+
*/
|
|
164
|
+
unit: ETimespanUnit;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Interface for the GDELT API client configuration
|
|
168
|
+
*/
|
|
169
|
+
export interface IGdeltClientConfig {
|
|
170
|
+
/**
|
|
171
|
+
* The base URL for the GDELT API
|
|
172
|
+
* @default "https://api.gdeltproject.org/api/v2/doc/doc"
|
|
173
|
+
*/
|
|
174
|
+
baseUrl?: string;
|
|
175
|
+
/**
|
|
176
|
+
* The default format for API responses
|
|
177
|
+
* @default EFormat.json
|
|
178
|
+
*/
|
|
179
|
+
defaultFormat?: EFormat;
|
|
180
|
+
/**
|
|
181
|
+
* The timeout for API requests in milliseconds
|
|
182
|
+
* @default 30000 (30 seconds)
|
|
183
|
+
*/
|
|
184
|
+
timeout?: number;
|
|
185
|
+
/**
|
|
186
|
+
* Whether to retry failed requests
|
|
187
|
+
* @default true
|
|
188
|
+
*/
|
|
189
|
+
retry?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* The maximum number of retries for failed requests
|
|
192
|
+
* @default 3
|
|
193
|
+
*/
|
|
194
|
+
maxRetries?: number;
|
|
195
|
+
/**
|
|
196
|
+
* The delay between retries in milliseconds
|
|
197
|
+
* @default 1000 (1 second)
|
|
198
|
+
*/
|
|
199
|
+
retryDelay?: number;
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=api-parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-parameters.d.ts","sourceRoot":"","sources":["../../src/interfaces/api-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7F;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;IAEb;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;IAEb;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,aAAa,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-parameters.js","sourceRoot":"","sources":["../../src/interfaces/api-parameters.ts"],"names":[],"mappings":""}
|