gscdump 1.0.2 → 1.0.3

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.
@@ -1,1812 +1,5 @@
1
- function ok(value) {
2
- return {
3
- ok: true,
4
- value
5
- };
6
- }
7
- function err(error) {
8
- return {
9
- ok: false,
10
- error
11
- };
12
- }
13
- function unwrapResult(result, toError) {
14
- if (result.ok) return result.value;
15
- throw toError(result.error);
16
- }
17
- const TIME_AXIS_DIMENSIONS$1 = /* @__PURE__ */ new Set(["date", "hour"]);
18
- const queryErrors = {
19
- missingDateRange() {
20
- return {
21
- kind: "missing-date-range",
22
- message: "Date range required: use .where(between(date, start, end)) or .where(and(gte(date, start), lte(date, end)))"
23
- };
24
- },
25
- invalidRowLimit(value) {
26
- return {
27
- kind: "invalid-row-limit",
28
- value,
29
- message: `rowLimit must be a positive integer, got ${value}`
30
- };
31
- },
32
- invalidStartRow(value) {
33
- return {
34
- kind: "invalid-start-row",
35
- value,
36
- message: `startRow must be a non-negative integer, got ${value}`
37
- };
38
- },
39
- hourDimensionRequiresHourlyState() {
40
- return {
41
- kind: "invalid-data-state",
42
- message: "hour dimension requires dataState: \"hourly_all\""
43
- };
44
- },
45
- hourlyStateRequiresHourDimension() {
46
- return {
47
- kind: "invalid-data-state",
48
- message: "dataState: \"hourly_all\" requires grouping by hour dimension"
49
- };
50
- },
51
- byPropertyUnsupportedSearchType() {
52
- return {
53
- kind: "invalid-aggregation-type",
54
- message: "aggregationType: \"byProperty\" is not supported for type \"discover\" or \"googleNews\""
55
- };
56
- },
57
- byPropertyNotAllowedWithPage() {
58
- return {
59
- kind: "invalid-aggregation-type",
60
- message: "aggregationType: \"byProperty\" is not allowed when grouping or filtering by page"
61
- };
62
- },
63
- byNewsShowcaseRequiresSearchType() {
64
- return {
65
- kind: "invalid-aggregation-type",
66
- message: "aggregationType: \"byNewsShowcasePanel\" requires type \"discover\" or \"googleNews\""
67
- };
68
- },
69
- byNewsShowcaseNotAllowedWithPage() {
70
- return {
71
- kind: "invalid-aggregation-type",
72
- message: "aggregationType: \"byNewsShowcasePanel\" is not allowed when grouping or filtering by page"
73
- };
74
- },
75
- byNewsShowcaseRequiresShowcaseFilter() {
76
- return {
77
- kind: "invalid-aggregation-type",
78
- message: "aggregationType: \"byNewsShowcasePanel\" requires a searchAppearance equals \"NEWS_SHOWCASE\" filter and no other searchAppearance filter"
79
- };
80
- },
81
- invalidBuilderState(cause) {
82
- return {
83
- kind: "invalid-builder-state",
84
- cause,
85
- message: "Invalid state"
86
- };
87
- },
88
- malformedFilterLeaf() {
89
- return {
90
- kind: "invalid-filter",
91
- message: "Malformed filter: each filter leaf requires a string `dimension` and `operator`"
92
- };
93
- },
94
- unsupportedCapability(capability, context) {
95
- return {
96
- kind: "unsupported-capability",
97
- capability,
98
- context,
99
- message: `${context} requires ${capability} capability`
100
- };
101
- },
102
- unresolvableDataset(dimensions, filterDims = []) {
103
- const grouped = dimensions.filter((d) => !TIME_AXIS_DIMENSIONS$1.has(d));
104
- const filtered = filterDims.filter((d) => !TIME_AXIS_DIMENSIONS$1.has(d));
105
- return {
106
- kind: "unresolvable-dataset",
107
- dimensions,
108
- filterDims,
109
- message: `Cannot resolve a [${grouped.join(", ")}] breakdown filtered by [${filtered.join(", ")}] from stored data: these dimensions live in separate per-dimension tables. Only the live GSC API computes cross-dimension aggregates.`
110
- };
111
- }
112
- };
113
- var UnsupportedLogicalCapabilityError = class extends Error {
114
- queryError;
115
- constructor(capability, context) {
116
- const error = queryErrors.unsupportedCapability(capability, context);
117
- super(error.message);
118
- this.name = "UnsupportedLogicalCapabilityError";
119
- this.queryError = error;
120
- }
121
- };
122
- var UnresolvableDatasetError = class extends Error {
123
- queryError;
124
- constructor(dimensions, filterDims = []) {
125
- const error = queryErrors.unresolvableDataset(dimensions, filterDims);
126
- super(error.message);
127
- this.name = "UnresolvableDatasetError";
128
- this.queryError = error;
129
- }
130
- };
131
- function queryErrorToException(error) {
132
- switch (error.kind) {
133
- case "unsupported-capability": return new UnsupportedLogicalCapabilityError(error.capability, error.context);
134
- case "unresolvable-dataset": return new UnresolvableDatasetError(error.dimensions, error.filterDims);
135
- default: {
136
- const exception = new Error(error.message);
137
- if ("cause" in error && error.cause !== void 0) exception.cause = error.cause;
138
- exception.queryError = error;
139
- return exception;
140
- }
141
- }
142
- }
143
- const DATE_OPERATORS = [
144
- "gte",
145
- "gt",
146
- "lte",
147
- "lt",
148
- "between"
149
- ];
150
- const METRIC_OPERATORS = [
151
- "metricGte",
152
- "metricGt",
153
- "metricLte",
154
- "metricLt",
155
- "metricBetween"
156
- ];
157
- const SPECIAL_OPERATORS = ["topLevel"];
158
- const QUERY_PARAMS = ["searchType"];
159
- const FILTER_METRICS = [
160
- "clicks",
161
- "impressions",
162
- "ctr",
163
- "position"
164
- ];
165
- function isDateOperator(op) {
166
- return DATE_OPERATORS.includes(op);
167
- }
168
- function isMetricOperator(op) {
169
- return METRIC_OPERATORS.includes(op);
170
- }
171
- function isSpecialOperator(op) {
172
- return SPECIAL_OPERATORS.includes(op);
173
- }
174
- function isQueryParam(value) {
175
- return QUERY_PARAMS.includes(value);
176
- }
177
- function isMetric(value) {
178
- return FILTER_METRICS.includes(value);
179
- }
180
- function isRegexOperator(op) {
181
- return op === "includingRegex" || op === "excludingRegex";
182
- }
183
- const MS_PER_DAY = 864e5;
184
- function toIsoDate(d) {
185
- return d.toISOString().slice(0, 10);
186
- }
187
- function addDays(dateStr, n) {
188
- return toIsoDate(new Date(Date.parse(`${dateStr}T00:00:00Z`) + n * MS_PER_DAY));
189
- }
190
- var countries_default = [
191
- {
192
- "name": "Afghanistan",
193
- "alpha-2": "AF",
194
- "alpha-3": "AFG",
195
- "country-code": "004"
196
- },
197
- {
198
- "name": "Åland Islands",
199
- "alpha-2": "AX",
200
- "alpha-3": "ALA",
201
- "country-code": "248"
202
- },
203
- {
204
- "name": "Albania",
205
- "alpha-2": "AL",
206
- "alpha-3": "ALB",
207
- "country-code": "008"
208
- },
209
- {
210
- "name": "Algeria",
211
- "alpha-2": "DZ",
212
- "alpha-3": "DZA",
213
- "country-code": "012"
214
- },
215
- {
216
- "name": "American Samoa",
217
- "alpha-2": "AS",
218
- "alpha-3": "ASM",
219
- "country-code": "016"
220
- },
221
- {
222
- "name": "Andorra",
223
- "alpha-2": "AD",
224
- "alpha-3": "AND",
225
- "country-code": "020"
226
- },
227
- {
228
- "name": "Angola",
229
- "alpha-2": "AO",
230
- "alpha-3": "AGO",
231
- "country-code": "024"
232
- },
233
- {
234
- "name": "Anguilla",
235
- "alpha-2": "AI",
236
- "alpha-3": "AIA",
237
- "country-code": "660"
238
- },
239
- {
240
- "name": "Antarctica",
241
- "alpha-2": "AQ",
242
- "alpha-3": "ATA",
243
- "country-code": "010"
244
- },
245
- {
246
- "name": "Antigua and Barbuda",
247
- "alpha-2": "AG",
248
- "alpha-3": "ATG",
249
- "country-code": "028"
250
- },
251
- {
252
- "name": "Argentina",
253
- "alpha-2": "AR",
254
- "alpha-3": "ARG",
255
- "country-code": "032"
256
- },
257
- {
258
- "name": "Armenia",
259
- "alpha-2": "AM",
260
- "alpha-3": "ARM",
261
- "country-code": "051"
262
- },
263
- {
264
- "name": "Aruba",
265
- "alpha-2": "AW",
266
- "alpha-3": "ABW",
267
- "country-code": "533"
268
- },
269
- {
270
- "name": "Australia",
271
- "alpha-2": "AU",
272
- "alpha-3": "AUS",
273
- "country-code": "036"
274
- },
275
- {
276
- "name": "Austria",
277
- "alpha-2": "AT",
278
- "alpha-3": "AUT",
279
- "country-code": "040"
280
- },
281
- {
282
- "name": "Azerbaijan",
283
- "alpha-2": "AZ",
284
- "alpha-3": "AZE",
285
- "country-code": "031"
286
- },
287
- {
288
- "name": "Bahamas",
289
- "alpha-2": "BS",
290
- "alpha-3": "BHS",
291
- "country-code": "044"
292
- },
293
- {
294
- "name": "Bahrain",
295
- "alpha-2": "BH",
296
- "alpha-3": "BHR",
297
- "country-code": "048"
298
- },
299
- {
300
- "name": "Bangladesh",
301
- "alpha-2": "BD",
302
- "alpha-3": "BGD",
303
- "country-code": "050"
304
- },
305
- {
306
- "name": "Barbados",
307
- "alpha-2": "BB",
308
- "alpha-3": "BRB",
309
- "country-code": "052"
310
- },
311
- {
312
- "name": "Belarus",
313
- "alpha-2": "BY",
314
- "alpha-3": "BLR",
315
- "country-code": "112"
316
- },
317
- {
318
- "name": "Belgium",
319
- "alpha-2": "BE",
320
- "alpha-3": "BEL",
321
- "country-code": "056"
322
- },
323
- {
324
- "name": "Belize",
325
- "alpha-2": "BZ",
326
- "alpha-3": "BLZ",
327
- "country-code": "084"
328
- },
329
- {
330
- "name": "Benin",
331
- "alpha-2": "BJ",
332
- "alpha-3": "BEN",
333
- "country-code": "204"
334
- },
335
- {
336
- "name": "Bermuda",
337
- "alpha-2": "BM",
338
- "alpha-3": "BMU",
339
- "country-code": "060"
340
- },
341
- {
342
- "name": "Bhutan",
343
- "alpha-2": "BT",
344
- "alpha-3": "BTN",
345
- "country-code": "064"
346
- },
347
- {
348
- "name": "Bolivia (Plurinational State of)",
349
- "alpha-2": "BO",
350
- "alpha-3": "BOL",
351
- "country-code": "068"
352
- },
353
- {
354
- "name": "Bonaire, Sint Eustatius and Saba",
355
- "alpha-2": "BQ",
356
- "alpha-3": "BES",
357
- "country-code": "535"
358
- },
359
- {
360
- "name": "Bosnia and Herzegovina",
361
- "alpha-2": "BA",
362
- "alpha-3": "BIH",
363
- "country-code": "070"
364
- },
365
- {
366
- "name": "Botswana",
367
- "alpha-2": "BW",
368
- "alpha-3": "BWA",
369
- "country-code": "072"
370
- },
371
- {
372
- "name": "Bouvet Island",
373
- "alpha-2": "BV",
374
- "alpha-3": "BVT",
375
- "country-code": "074"
376
- },
377
- {
378
- "name": "Brazil",
379
- "alpha-2": "BR",
380
- "alpha-3": "BRA",
381
- "country-code": "076"
382
- },
383
- {
384
- "name": "British Indian Ocean Territory",
385
- "alpha-2": "IO",
386
- "alpha-3": "IOT",
387
- "country-code": "086"
388
- },
389
- {
390
- "name": "Brunei Darussalam",
391
- "alpha-2": "BN",
392
- "alpha-3": "BRN",
393
- "country-code": "096"
394
- },
395
- {
396
- "name": "Bulgaria",
397
- "alpha-2": "BG",
398
- "alpha-3": "BGR",
399
- "country-code": "100"
400
- },
401
- {
402
- "name": "Burkina Faso",
403
- "alpha-2": "BF",
404
- "alpha-3": "BFA",
405
- "country-code": "854"
406
- },
407
- {
408
- "name": "Burundi",
409
- "alpha-2": "BI",
410
- "alpha-3": "BDI",
411
- "country-code": "108"
412
- },
413
- {
414
- "name": "Cabo Verde",
415
- "alpha-2": "CV",
416
- "alpha-3": "CPV",
417
- "country-code": "132"
418
- },
419
- {
420
- "name": "Cambodia",
421
- "alpha-2": "KH",
422
- "alpha-3": "KHM",
423
- "country-code": "116"
424
- },
425
- {
426
- "name": "Cameroon",
427
- "alpha-2": "CM",
428
- "alpha-3": "CMR",
429
- "country-code": "120"
430
- },
431
- {
432
- "name": "Canada",
433
- "alpha-2": "CA",
434
- "alpha-3": "CAN",
435
- "country-code": "124"
436
- },
437
- {
438
- "name": "Cayman Islands",
439
- "alpha-2": "KY",
440
- "alpha-3": "CYM",
441
- "country-code": "136"
442
- },
443
- {
444
- "name": "Central African Republic",
445
- "alpha-2": "CF",
446
- "alpha-3": "CAF",
447
- "country-code": "140"
448
- },
449
- {
450
- "name": "Chad",
451
- "alpha-2": "TD",
452
- "alpha-3": "TCD",
453
- "country-code": "148"
454
- },
455
- {
456
- "name": "Chile",
457
- "alpha-2": "CL",
458
- "alpha-3": "CHL",
459
- "country-code": "152"
460
- },
461
- {
462
- "name": "China",
463
- "alpha-2": "CN",
464
- "alpha-3": "CHN",
465
- "country-code": "156"
466
- },
467
- {
468
- "name": "Christmas Island",
469
- "alpha-2": "CX",
470
- "alpha-3": "CXR",
471
- "country-code": "162"
472
- },
473
- {
474
- "name": "Cocos (Keeling) Islands",
475
- "alpha-2": "CC",
476
- "alpha-3": "CCK",
477
- "country-code": "166"
478
- },
479
- {
480
- "name": "Colombia",
481
- "alpha-2": "CO",
482
- "alpha-3": "COL",
483
- "country-code": "170"
484
- },
485
- {
486
- "name": "Comoros",
487
- "alpha-2": "KM",
488
- "alpha-3": "COM",
489
- "country-code": "174"
490
- },
491
- {
492
- "name": "Congo",
493
- "alpha-2": "CG",
494
- "alpha-3": "COG",
495
- "country-code": "178"
496
- },
497
- {
498
- "name": "Congo, Democratic Republic of the",
499
- "alpha-2": "CD",
500
- "alpha-3": "COD",
501
- "country-code": "180"
502
- },
503
- {
504
- "name": "Cook Islands",
505
- "alpha-2": "CK",
506
- "alpha-3": "COK",
507
- "country-code": "184"
508
- },
509
- {
510
- "name": "Costa Rica",
511
- "alpha-2": "CR",
512
- "alpha-3": "CRI",
513
- "country-code": "188"
514
- },
515
- {
516
- "name": "Côte d'Ivoire",
517
- "alpha-2": "CI",
518
- "alpha-3": "CIV",
519
- "country-code": "384"
520
- },
521
- {
522
- "name": "Croatia",
523
- "alpha-2": "HR",
524
- "alpha-3": "HRV",
525
- "country-code": "191"
526
- },
527
- {
528
- "name": "Cuba",
529
- "alpha-2": "CU",
530
- "alpha-3": "CUB",
531
- "country-code": "192"
532
- },
533
- {
534
- "name": "Curaçao",
535
- "alpha-2": "CW",
536
- "alpha-3": "CUW",
537
- "country-code": "531"
538
- },
539
- {
540
- "name": "Cyprus",
541
- "alpha-2": "CY",
542
- "alpha-3": "CYP",
543
- "country-code": "196"
544
- },
545
- {
546
- "name": "Czechia",
547
- "alpha-2": "CZ",
548
- "alpha-3": "CZE",
549
- "country-code": "203"
550
- },
551
- {
552
- "name": "Denmark",
553
- "alpha-2": "DK",
554
- "alpha-3": "DNK",
555
- "country-code": "208"
556
- },
557
- {
558
- "name": "Djibouti",
559
- "alpha-2": "DJ",
560
- "alpha-3": "DJI",
561
- "country-code": "262"
562
- },
563
- {
564
- "name": "Dominica",
565
- "alpha-2": "DM",
566
- "alpha-3": "DMA",
567
- "country-code": "212"
568
- },
569
- {
570
- "name": "Dominican Republic",
571
- "alpha-2": "DO",
572
- "alpha-3": "DOM",
573
- "country-code": "214"
574
- },
575
- {
576
- "name": "Ecuador",
577
- "alpha-2": "EC",
578
- "alpha-3": "ECU",
579
- "country-code": "218"
580
- },
581
- {
582
- "name": "Egypt",
583
- "alpha-2": "EG",
584
- "alpha-3": "EGY",
585
- "country-code": "818"
586
- },
587
- {
588
- "name": "El Salvador",
589
- "alpha-2": "SV",
590
- "alpha-3": "SLV",
591
- "country-code": "222"
592
- },
593
- {
594
- "name": "Equatorial Guinea",
595
- "alpha-2": "GQ",
596
- "alpha-3": "GNQ",
597
- "country-code": "226"
598
- },
599
- {
600
- "name": "Eritrea",
601
- "alpha-2": "ER",
602
- "alpha-3": "ERI",
603
- "country-code": "232"
604
- },
605
- {
606
- "name": "Estonia",
607
- "alpha-2": "EE",
608
- "alpha-3": "EST",
609
- "country-code": "233"
610
- },
611
- {
612
- "name": "Eswatini",
613
- "alpha-2": "SZ",
614
- "alpha-3": "SWZ",
615
- "country-code": "748"
616
- },
617
- {
618
- "name": "Ethiopia",
619
- "alpha-2": "ET",
620
- "alpha-3": "ETH",
621
- "country-code": "231"
622
- },
623
- {
624
- "name": "Falkland Islands (Malvinas)",
625
- "alpha-2": "FK",
626
- "alpha-3": "FLK",
627
- "country-code": "238"
628
- },
629
- {
630
- "name": "Faroe Islands",
631
- "alpha-2": "FO",
632
- "alpha-3": "FRO",
633
- "country-code": "234"
634
- },
635
- {
636
- "name": "Fiji",
637
- "alpha-2": "FJ",
638
- "alpha-3": "FJI",
639
- "country-code": "242"
640
- },
641
- {
642
- "name": "Finland",
643
- "alpha-2": "FI",
644
- "alpha-3": "FIN",
645
- "country-code": "246"
646
- },
647
- {
648
- "name": "France",
649
- "alpha-2": "FR",
650
- "alpha-3": "FRA",
651
- "country-code": "250"
652
- },
653
- {
654
- "name": "French Guiana",
655
- "alpha-2": "GF",
656
- "alpha-3": "GUF",
657
- "country-code": "254"
658
- },
659
- {
660
- "name": "French Polynesia",
661
- "alpha-2": "PF",
662
- "alpha-3": "PYF",
663
- "country-code": "258"
664
- },
665
- {
666
- "name": "French Southern Territories",
667
- "alpha-2": "TF",
668
- "alpha-3": "ATF",
669
- "country-code": "260"
670
- },
671
- {
672
- "name": "Gabon",
673
- "alpha-2": "GA",
674
- "alpha-3": "GAB",
675
- "country-code": "266"
676
- },
677
- {
678
- "name": "Gambia",
679
- "alpha-2": "GM",
680
- "alpha-3": "GMB",
681
- "country-code": "270"
682
- },
683
- {
684
- "name": "Georgia",
685
- "alpha-2": "GE",
686
- "alpha-3": "GEO",
687
- "country-code": "268"
688
- },
689
- {
690
- "name": "Germany",
691
- "alpha-2": "DE",
692
- "alpha-3": "DEU",
693
- "country-code": "276"
694
- },
695
- {
696
- "name": "Ghana",
697
- "alpha-2": "GH",
698
- "alpha-3": "GHA",
699
- "country-code": "288"
700
- },
701
- {
702
- "name": "Gibraltar",
703
- "alpha-2": "GI",
704
- "alpha-3": "GIB",
705
- "country-code": "292"
706
- },
707
- {
708
- "name": "Greece",
709
- "alpha-2": "GR",
710
- "alpha-3": "GRC",
711
- "country-code": "300"
712
- },
713
- {
714
- "name": "Greenland",
715
- "alpha-2": "GL",
716
- "alpha-3": "GRL",
717
- "country-code": "304"
718
- },
719
- {
720
- "name": "Grenada",
721
- "alpha-2": "GD",
722
- "alpha-3": "GRD",
723
- "country-code": "308"
724
- },
725
- {
726
- "name": "Guadeloupe",
727
- "alpha-2": "GP",
728
- "alpha-3": "GLP",
729
- "country-code": "312"
730
- },
731
- {
732
- "name": "Guam",
733
- "alpha-2": "GU",
734
- "alpha-3": "GUM",
735
- "country-code": "316"
736
- },
737
- {
738
- "name": "Guatemala",
739
- "alpha-2": "GT",
740
- "alpha-3": "GTM",
741
- "country-code": "320"
742
- },
743
- {
744
- "name": "Guernsey",
745
- "alpha-2": "GG",
746
- "alpha-3": "GGY",
747
- "country-code": "831"
748
- },
749
- {
750
- "name": "Guinea",
751
- "alpha-2": "GN",
752
- "alpha-3": "GIN",
753
- "country-code": "324"
754
- },
755
- {
756
- "name": "Guinea-Bissau",
757
- "alpha-2": "GW",
758
- "alpha-3": "GNB",
759
- "country-code": "624"
760
- },
761
- {
762
- "name": "Guyana",
763
- "alpha-2": "GY",
764
- "alpha-3": "GUY",
765
- "country-code": "328"
766
- },
767
- {
768
- "name": "Haiti",
769
- "alpha-2": "HT",
770
- "alpha-3": "HTI",
771
- "country-code": "332"
772
- },
773
- {
774
- "name": "Heard Island and McDonald Islands",
775
- "alpha-2": "HM",
776
- "alpha-3": "HMD",
777
- "country-code": "334"
778
- },
779
- {
780
- "name": "Holy See",
781
- "alpha-2": "VA",
782
- "alpha-3": "VAT",
783
- "country-code": "336"
784
- },
785
- {
786
- "name": "Honduras",
787
- "alpha-2": "HN",
788
- "alpha-3": "HND",
789
- "country-code": "340"
790
- },
791
- {
792
- "name": "Hong Kong",
793
- "alpha-2": "HK",
794
- "alpha-3": "HKG",
795
- "country-code": "344"
796
- },
797
- {
798
- "name": "Hungary",
799
- "alpha-2": "HU",
800
- "alpha-3": "HUN",
801
- "country-code": "348"
802
- },
803
- {
804
- "name": "Iceland",
805
- "alpha-2": "IS",
806
- "alpha-3": "ISL",
807
- "country-code": "352"
808
- },
809
- {
810
- "name": "India",
811
- "alpha-2": "IN",
812
- "alpha-3": "IND",
813
- "country-code": "356"
814
- },
815
- {
816
- "name": "Indonesia",
817
- "alpha-2": "ID",
818
- "alpha-3": "IDN",
819
- "country-code": "360"
820
- },
821
- {
822
- "name": "Iran (Islamic Republic of)",
823
- "alpha-2": "IR",
824
- "alpha-3": "IRN",
825
- "country-code": "364"
826
- },
827
- {
828
- "name": "Iraq",
829
- "alpha-2": "IQ",
830
- "alpha-3": "IRQ",
831
- "country-code": "368"
832
- },
833
- {
834
- "name": "Ireland",
835
- "alpha-2": "IE",
836
- "alpha-3": "IRL",
837
- "country-code": "372"
838
- },
839
- {
840
- "name": "Isle of Man",
841
- "alpha-2": "IM",
842
- "alpha-3": "IMN",
843
- "country-code": "833"
844
- },
845
- {
846
- "name": "Israel",
847
- "alpha-2": "IL",
848
- "alpha-3": "ISR",
849
- "country-code": "376"
850
- },
851
- {
852
- "name": "Italy",
853
- "alpha-2": "IT",
854
- "alpha-3": "ITA",
855
- "country-code": "380"
856
- },
857
- {
858
- "name": "Jamaica",
859
- "alpha-2": "JM",
860
- "alpha-3": "JAM",
861
- "country-code": "388"
862
- },
863
- {
864
- "name": "Japan",
865
- "alpha-2": "JP",
866
- "alpha-3": "JPN",
867
- "country-code": "392"
868
- },
869
- {
870
- "name": "Jersey",
871
- "alpha-2": "JE",
872
- "alpha-3": "JEY",
873
- "country-code": "832"
874
- },
875
- {
876
- "name": "Jordan",
877
- "alpha-2": "JO",
878
- "alpha-3": "JOR",
879
- "country-code": "400"
880
- },
881
- {
882
- "name": "Kazakhstan",
883
- "alpha-2": "KZ",
884
- "alpha-3": "KAZ",
885
- "country-code": "398"
886
- },
887
- {
888
- "name": "Kenya",
889
- "alpha-2": "KE",
890
- "alpha-3": "KEN",
891
- "country-code": "404"
892
- },
893
- {
894
- "name": "Kiribati",
895
- "alpha-2": "KI",
896
- "alpha-3": "KIR",
897
- "country-code": "296"
898
- },
899
- {
900
- "name": "Korea (Democratic People's Republic of)",
901
- "alpha-2": "KP",
902
- "alpha-3": "PRK",
903
- "country-code": "408"
904
- },
905
- {
906
- "name": "Korea, Republic of",
907
- "alpha-2": "KR",
908
- "alpha-3": "KOR",
909
- "country-code": "410"
910
- },
911
- {
912
- "name": "Kuwait",
913
- "alpha-2": "KW",
914
- "alpha-3": "KWT",
915
- "country-code": "414"
916
- },
917
- {
918
- "name": "Kyrgyzstan",
919
- "alpha-2": "KG",
920
- "alpha-3": "KGZ",
921
- "country-code": "417"
922
- },
923
- {
924
- "name": "Lao People's Democratic Republic",
925
- "alpha-2": "LA",
926
- "alpha-3": "LAO",
927
- "country-code": "418"
928
- },
929
- {
930
- "name": "Latvia",
931
- "alpha-2": "LV",
932
- "alpha-3": "LVA",
933
- "country-code": "428"
934
- },
935
- {
936
- "name": "Lebanon",
937
- "alpha-2": "LB",
938
- "alpha-3": "LBN",
939
- "country-code": "422"
940
- },
941
- {
942
- "name": "Lesotho",
943
- "alpha-2": "LS",
944
- "alpha-3": "LSO",
945
- "country-code": "426"
946
- },
947
- {
948
- "name": "Liberia",
949
- "alpha-2": "LR",
950
- "alpha-3": "LBR",
951
- "country-code": "430"
952
- },
953
- {
954
- "name": "Libya",
955
- "alpha-2": "LY",
956
- "alpha-3": "LBY",
957
- "country-code": "434"
958
- },
959
- {
960
- "name": "Liechtenstein",
961
- "alpha-2": "LI",
962
- "alpha-3": "LIE",
963
- "country-code": "438"
964
- },
965
- {
966
- "name": "Lithuania",
967
- "alpha-2": "LT",
968
- "alpha-3": "LTU",
969
- "country-code": "440"
970
- },
971
- {
972
- "name": "Luxembourg",
973
- "alpha-2": "LU",
974
- "alpha-3": "LUX",
975
- "country-code": "442"
976
- },
977
- {
978
- "name": "Macao",
979
- "alpha-2": "MO",
980
- "alpha-3": "MAC",
981
- "country-code": "446"
982
- },
983
- {
984
- "name": "Madagascar",
985
- "alpha-2": "MG",
986
- "alpha-3": "MDG",
987
- "country-code": "450"
988
- },
989
- {
990
- "name": "Malawi",
991
- "alpha-2": "MW",
992
- "alpha-3": "MWI",
993
- "country-code": "454"
994
- },
995
- {
996
- "name": "Malaysia",
997
- "alpha-2": "MY",
998
- "alpha-3": "MYS",
999
- "country-code": "458"
1000
- },
1001
- {
1002
- "name": "Maldives",
1003
- "alpha-2": "MV",
1004
- "alpha-3": "MDV",
1005
- "country-code": "462"
1006
- },
1007
- {
1008
- "name": "Mali",
1009
- "alpha-2": "ML",
1010
- "alpha-3": "MLI",
1011
- "country-code": "466"
1012
- },
1013
- {
1014
- "name": "Malta",
1015
- "alpha-2": "MT",
1016
- "alpha-3": "MLT",
1017
- "country-code": "470"
1018
- },
1019
- {
1020
- "name": "Marshall Islands",
1021
- "alpha-2": "MH",
1022
- "alpha-3": "MHL",
1023
- "country-code": "584"
1024
- },
1025
- {
1026
- "name": "Martinique",
1027
- "alpha-2": "MQ",
1028
- "alpha-3": "MTQ",
1029
- "country-code": "474"
1030
- },
1031
- {
1032
- "name": "Mauritania",
1033
- "alpha-2": "MR",
1034
- "alpha-3": "MRT",
1035
- "country-code": "478"
1036
- },
1037
- {
1038
- "name": "Mauritius",
1039
- "alpha-2": "MU",
1040
- "alpha-3": "MUS",
1041
- "country-code": "480"
1042
- },
1043
- {
1044
- "name": "Mayotte",
1045
- "alpha-2": "YT",
1046
- "alpha-3": "MYT",
1047
- "country-code": "175"
1048
- },
1049
- {
1050
- "name": "Mexico",
1051
- "alpha-2": "MX",
1052
- "alpha-3": "MEX",
1053
- "country-code": "484"
1054
- },
1055
- {
1056
- "name": "Micronesia (Federated States of)",
1057
- "alpha-2": "FM",
1058
- "alpha-3": "FSM",
1059
- "country-code": "583"
1060
- },
1061
- {
1062
- "name": "Moldova, Republic of",
1063
- "alpha-2": "MD",
1064
- "alpha-3": "MDA",
1065
- "country-code": "498"
1066
- },
1067
- {
1068
- "name": "Monaco",
1069
- "alpha-2": "MC",
1070
- "alpha-3": "MCO",
1071
- "country-code": "492"
1072
- },
1073
- {
1074
- "name": "Mongolia",
1075
- "alpha-2": "MN",
1076
- "alpha-3": "MNG",
1077
- "country-code": "496"
1078
- },
1079
- {
1080
- "name": "Montenegro",
1081
- "alpha-2": "ME",
1082
- "alpha-3": "MNE",
1083
- "country-code": "499"
1084
- },
1085
- {
1086
- "name": "Montserrat",
1087
- "alpha-2": "MS",
1088
- "alpha-3": "MSR",
1089
- "country-code": "500"
1090
- },
1091
- {
1092
- "name": "Morocco",
1093
- "alpha-2": "MA",
1094
- "alpha-3": "MAR",
1095
- "country-code": "504"
1096
- },
1097
- {
1098
- "name": "Mozambique",
1099
- "alpha-2": "MZ",
1100
- "alpha-3": "MOZ",
1101
- "country-code": "508"
1102
- },
1103
- {
1104
- "name": "Myanmar",
1105
- "alpha-2": "MM",
1106
- "alpha-3": "MMR",
1107
- "country-code": "104"
1108
- },
1109
- {
1110
- "name": "Namibia",
1111
- "alpha-2": "NA",
1112
- "alpha-3": "NAM",
1113
- "country-code": "516"
1114
- },
1115
- {
1116
- "name": "Nauru",
1117
- "alpha-2": "NR",
1118
- "alpha-3": "NRU",
1119
- "country-code": "520"
1120
- },
1121
- {
1122
- "name": "Nepal",
1123
- "alpha-2": "NP",
1124
- "alpha-3": "NPL",
1125
- "country-code": "524"
1126
- },
1127
- {
1128
- "name": "Netherlands",
1129
- "alpha-2": "NL",
1130
- "alpha-3": "NLD",
1131
- "country-code": "528"
1132
- },
1133
- {
1134
- "name": "New Caledonia",
1135
- "alpha-2": "NC",
1136
- "alpha-3": "NCL",
1137
- "country-code": "540"
1138
- },
1139
- {
1140
- "name": "New Zealand",
1141
- "alpha-2": "NZ",
1142
- "alpha-3": "NZL",
1143
- "country-code": "554"
1144
- },
1145
- {
1146
- "name": "Nicaragua",
1147
- "alpha-2": "NI",
1148
- "alpha-3": "NIC",
1149
- "country-code": "558"
1150
- },
1151
- {
1152
- "name": "Niger",
1153
- "alpha-2": "NE",
1154
- "alpha-3": "NER",
1155
- "country-code": "562"
1156
- },
1157
- {
1158
- "name": "Nigeria",
1159
- "alpha-2": "NG",
1160
- "alpha-3": "NGA",
1161
- "country-code": "566"
1162
- },
1163
- {
1164
- "name": "Niue",
1165
- "alpha-2": "NU",
1166
- "alpha-3": "NIU",
1167
- "country-code": "570"
1168
- },
1169
- {
1170
- "name": "Norfolk Island",
1171
- "alpha-2": "NF",
1172
- "alpha-3": "NFK",
1173
- "country-code": "574"
1174
- },
1175
- {
1176
- "name": "North Macedonia",
1177
- "alpha-2": "MK",
1178
- "alpha-3": "MKD",
1179
- "country-code": "807"
1180
- },
1181
- {
1182
- "name": "Northern Mariana Islands",
1183
- "alpha-2": "MP",
1184
- "alpha-3": "MNP",
1185
- "country-code": "580"
1186
- },
1187
- {
1188
- "name": "Norway",
1189
- "alpha-2": "NO",
1190
- "alpha-3": "NOR",
1191
- "country-code": "578"
1192
- },
1193
- {
1194
- "name": "Oman",
1195
- "alpha-2": "OM",
1196
- "alpha-3": "OMN",
1197
- "country-code": "512"
1198
- },
1199
- {
1200
- "name": "Pakistan",
1201
- "alpha-2": "PK",
1202
- "alpha-3": "PAK",
1203
- "country-code": "586"
1204
- },
1205
- {
1206
- "name": "Palau",
1207
- "alpha-2": "PW",
1208
- "alpha-3": "PLW",
1209
- "country-code": "585"
1210
- },
1211
- {
1212
- "name": "Palestine, State of",
1213
- "alpha-2": "PS",
1214
- "alpha-3": "PSE",
1215
- "country-code": "275"
1216
- },
1217
- {
1218
- "name": "Panama",
1219
- "alpha-2": "PA",
1220
- "alpha-3": "PAN",
1221
- "country-code": "591"
1222
- },
1223
- {
1224
- "name": "Papua New Guinea",
1225
- "alpha-2": "PG",
1226
- "alpha-3": "PNG",
1227
- "country-code": "598"
1228
- },
1229
- {
1230
- "name": "Paraguay",
1231
- "alpha-2": "PY",
1232
- "alpha-3": "PRY",
1233
- "country-code": "600"
1234
- },
1235
- {
1236
- "name": "Peru",
1237
- "alpha-2": "PE",
1238
- "alpha-3": "PER",
1239
- "country-code": "604"
1240
- },
1241
- {
1242
- "name": "Philippines",
1243
- "alpha-2": "PH",
1244
- "alpha-3": "PHL",
1245
- "country-code": "608"
1246
- },
1247
- {
1248
- "name": "Pitcairn",
1249
- "alpha-2": "PN",
1250
- "alpha-3": "PCN",
1251
- "country-code": "612"
1252
- },
1253
- {
1254
- "name": "Poland",
1255
- "alpha-2": "PL",
1256
- "alpha-3": "POL",
1257
- "country-code": "616"
1258
- },
1259
- {
1260
- "name": "Portugal",
1261
- "alpha-2": "PT",
1262
- "alpha-3": "PRT",
1263
- "country-code": "620"
1264
- },
1265
- {
1266
- "name": "Puerto Rico",
1267
- "alpha-2": "PR",
1268
- "alpha-3": "PRI",
1269
- "country-code": "630"
1270
- },
1271
- {
1272
- "name": "Qatar",
1273
- "alpha-2": "QA",
1274
- "alpha-3": "QAT",
1275
- "country-code": "634"
1276
- },
1277
- {
1278
- "name": "Réunion",
1279
- "alpha-2": "RE",
1280
- "alpha-3": "REU",
1281
- "country-code": "638"
1282
- },
1283
- {
1284
- "name": "Romania",
1285
- "alpha-2": "RO",
1286
- "alpha-3": "ROU",
1287
- "country-code": "642"
1288
- },
1289
- {
1290
- "name": "Russian Federation",
1291
- "alpha-2": "RU",
1292
- "alpha-3": "RUS",
1293
- "country-code": "643"
1294
- },
1295
- {
1296
- "name": "Rwanda",
1297
- "alpha-2": "RW",
1298
- "alpha-3": "RWA",
1299
- "country-code": "646"
1300
- },
1301
- {
1302
- "name": "Saint Barthélemy",
1303
- "alpha-2": "BL",
1304
- "alpha-3": "BLM",
1305
- "country-code": "652"
1306
- },
1307
- {
1308
- "name": "Saint Helena, Ascension and Tristan da Cunha",
1309
- "alpha-2": "SH",
1310
- "alpha-3": "SHN",
1311
- "country-code": "654"
1312
- },
1313
- {
1314
- "name": "Saint Kitts and Nevis",
1315
- "alpha-2": "KN",
1316
- "alpha-3": "KNA",
1317
- "country-code": "659"
1318
- },
1319
- {
1320
- "name": "Saint Lucia",
1321
- "alpha-2": "LC",
1322
- "alpha-3": "LCA",
1323
- "country-code": "662"
1324
- },
1325
- {
1326
- "name": "Saint Martin (French part)",
1327
- "alpha-2": "MF",
1328
- "alpha-3": "MAF",
1329
- "country-code": "663"
1330
- },
1331
- {
1332
- "name": "Saint Pierre and Miquelon",
1333
- "alpha-2": "PM",
1334
- "alpha-3": "SPM",
1335
- "country-code": "666"
1336
- },
1337
- {
1338
- "name": "Saint Vincent and the Grenadines",
1339
- "alpha-2": "VC",
1340
- "alpha-3": "VCT",
1341
- "country-code": "670"
1342
- },
1343
- {
1344
- "name": "Samoa",
1345
- "alpha-2": "WS",
1346
- "alpha-3": "WSM",
1347
- "country-code": "882"
1348
- },
1349
- {
1350
- "name": "San Marino",
1351
- "alpha-2": "SM",
1352
- "alpha-3": "SMR",
1353
- "country-code": "674"
1354
- },
1355
- {
1356
- "name": "Sao Tome and Principe",
1357
- "alpha-2": "ST",
1358
- "alpha-3": "STP",
1359
- "country-code": "678"
1360
- },
1361
- {
1362
- "name": "Saudi Arabia",
1363
- "alpha-2": "SA",
1364
- "alpha-3": "SAU",
1365
- "country-code": "682"
1366
- },
1367
- {
1368
- "name": "Senegal",
1369
- "alpha-2": "SN",
1370
- "alpha-3": "SEN",
1371
- "country-code": "686"
1372
- },
1373
- {
1374
- "name": "Serbia",
1375
- "alpha-2": "RS",
1376
- "alpha-3": "SRB",
1377
- "country-code": "688"
1378
- },
1379
- {
1380
- "name": "Seychelles",
1381
- "alpha-2": "SC",
1382
- "alpha-3": "SYC",
1383
- "country-code": "690"
1384
- },
1385
- {
1386
- "name": "Sierra Leone",
1387
- "alpha-2": "SL",
1388
- "alpha-3": "SLE",
1389
- "country-code": "694"
1390
- },
1391
- {
1392
- "name": "Singapore",
1393
- "alpha-2": "SG",
1394
- "alpha-3": "SGP",
1395
- "country-code": "702"
1396
- },
1397
- {
1398
- "name": "Sint Maarten (Dutch part)",
1399
- "alpha-2": "SX",
1400
- "alpha-3": "SXM",
1401
- "country-code": "534"
1402
- },
1403
- {
1404
- "name": "Slovakia",
1405
- "alpha-2": "SK",
1406
- "alpha-3": "SVK",
1407
- "country-code": "703"
1408
- },
1409
- {
1410
- "name": "Slovenia",
1411
- "alpha-2": "SI",
1412
- "alpha-3": "SVN",
1413
- "country-code": "705"
1414
- },
1415
- {
1416
- "name": "Solomon Islands",
1417
- "alpha-2": "SB",
1418
- "alpha-3": "SLB",
1419
- "country-code": "090"
1420
- },
1421
- {
1422
- "name": "Somalia",
1423
- "alpha-2": "SO",
1424
- "alpha-3": "SOM",
1425
- "country-code": "706"
1426
- },
1427
- {
1428
- "name": "South Africa",
1429
- "alpha-2": "ZA",
1430
- "alpha-3": "ZAF",
1431
- "country-code": "710"
1432
- },
1433
- {
1434
- "name": "South Georgia and the South Sandwich Islands",
1435
- "alpha-2": "GS",
1436
- "alpha-3": "SGS",
1437
- "country-code": "239"
1438
- },
1439
- {
1440
- "name": "South Sudan",
1441
- "alpha-2": "SS",
1442
- "alpha-3": "SSD",
1443
- "country-code": "728"
1444
- },
1445
- {
1446
- "name": "Spain",
1447
- "alpha-2": "ES",
1448
- "alpha-3": "ESP",
1449
- "country-code": "724"
1450
- },
1451
- {
1452
- "name": "Sri Lanka",
1453
- "alpha-2": "LK",
1454
- "alpha-3": "LKA",
1455
- "country-code": "144"
1456
- },
1457
- {
1458
- "name": "Sudan",
1459
- "alpha-2": "SD",
1460
- "alpha-3": "SDN",
1461
- "country-code": "729"
1462
- },
1463
- {
1464
- "name": "Suriname",
1465
- "alpha-2": "SR",
1466
- "alpha-3": "SUR",
1467
- "country-code": "740"
1468
- },
1469
- {
1470
- "name": "Svalbard and Jan Mayen",
1471
- "alpha-2": "SJ",
1472
- "alpha-3": "SJM",
1473
- "country-code": "744"
1474
- },
1475
- {
1476
- "name": "Sweden",
1477
- "alpha-2": "SE",
1478
- "alpha-3": "SWE",
1479
- "country-code": "752"
1480
- },
1481
- {
1482
- "name": "Switzerland",
1483
- "alpha-2": "CH",
1484
- "alpha-3": "CHE",
1485
- "country-code": "756"
1486
- },
1487
- {
1488
- "name": "Syrian Arab Republic",
1489
- "alpha-2": "SY",
1490
- "alpha-3": "SYR",
1491
- "country-code": "760"
1492
- },
1493
- {
1494
- "name": "Taiwan",
1495
- "alpha-2": "TW",
1496
- "alpha-3": "TWN",
1497
- "country-code": "158"
1498
- },
1499
- {
1500
- "name": "Tajikistan",
1501
- "alpha-2": "TJ",
1502
- "alpha-3": "TJK",
1503
- "country-code": "762"
1504
- },
1505
- {
1506
- "name": "Tanzania, United Republic of",
1507
- "alpha-2": "TZ",
1508
- "alpha-3": "TZA",
1509
- "country-code": "834"
1510
- },
1511
- {
1512
- "name": "Thailand",
1513
- "alpha-2": "TH",
1514
- "alpha-3": "THA",
1515
- "country-code": "764"
1516
- },
1517
- {
1518
- "name": "Timor-Leste",
1519
- "alpha-2": "TL",
1520
- "alpha-3": "TLS",
1521
- "country-code": "626"
1522
- },
1523
- {
1524
- "name": "Togo",
1525
- "alpha-2": "TG",
1526
- "alpha-3": "TGO",
1527
- "country-code": "768"
1528
- },
1529
- {
1530
- "name": "Tokelau",
1531
- "alpha-2": "TK",
1532
- "alpha-3": "TKL",
1533
- "country-code": "772"
1534
- },
1535
- {
1536
- "name": "Tonga",
1537
- "alpha-2": "TO",
1538
- "alpha-3": "TON",
1539
- "country-code": "776"
1540
- },
1541
- {
1542
- "name": "Trinidad and Tobago",
1543
- "alpha-2": "TT",
1544
- "alpha-3": "TTO",
1545
- "country-code": "780"
1546
- },
1547
- {
1548
- "name": "Tunisia",
1549
- "alpha-2": "TN",
1550
- "alpha-3": "TUN",
1551
- "country-code": "788"
1552
- },
1553
- {
1554
- "name": "Turkey",
1555
- "alpha-2": "TR",
1556
- "alpha-3": "TUR",
1557
- "country-code": "792"
1558
- },
1559
- {
1560
- "name": "Turkmenistan",
1561
- "alpha-2": "TM",
1562
- "alpha-3": "TKM",
1563
- "country-code": "795"
1564
- },
1565
- {
1566
- "name": "Turks and Caicos Islands",
1567
- "alpha-2": "TC",
1568
- "alpha-3": "TCA",
1569
- "country-code": "796"
1570
- },
1571
- {
1572
- "name": "Tuvalu",
1573
- "alpha-2": "TV",
1574
- "alpha-3": "TUV",
1575
- "country-code": "798"
1576
- },
1577
- {
1578
- "name": "Uganda",
1579
- "alpha-2": "UG",
1580
- "alpha-3": "UGA",
1581
- "country-code": "800"
1582
- },
1583
- {
1584
- "name": "Ukraine",
1585
- "alpha-2": "UA",
1586
- "alpha-3": "UKR",
1587
- "country-code": "804"
1588
- },
1589
- {
1590
- "name": "United Arab Emirates",
1591
- "alpha-2": "AE",
1592
- "alpha-3": "ARE",
1593
- "country-code": "784"
1594
- },
1595
- {
1596
- "name": "United Kingdom",
1597
- "alpha-2": "GB",
1598
- "alpha-3": "GBR",
1599
- "country-code": "826"
1600
- },
1601
- {
1602
- "name": "America",
1603
- "alpha-2": "US",
1604
- "alpha-3": "USA",
1605
- "country-code": "840"
1606
- },
1607
- {
1608
- "name": "United States Minor Outlying Islands",
1609
- "alpha-2": "UM",
1610
- "alpha-3": "UMI",
1611
- "country-code": "581"
1612
- },
1613
- {
1614
- "name": "Uruguay",
1615
- "alpha-2": "UY",
1616
- "alpha-3": "URY",
1617
- "country-code": "858"
1618
- },
1619
- {
1620
- "name": "Uzbekistan",
1621
- "alpha-2": "UZ",
1622
- "alpha-3": "UZB",
1623
- "country-code": "860"
1624
- },
1625
- {
1626
- "name": "Vanuatu",
1627
- "alpha-2": "VU",
1628
- "alpha-3": "VUT",
1629
- "country-code": "548"
1630
- },
1631
- {
1632
- "name": "Venezuela (Bolivarian Republic of)",
1633
- "alpha-2": "VE",
1634
- "alpha-3": "VEN",
1635
- "country-code": "862"
1636
- },
1637
- {
1638
- "name": "Vietnam",
1639
- "alpha-2": "VN",
1640
- "alpha-3": "VNM",
1641
- "country-code": "704"
1642
- },
1643
- {
1644
- "name": "Virgin Islands (British)",
1645
- "alpha-2": "VG",
1646
- "alpha-3": "VGB",
1647
- "country-code": "092"
1648
- },
1649
- {
1650
- "name": "Virgin Islands (U.S.)",
1651
- "alpha-2": "VI",
1652
- "alpha-3": "VIR",
1653
- "country-code": "850"
1654
- },
1655
- {
1656
- "name": "Wallis and Futuna",
1657
- "alpha-2": "WF",
1658
- "alpha-3": "WLF",
1659
- "country-code": "876"
1660
- },
1661
- {
1662
- "name": "Western Sahara",
1663
- "alpha-2": "EH",
1664
- "alpha-3": "ESH",
1665
- "country-code": "732"
1666
- },
1667
- {
1668
- "name": "Yemen",
1669
- "alpha-2": "YE",
1670
- "alpha-3": "YEM",
1671
- "country-code": "887"
1672
- },
1673
- {
1674
- "name": "Zambia",
1675
- "alpha-2": "ZM",
1676
- "alpha-3": "ZMB",
1677
- "country-code": "894"
1678
- },
1679
- {
1680
- "name": "Zimbabwe",
1681
- "alpha-2": "ZW",
1682
- "alpha-3": "ZWE",
1683
- "country-code": "716"
1684
- }
1685
- ];
1686
- const SearchTypes = {
1687
- WEB: "web",
1688
- IMAGE: "image",
1689
- VIDEO: "video",
1690
- NEWS: "news",
1691
- DISCOVER: "discover",
1692
- GOOGLE_NEWS: "googleNews"
1693
- };
1694
- Object.fromEntries(countries_default.map((c) => [c["alpha-3"], c["alpha-3"].toLowerCase()]));
1695
- new Set(Object.values(SearchTypes));
1696
- function isWireGroupType(type) {
1697
- return type === "and" || type === "or";
1698
- }
1699
- function convertWireLeaf(alt) {
1700
- if (!alt.column || !alt.type || isWireGroupType(alt.type)) return null;
1701
- const f = {
1702
- dimension: alt.column,
1703
- operator: alt.type,
1704
- expression: alt.type === "between" ? alt.from ?? "" : alt.value ?? ""
1705
- };
1706
- if (alt.type === "between" && alt.to) f.expression2 = alt.to;
1707
- return f;
1708
- }
1709
- function convertWireGroup(alt) {
1710
- if (!isWireGroupType(alt.type)) {
1711
- const leaf = convertWireLeaf(alt);
1712
- return leaf ? { _filters: [leaf] } : null;
1713
- }
1714
- const leaves = [];
1715
- const nested = [];
1716
- for (const child of alt.filters ?? []) if (isWireGroupType(child.type)) {
1717
- const sub = convertWireGroup(child);
1718
- if (sub) nested.push(sub);
1719
- } else {
1720
- const leaf = convertWireLeaf(child);
1721
- if (leaf) leaves.push(leaf);
1722
- }
1723
- if (leaves.length === 0 && nested.length === 0) return null;
1724
- return {
1725
- _filters: leaves,
1726
- _nestedGroups: nested.length > 0 ? nested : void 0,
1727
- _groupType: alt.type
1728
- };
1729
- }
1730
- function isWireFilter(input) {
1731
- if (!input || typeof input !== "object") return false;
1732
- const o = input;
1733
- if ("_filters" in o) return false;
1734
- return "type" in o && typeof o.type === "string" || "filters" in o && Array.isArray(o.filters);
1735
- }
1736
- function normalizeFilter(input) {
1737
- if (!input) return void 0;
1738
- if (isWireFilter(input)) return convertWireGroup(input) ?? void 0;
1739
- if (typeof input === "object" && Array.isArray(input._filters)) return input;
1740
- }
1741
- function extractSpecialFilters(filter) {
1742
- if (!filter || !Array.isArray(filter._filters)) return {};
1743
- let startDate;
1744
- let endDate;
1745
- let searchType;
1746
- const otherFilters = [];
1747
- const cleanedNestedGroups = [];
1748
- for (const f of filter._filters) if (f.dimension === "date" && isDateOperator(f.operator)) switch (f.operator) {
1749
- case "gte":
1750
- startDate = f.expression;
1751
- break;
1752
- case "gt":
1753
- startDate = addDays(f.expression, 1);
1754
- break;
1755
- case "lte":
1756
- endDate = f.expression;
1757
- break;
1758
- case "lt":
1759
- endDate = addDays(f.expression, -1);
1760
- break;
1761
- case "between":
1762
- startDate = f.expression;
1763
- endDate = f.expression2;
1764
- break;
1765
- }
1766
- else if (isQueryParam(f.dimension)) {
1767
- if (f.dimension === "searchType") searchType = f.expression;
1768
- } else if (isMetricOperator(f.operator) || isSpecialOperator(f.operator)) otherFilters.push(f);
1769
- else otherFilters.push(f);
1770
- if (filter._nestedGroups) for (const nested of filter._nestedGroups) {
1771
- const extracted = extractSpecialFilters(nested);
1772
- if (!startDate && extracted.startDate) startDate = extracted.startDate;
1773
- if (!endDate && extracted.endDate) endDate = extracted.endDate;
1774
- if (!searchType && extracted.searchType) searchType = extracted.searchType;
1775
- if (extracted.dimensionFilter) cleanedNestedGroups.push(extracted.dimensionFilter);
1776
- }
1777
- const dimensionFilter = otherFilters.length > 0 || cleanedNestedGroups.length > 0 ? {
1778
- ...filter,
1779
- _filters: otherFilters,
1780
- _nestedGroups: cleanedNestedGroups.length > 0 ? cleanedNestedGroups : void 0
1781
- } : void 0;
1782
- return {
1783
- startDate,
1784
- endDate,
1785
- searchType,
1786
- dimensionFilter
1787
- };
1788
- }
1789
- function extractDateRange(input) {
1790
- const { startDate, endDate } = extractSpecialFilters(normalizeFilter(input));
1791
- return {
1792
- startDate,
1793
- endDate
1794
- };
1795
- }
1796
- function extractMetricFilters(input) {
1797
- const filter = normalizeFilter(input);
1798
- if (!filter) return [];
1799
- const metricFilters = filter._filters.filter((f) => isMetricOperator(f.operator));
1800
- const nested = filter._nestedGroups?.flatMap((g) => extractMetricFilters(g)) ?? [];
1801
- return [...metricFilters, ...nested];
1802
- }
1803
- function extractSpecialOperatorFilters(input) {
1804
- const filter = normalizeFilter(input);
1805
- if (!filter) return [];
1806
- const special = filter._filters.filter((f) => isSpecialOperator(f.operator));
1807
- const nested = filter._nestedGroups?.flatMap((g) => extractSpecialOperatorFilters(g)) ?? [];
1808
- return [...special, ...nested];
1809
- }
1
+ import { err, ok, unwrapResult } from "../core/result.mjs";
2
+ import { UnresolvableDatasetError, UnsupportedLogicalCapabilityError, extractDateRange, extractMetricFilters, extractSpecialOperatorFilters, isDateOperator, isMetric, isQueryParam, isRegexOperator, normalizeFilter, queryErrorToException, queryErrors } from "../_chunks/resolver.mjs";
1810
3
  function collectInternalFilters(filter) {
1811
4
  if (!filter || !("_filters" in filter)) return [];
1812
5
  const flat = filter._filters;