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.
@@ -0,0 +1,258 @@
1
+ /**
2
+ * Interfaces for GDELT API responses
3
+ */
4
+ /**
5
+ * Base interface for all GDELT API responses
6
+ */
7
+ export interface IGdeltApiResponse {
8
+ /**
9
+ * Status of the API request
10
+ */
11
+ status: string;
12
+ }
13
+ /**
14
+ * Interface for an article in the GDELT API response
15
+ */
16
+ export interface IArticle {
17
+ /**
18
+ * The URL of the article
19
+ */
20
+ url: string;
21
+ /**
22
+ * The title of the article
23
+ */
24
+ title: string;
25
+ /**
26
+ * The date the article was published
27
+ * Format: YYYYMMDDHHMMSS
28
+ */
29
+ seendate: string;
30
+ /**
31
+ * The domain of the article
32
+ */
33
+ domain: string;
34
+ /**
35
+ * The country where the article was published
36
+ */
37
+ sourcecountry: string;
38
+ /**
39
+ * The language the article was originally published in
40
+ */
41
+ sourcelanguage: string;
42
+ /**
43
+ * The URL of the social sharing image for the article
44
+ */
45
+ socialimage?: string;
46
+ /**
47
+ * The tone score of the article
48
+ * Range: -100 (extremely negative) to +100 (extremely positive)
49
+ */
50
+ tone?: number;
51
+ }
52
+ /**
53
+ * Interface for the article list response
54
+ */
55
+ export interface IArticleListResponse extends IGdeltApiResponse {
56
+ /**
57
+ * The list of articles that matched the query
58
+ */
59
+ articles: IArticle[];
60
+ /**
61
+ * The total number of articles that matched the query
62
+ */
63
+ count: number;
64
+ }
65
+ /**
66
+ * Interface for an image in the GDELT API response
67
+ */
68
+ export interface IImage {
69
+ /**
70
+ * The URL of the image
71
+ */
72
+ url: string;
73
+ /**
74
+ * The URL of the article containing the image
75
+ */
76
+ articleurl: string;
77
+ /**
78
+ * The date the image was seen
79
+ * Format: YYYYMMDDHHMMSS
80
+ */
81
+ seendate: string;
82
+ /**
83
+ * The number of times the image has been seen on the web
84
+ * Only available in ImageCollageInfo mode
85
+ */
86
+ webcount?: number;
87
+ /**
88
+ * The list of URLs where the image has been seen before
89
+ * Only available in ImageCollageInfo mode
90
+ */
91
+ webexamples?: string[];
92
+ /**
93
+ * The date the image was captured according to its metadata
94
+ * Format: YYYYMMDDHHMMSS
95
+ * Only available in ImageCollageInfo mode
96
+ */
97
+ capturedate?: string;
98
+ /**
99
+ * Whether the image is older than 72 hours
100
+ * Only available in ImageCollageInfo mode
101
+ */
102
+ oldimage?: boolean;
103
+ /**
104
+ * The tags assigned to the image by Google's algorithms
105
+ * Only available when using imagetag in the query
106
+ */
107
+ tags?: string[];
108
+ /**
109
+ * The web tags derived from captions across the web
110
+ * Only available when using imagewebtag in the query
111
+ */
112
+ webtags?: string[];
113
+ /**
114
+ * The average tone of human facial emotions in the image
115
+ * Only available when using imagefacetone in the query
116
+ */
117
+ facetone?: number;
118
+ /**
119
+ * The number of human faces in the image
120
+ * Only available when using imagenumfaces in the query
121
+ */
122
+ numfaces?: number;
123
+ }
124
+ /**
125
+ * Interface for the image collage response
126
+ */
127
+ export interface IImageCollageResponse extends IGdeltApiResponse {
128
+ /**
129
+ * The list of images that matched the query
130
+ */
131
+ images: IImage[];
132
+ /**
133
+ * The total number of images that matched the query
134
+ */
135
+ count: number;
136
+ }
137
+ /**
138
+ * Interface for a timeline data point
139
+ */
140
+ export interface ITimelineDataPoint {
141
+ /**
142
+ * The date of the data point
143
+ * Format varies based on the timespan
144
+ */
145
+ date: string;
146
+ /**
147
+ * The value of the data point
148
+ * For TimelineVol: percentage of all global coverage
149
+ * For TimelineVolRaw: raw count of articles
150
+ * For TimelineTone: average tone
151
+ */
152
+ value: number;
153
+ /**
154
+ * The total number of all articles monitored during that time interval
155
+ * Only available in TimelineVolRaw mode
156
+ */
157
+ norm?: number;
158
+ /**
159
+ * The top 10 most relevant articles for this time step
160
+ * Only available in TimelineVolInfo mode
161
+ */
162
+ articles?: IArticle[];
163
+ }
164
+ /**
165
+ * Interface for the timeline response
166
+ */
167
+ export interface ITimelineResponse extends IGdeltApiResponse {
168
+ /**
169
+ * The timeline data points
170
+ */
171
+ timeline: ITimelineDataPoint[];
172
+ }
173
+ /**
174
+ * Interface for a language or country data point in timeline responses
175
+ */
176
+ export interface ITimelineBreakdownDataPoint {
177
+ /**
178
+ * The date of the data point
179
+ */
180
+ date: string;
181
+ /**
182
+ * The values for each language or country
183
+ * Key: language code or country code
184
+ * Value: percentage or count
185
+ */
186
+ values: Record<string, number>;
187
+ }
188
+ /**
189
+ * Interface for the timeline language or country breakdown response
190
+ */
191
+ export interface ITimelineBreakdownResponse extends IGdeltApiResponse {
192
+ /**
193
+ * The timeline data points with language or country breakdown
194
+ */
195
+ timeline: ITimelineBreakdownDataPoint[];
196
+ /**
197
+ * The list of languages or countries in the response
198
+ */
199
+ labels: string[];
200
+ }
201
+ /**
202
+ * Interface for a tone bin in the tone chart response
203
+ */
204
+ export interface IToneBin {
205
+ /**
206
+ * The tone bin value
207
+ */
208
+ bin: number;
209
+ /**
210
+ * The number of articles in this tone bin
211
+ */
212
+ count: number;
213
+ /**
214
+ * The top articles in this tone bin
215
+ */
216
+ toparts: {
217
+ /**
218
+ * The URL of the article
219
+ */
220
+ url: string;
221
+ /**
222
+ * The title of the article
223
+ */
224
+ title: string;
225
+ }[];
226
+ }
227
+ /**
228
+ * Interface for the tone chart response
229
+ */
230
+ export interface IToneChartResponse extends IGdeltApiResponse {
231
+ /**
232
+ * The tone chart data
233
+ */
234
+ tonechart: IToneBin[];
235
+ }
236
+ /**
237
+ * Interface for a word cloud tag
238
+ */
239
+ export interface IWordCloudTag {
240
+ /**
241
+ * The tag text
242
+ */
243
+ tag: string;
244
+ /**
245
+ * The weight of the tag (frequency)
246
+ */
247
+ weight: number;
248
+ }
249
+ /**
250
+ * Interface for the word cloud response
251
+ */
252
+ export interface IWordCloudResponse extends IGdeltApiResponse {
253
+ /**
254
+ * The word cloud tags
255
+ */
256
+ tags: IWordCloudTag[];
257
+ }
258
+ //# sourceMappingURL=api-responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"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;IACH,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D;;OAEG;IACH,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Interfaces for GDELT API responses
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=api-responses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-responses.js","sourceRoot":"","sources":["../../src/interfaces/api-responses.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -0,0 +1,227 @@
1
+ /**
2
+ * Enhanced types for better developer experience and type safety
3
+ */
4
+ /**
5
+ * Mode constants using const assertions for better IntelliSense and extensibility
6
+ */
7
+ export declare const Mode: {
8
+ readonly ARTICLE_LIST: "artlist";
9
+ readonly ARTICLE_GALLERY: "artgallery";
10
+ readonly IMAGE_COLLAGE: "imagecollage";
11
+ readonly IMAGE_COLLAGE_INFO: "imagecollageinfo";
12
+ readonly IMAGE_GALLERY: "imagegallery";
13
+ readonly IMAGE_COLLAGE_SHARE: "imagecollagesshare";
14
+ readonly TIMELINE_VOLUME: "timelinevol";
15
+ readonly TIMELINE_VOLUME_RAW: "timelinevolraw";
16
+ readonly TIMELINE_VOLUME_INFO: "timelinevolinfo";
17
+ readonly TIMELINE_TONE: "timelinetone";
18
+ readonly TIMELINE_LANGUAGE: "timelinelang";
19
+ readonly TIMELINE_SOURCE_COUNTRY: "timelinesourcecountry";
20
+ readonly TONE_CHART: "tonechart";
21
+ readonly WORD_CLOUD_IMAGE_TAGS: "wordcloudimagetags";
22
+ readonly WORD_CLOUD_IMAGE_WEB_TAGS: "wordcloudimagewebtags";
23
+ };
24
+ export type ModeType = typeof Mode[keyof typeof Mode];
25
+ /**
26
+ * Format constants using const assertions
27
+ */
28
+ export declare const Format: {
29
+ readonly HTML: "html";
30
+ readonly CSV: "csv";
31
+ readonly RSS: "rss";
32
+ readonly RSS_ARCHIVE: "rssarchive";
33
+ readonly JSON: "json";
34
+ readonly JSONP: "jsonp";
35
+ readonly JSON_FEED: "jsonfeed";
36
+ };
37
+ export type FormatType = typeof Format[keyof typeof Format];
38
+ /**
39
+ * Timespan unit constants using const assertions
40
+ */
41
+ export declare const TimespanUnit: {
42
+ readonly MINUTES: "min";
43
+ readonly HOURS: "h";
44
+ readonly DAYS: "d";
45
+ readonly WEEKS: "w";
46
+ readonly MONTHS: "m";
47
+ };
48
+ export type TimespanUnitType = typeof TimespanUnit[keyof typeof TimespanUnit];
49
+ /**
50
+ * Sort option constants using const assertions
51
+ */
52
+ export declare const SortOrder: {
53
+ readonly DATE_DESC: "datedesc";
54
+ readonly DATE_ASC: "dateasc";
55
+ readonly TONE_DESC: "tonedesc";
56
+ readonly TONE_ASC: "toneasc";
57
+ readonly HYBRID_RELEVANCE: "hybridrel";
58
+ };
59
+ export type SortOrderType = typeof SortOrder[keyof typeof SortOrder];
60
+ /**
61
+ * Template literal types for timespan validation
62
+ */
63
+ export type TimespanString = `${number}min` | `${number}h` | `${number}d` | `${number}w` | `${number}m`;
64
+ /**
65
+ * Template literal types for datetime validation (YYYYMMDDHHMMSS)
66
+ */
67
+ export type DateTimeString = `${number}${number}${number}${number}${number}${number}${number}${number}${number}${number}${number}${number}${number}${number}`;
68
+ /**
69
+ * Template literal types for tone queries
70
+ */
71
+ export type ToneQuery = `tone>${number}` | `tone<${number}` | `tone=${number}` | `toneabs>${number}` | `toneabs<${number}` | `toneabs=${number}`;
72
+ /**
73
+ * Template literal types for domain queries
74
+ */
75
+ export type DomainQuery = `domain:${string}` | `domainis:${string}`;
76
+ /**
77
+ * Template literal types for source queries
78
+ */
79
+ export type SourceQuery = `sourcecountry:${string}` | `sourcelang:${string}`;
80
+ /**
81
+ * Template literal types for image queries
82
+ */
83
+ export type ImageQuery = `imagetag:"${string}"` | `imagewebtag:"${string}"` | `imageocrmeta:"${string}"` | `imagefacetone>${number}` | `imagefacetone<${number}` | `imagenumfaces>${number}` | `imagenumfaces<${number}` | `imagenumfaces=${number}` | `imagewebcount>${number}` | `imagewebcount<${number}`;
84
+ /**
85
+ * Template literal types for proximity queries
86
+ */
87
+ export type ProximityQuery = `near${number}:"${string}"`;
88
+ /**
89
+ * Template literal types for repeat queries
90
+ */
91
+ export type RepeatQuery = `repeat${number}:"${string}"`;
92
+ /**
93
+ * Template literal types for theme queries
94
+ */
95
+ export type ThemeQuery = `theme:${string}`;
96
+ /**
97
+ * Utility type for creating strongly typed query builders
98
+ */
99
+ export type QueryComponent = string | ToneQuery | DomainQuery | SourceQuery | ImageQuery | ProximityQuery | RepeatQuery | ThemeQuery;
100
+ /**
101
+ * Utility type for boolean OR queries
102
+ */
103
+ export type BooleanOrQuery<T extends string = string> = `(${T}${` OR ${T}`})`;
104
+ /**
105
+ * Utility type for phrase queries
106
+ */
107
+ export type PhraseQuery<T extends string = string> = `"${T}"`;
108
+ /**
109
+ * Utility type for negation queries
110
+ */
111
+ export type NegationQuery<T extends QueryComponent = QueryComponent> = `-${T}`;
112
+ /**
113
+ * Complex query type that combines multiple query components
114
+ */
115
+ export type ComplexQuery = QueryComponent | BooleanOrQuery<string> | PhraseQuery<string> | NegationQuery<QueryComponent> | `${QueryComponent} AND ${QueryComponent}` | `${QueryComponent} OR ${QueryComponent}` | `${QueryComponent} NOT ${QueryComponent}`;
116
+ /**
117
+ * Parameters specific to article list modes
118
+ */
119
+ export interface ArticleListParams {
120
+ maxrecords?: number;
121
+ sort?: SortOrderType;
122
+ }
123
+ /**
124
+ * Parameters specific to timeline modes
125
+ */
126
+ export interface TimelineParams {
127
+ timelinesmooth?: number;
128
+ timezoom?: 'yes' | 'no';
129
+ }
130
+ /**
131
+ * Parameters specific to image modes
132
+ */
133
+ export interface ImageParams {
134
+ maxrecords?: number;
135
+ }
136
+ /**
137
+ * Conditional parameter types based on mode
138
+ */
139
+ export type ModeSpecificParams<T extends ModeType> = T extends typeof Mode.ARTICLE_LIST | typeof Mode.ARTICLE_GALLERY ? ArticleListParams : T extends typeof Mode.TIMELINE_VOLUME | typeof Mode.TIMELINE_VOLUME_RAW | typeof Mode.TIMELINE_VOLUME_INFO | typeof Mode.TIMELINE_TONE | typeof Mode.TIMELINE_LANGUAGE | typeof Mode.TIMELINE_SOURCE_COUNTRY ? TimelineParams : T extends typeof Mode.IMAGE_COLLAGE | typeof Mode.IMAGE_COLLAGE_INFO | typeof Mode.IMAGE_GALLERY | typeof Mode.IMAGE_COLLAGE_SHARE ? ImageParams : Record<string, never>;
140
+ /**
141
+ * Enhanced base parameters with stronger typing
142
+ */
143
+ export interface EnhancedGdeltApiParams<TMode extends ModeType = ModeType> {
144
+ /**
145
+ * The search query with enhanced type validation
146
+ */
147
+ query: string | ComplexQuery;
148
+ /**
149
+ * The output mode with const assertion types
150
+ */
151
+ mode?: TMode;
152
+ /**
153
+ * The output format with const assertion types
154
+ */
155
+ format?: FormatType;
156
+ /**
157
+ * Strongly typed timespan parameter
158
+ */
159
+ timespan?: TimespanString;
160
+ /**
161
+ * Strongly typed start datetime
162
+ */
163
+ startdatetime?: DateTimeString;
164
+ /**
165
+ * Strongly typed end datetime
166
+ */
167
+ enddatetime?: DateTimeString;
168
+ /**
169
+ * Translation options
170
+ */
171
+ trans?: 'googtrans';
172
+ /**
173
+ * JSONP callback (only when format is JSONP)
174
+ */
175
+ callback?: FormatType extends typeof Format.JSONP ? string : never;
176
+ }
177
+ /**
178
+ * Complete parameter type that combines base params with mode-specific params
179
+ */
180
+ export type CompleteGdeltApiParams<TMode extends ModeType = ModeType> = EnhancedGdeltApiParams<TMode> & ModeSpecificParams<TMode>;
181
+ /**
182
+ * Utility type for extracting the return type based on mode
183
+ */
184
+ export type ResponseTypeForMode<T extends ModeType> = T extends typeof Mode.ARTICLE_LIST | typeof Mode.ARTICLE_GALLERY ? 'ArticleListResponse' : T extends typeof Mode.IMAGE_COLLAGE | typeof Mode.IMAGE_COLLAGE_INFO | typeof Mode.IMAGE_GALLERY | typeof Mode.IMAGE_COLLAGE_SHARE ? 'ImageResponse' : T extends typeof Mode.TIMELINE_VOLUME | typeof Mode.TIMELINE_VOLUME_RAW | typeof Mode.TIMELINE_VOLUME_INFO | typeof Mode.TIMELINE_TONE ? 'TimelineResponse' : T extends typeof Mode.TIMELINE_LANGUAGE | typeof Mode.TIMELINE_SOURCE_COUNTRY ? 'TimelineBreakdownResponse' : T extends typeof Mode.TONE_CHART ? 'ToneChartResponse' : T extends typeof Mode.WORD_CLOUD_IMAGE_TAGS | typeof Mode.WORD_CLOUD_IMAGE_WEB_TAGS ? 'WordCloudResponse' : 'UnknownResponse';
185
+ /**
186
+ * Utility type for creating type-safe method overloads
187
+ */
188
+ export interface MethodOverload<TParams, TReturn> {
189
+ (params: TParams): Promise<TReturn>;
190
+ (query: string): Promise<TReturn>;
191
+ (query: string, options: Partial<TParams>): Promise<TReturn>;
192
+ }
193
+ /**
194
+ * Branded type for validated queries
195
+ */
196
+ export type ValidatedQuery = string & {
197
+ readonly __brand: 'ValidatedQuery';
198
+ };
199
+ /**
200
+ * Branded type for validated timespan
201
+ */
202
+ export type ValidatedTimespan = string & {
203
+ readonly __brand: 'ValidatedTimespan';
204
+ };
205
+ /**
206
+ * Branded type for validated datetime
207
+ */
208
+ export type ValidatedDateTime = string & {
209
+ readonly __brand: 'ValidatedDateTime';
210
+ };
211
+ /**
212
+ * Type predicate for validating timespan format
213
+ */
214
+ export declare function isValidTimespan(value: string): value is TimespanString;
215
+ /**
216
+ * Type predicate for validating datetime format
217
+ */
218
+ export declare function isValidDateTime(value: string): value is DateTimeString;
219
+ /**
220
+ * Type predicate for validating maxrecords range
221
+ */
222
+ export declare function isValidMaxRecords(value: number): value is number;
223
+ /**
224
+ * Type predicate for validating timelinesmooth range
225
+ */
226
+ export declare function isValidTimelineSmooth(value: number): value is number;
227
+ //# sourceMappingURL=enhanced-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enhanced-types.d.ts","sourceRoot":"","sources":["../../src/types/enhanced-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;CAgBP,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,OAAO,IAAI,CAAC,MAAM,OAAO,IAAI,CAAC,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;CAQT,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO,MAAM,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;CAMf,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,OAAO,YAAY,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,SAAS,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAIrE;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,GAAG,MAAM,KAAK,GACd,GAAG,MAAM,GAAG,GACZ,GAAG,MAAM,GAAG,GACZ,GAAG,MAAM,GAAG,GACZ,GAAG,MAAM,GAAG,CAAC;AAEjB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAE9J;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,QAAQ,MAAM,EAAE,GAChB,QAAQ,MAAM,EAAE,GAChB,QAAQ,MAAM,EAA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ACtD,CAAC,SAAS,OAAO,IAAI,CAAC,qBAAqB,GAAG,OAAO,IAAI,CAAC,yBAAyB,GAAG,mBAAmB,GACzG,iBAAiB,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,OAAO,EAAE,OAAO;IAC9C,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9D;AAID;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAEnF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAInF;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEtE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,cAAc,CAEtE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,MAAM,CAEhE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,MAAM,CAEpE"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ /**
3
+ * Enhanced types for better developer experience and type safety
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SortOrder = exports.TimespanUnit = exports.Format = exports.Mode = void 0;
7
+ exports.isValidTimespan = isValidTimespan;
8
+ exports.isValidDateTime = isValidDateTime;
9
+ exports.isValidMaxRecords = isValidMaxRecords;
10
+ exports.isValidTimelineSmooth = isValidTimelineSmooth;
11
+ /* eslint-disable @typescript-eslint/naming-convention */
12
+ /**
13
+ * Mode constants using const assertions for better IntelliSense and extensibility
14
+ */
15
+ exports.Mode = {
16
+ ARTICLE_LIST: 'artlist',
17
+ ARTICLE_GALLERY: 'artgallery',
18
+ IMAGE_COLLAGE: 'imagecollage',
19
+ IMAGE_COLLAGE_INFO: 'imagecollageinfo',
20
+ IMAGE_GALLERY: 'imagegallery',
21
+ IMAGE_COLLAGE_SHARE: 'imagecollagesshare',
22
+ TIMELINE_VOLUME: 'timelinevol',
23
+ TIMELINE_VOLUME_RAW: 'timelinevolraw',
24
+ TIMELINE_VOLUME_INFO: 'timelinevolinfo',
25
+ TIMELINE_TONE: 'timelinetone',
26
+ TIMELINE_LANGUAGE: 'timelinelang',
27
+ TIMELINE_SOURCE_COUNTRY: 'timelinesourcecountry',
28
+ TONE_CHART: 'tonechart',
29
+ WORD_CLOUD_IMAGE_TAGS: 'wordcloudimagetags',
30
+ WORD_CLOUD_IMAGE_WEB_TAGS: 'wordcloudimagewebtags'
31
+ };
32
+ /**
33
+ * Format constants using const assertions
34
+ */
35
+ exports.Format = {
36
+ HTML: 'html',
37
+ CSV: 'csv',
38
+ RSS: 'rss',
39
+ RSS_ARCHIVE: 'rssarchive',
40
+ JSON: 'json',
41
+ JSONP: 'jsonp',
42
+ JSON_FEED: 'jsonfeed'
43
+ };
44
+ /**
45
+ * Timespan unit constants using const assertions
46
+ */
47
+ exports.TimespanUnit = {
48
+ MINUTES: 'min',
49
+ HOURS: 'h',
50
+ DAYS: 'd',
51
+ WEEKS: 'w',
52
+ MONTHS: 'm'
53
+ };
54
+ /**
55
+ * Sort option constants using const assertions
56
+ */
57
+ exports.SortOrder = {
58
+ DATE_DESC: 'datedesc',
59
+ DATE_ASC: 'dateasc',
60
+ TONE_DESC: 'tonedesc',
61
+ TONE_ASC: 'toneasc',
62
+ HYBRID_RELEVANCE: 'hybridrel'
63
+ };
64
+ // ===== TYPE PREDICATES AND GUARDS =====
65
+ /**
66
+ * Type predicate for validating timespan format
67
+ */
68
+ function isValidTimespan(value) {
69
+ return /^\d+(min|h|d|w|m)$/.test(value);
70
+ }
71
+ /**
72
+ * Type predicate for validating datetime format
73
+ */
74
+ function isValidDateTime(value) {
75
+ return /^\d{14}$/.test(value);
76
+ }
77
+ /**
78
+ * Type predicate for validating maxrecords range
79
+ */
80
+ function isValidMaxRecords(value) {
81
+ return Number.isInteger(value) && value >= 1 && value <= 250;
82
+ }
83
+ /**
84
+ * Type predicate for validating timelinesmooth range
85
+ */
86
+ function isValidTimelineSmooth(value) {
87
+ return Number.isInteger(value) && value >= 1 && value <= 30;
88
+ }
89
+ //# sourceMappingURL=enhanced-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enhanced-types.js","sourceRoot":"","sources":["../../src/types/enhanced-types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAwTH,0CAEC;AAKD,0CAEC;AAKD,8CAEC;AAKD,sDAEC;AA7UD,yDAAyD;AAEzD;;GAEG;AACU,QAAA,IAAI,GAAG;IAClB,YAAY,EAAE,SAAS;IACvB,eAAe,EAAE,YAAY;IAC7B,aAAa,EAAE,cAAc;IAC7B,kBAAkB,EAAE,kBAAkB;IACtC,aAAa,EAAE,cAAc;IAC7B,mBAAmB,EAAE,oBAAoB;IACzC,eAAe,EAAE,aAAa;IAC9B,mBAAmB,EAAE,gBAAgB;IACrC,oBAAoB,EAAE,iBAAiB;IACvC,aAAa,EAAE,cAAc;IAC7B,iBAAiB,EAAE,cAAc;IACjC,uBAAuB,EAAE,uBAAuB;IAChD,UAAU,EAAE,WAAW;IACvB,qBAAqB,EAAE,oBAAoB;IAC3C,yBAAyB,EAAE,uBAAuB;CAC1C,CAAC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