gscdump 0.17.0 → 0.17.1

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/dist/index.mjs CHANGED
@@ -72,6 +72,262 @@ async function batchInspectUrls(client, siteUrl, urls, options = {}) {
72
72
  onProgress
73
73
  });
74
74
  }
75
+ const GSC_QUOTAS = {
76
+ searchAnalytics: 25e3,
77
+ urlInspection: 2e3,
78
+ indexing: 200
79
+ };
80
+ function pickField(error, paths, is) {
81
+ if (!error || typeof error !== "object") return void 0;
82
+ for (const path of paths) {
83
+ let current = error;
84
+ for (const key of path) {
85
+ if (!current || typeof current !== "object") {
86
+ current = void 0;
87
+ break;
88
+ }
89
+ current = current[key];
90
+ }
91
+ if (is(current)) return current;
92
+ }
93
+ }
94
+ const isNumber = (v) => typeof v === "number";
95
+ const isString = (v) => typeof v === "string";
96
+ function extractStatus(error) {
97
+ return pickField(error, [
98
+ ["statusCode"],
99
+ ["status"],
100
+ ["response", "status"],
101
+ ["code"]
102
+ ], isNumber);
103
+ }
104
+ function extractMessage(error) {
105
+ if (!error) return "Unknown error";
106
+ if (typeof error === "string") return error;
107
+ if (error instanceof Error) return error.message;
108
+ if (typeof error !== "object") return String(error);
109
+ return pickField(error, [
110
+ [
111
+ "data",
112
+ "error",
113
+ "message"
114
+ ],
115
+ ["message"],
116
+ ["statusMessage"]
117
+ ], isString) ?? String(error);
118
+ }
119
+ function extractRetryAfter(error) {
120
+ const raw = pickField(error, [
121
+ ["headers", "retry-after"],
122
+ ["headers", "Retry-After"],
123
+ [
124
+ "response",
125
+ "headers",
126
+ "retry-after"
127
+ ],
128
+ [
129
+ "response",
130
+ "headers",
131
+ "Retry-After"
132
+ ]
133
+ ], (v) => typeof v === "number" || typeof v === "string");
134
+ if (typeof raw === "number") return raw;
135
+ if (typeof raw === "string") {
136
+ const seconds = Number.parseInt(raw, 10);
137
+ return Number.isNaN(seconds) ? void 0 : seconds;
138
+ }
139
+ }
140
+ const QUOTA_MESSAGE_RE = /quota|rate\s*limit/i;
141
+ function classifyError(cause) {
142
+ const status = extractStatus(cause);
143
+ const message = extractMessage(cause);
144
+ if (status === 401) return {
145
+ kind: "auth-expired",
146
+ message,
147
+ cause
148
+ };
149
+ if (status === 429) return {
150
+ kind: "rate-limited",
151
+ message,
152
+ retryAfter: extractRetryAfter(cause),
153
+ cause
154
+ };
155
+ if (status === 403) {
156
+ if (QUOTA_MESSAGE_RE.test(message)) return {
157
+ kind: "rate-limited",
158
+ message,
159
+ retryAfter: extractRetryAfter(cause),
160
+ cause
161
+ };
162
+ return {
163
+ kind: "auth-expired",
164
+ message,
165
+ cause
166
+ };
167
+ }
168
+ if (status === 404) return {
169
+ kind: "not-found",
170
+ message,
171
+ cause
172
+ };
173
+ if (status === 400 || status === 422) return {
174
+ kind: "validation",
175
+ message,
176
+ cause
177
+ };
178
+ return {
179
+ kind: "transport",
180
+ message,
181
+ status,
182
+ cause
183
+ };
184
+ }
185
+ function storageError(message, cause) {
186
+ return {
187
+ kind: "storage",
188
+ message,
189
+ cause
190
+ };
191
+ }
192
+ function parseGoogleError(text, httpStatus) {
193
+ let parsed = null;
194
+ try {
195
+ parsed = JSON.parse(text);
196
+ } catch {}
197
+ if (!parsed || !("error" in parsed)) return {
198
+ code: httpStatus ?? 500,
199
+ message: text || "Unknown Google API error"
200
+ };
201
+ if (typeof parsed.error === "string") {
202
+ const oauth = parsed;
203
+ return {
204
+ code: httpStatus ?? 400,
205
+ message: oauth.error_description || oauth.error,
206
+ reason: oauth.error
207
+ };
208
+ }
209
+ const err = parsed.error;
210
+ const errorInfo = err.details?.find((d) => d["@type"]?.includes("ErrorInfo"));
211
+ return {
212
+ code: err.code ?? httpStatus ?? 500,
213
+ message: err.message || err.status || text || `HTTP ${httpStatus ?? "?"}`,
214
+ reason: errorInfo?.reason,
215
+ status: err.status
216
+ };
217
+ }
218
+ var GscApiError = class extends Error {
219
+ info;
220
+ constructor(message, info) {
221
+ super(message);
222
+ this.info = info;
223
+ this.name = "GscApiError";
224
+ }
225
+ };
226
+ function rethrowAsGscApiError(prefix) {
227
+ return (err) => {
228
+ if (err instanceof GscApiError) throw err;
229
+ const maybe = err;
230
+ if (maybe && maybe.name === "FetchError") {
231
+ const info = parseGoogleError(typeof maybe.data === "string" ? maybe.data : JSON.stringify(maybe.data ?? {}), maybe.statusCode);
232
+ throw new GscApiError(`${prefix}: ${info.message}`, info);
233
+ }
234
+ throw err;
235
+ };
236
+ }
237
+ const PERMISSION_SIGNALS = [
238
+ "403 forbidden",
239
+ "permission_denied",
240
+ "does not have sufficient permission",
241
+ "insufficient permission"
242
+ ];
243
+ function isPermissionDeniedError(err) {
244
+ const msg = String(err?.message ?? err ?? "").toLowerCase();
245
+ return PERMISSION_SIGNALS.some((s) => msg.includes(s));
246
+ }
247
+ function suggestionFor(err) {
248
+ switch (err.kind) {
249
+ case "auth-expired": return "Run `gscdump auth` to re-authenticate.";
250
+ case "rate-limited": {
251
+ const retryIn = err.retryAfter ? `${err.retryAfter}s` : "a few minutes";
252
+ if (QUOTA_MESSAGE_RE.test(err.message)) {
253
+ if (err.message.includes("Indexing API")) return `Indexing API quota exhausted (~${GSC_QUOTAS.indexing}/day). Try again tomorrow.`;
254
+ return `Quota or rate limit hit (Search Analytics ~${GSC_QUOTAS.searchAnalytics}/day). Try again in ${retryIn}.`;
255
+ }
256
+ return `Rate limited. Slow down requests. Try again in ${retryIn}.`;
257
+ }
258
+ case "not-found":
259
+ case "validation":
260
+ case "storage":
261
+ case "transport": return "";
262
+ }
263
+ }
264
+ function formatErrorForCli(cause) {
265
+ const err = classifyError(cause);
266
+ const lines = [`\x1B[31m${err.message}\x1B[0m`];
267
+ const suggestion = suggestionFor(err);
268
+ if (suggestion) {
269
+ lines.push("");
270
+ lines.push(suggestion);
271
+ }
272
+ return lines.join("\n");
273
+ }
274
+ const OAUTH_TOKEN_URL = "https://oauth2.googleapis.com/token";
275
+ const OAUTH_TIMEOUT_MS = 8e3;
276
+ const OAUTH_MAX_ATTEMPTS = 3;
277
+ const OAUTH_BACKOFF_MS = [
278
+ 0,
279
+ 400,
280
+ 1500
281
+ ];
282
+ async function refreshAccessToken(refreshToken, clientId, clientSecret) {
283
+ return postOAuthToken(new URLSearchParams({
284
+ client_id: clientId,
285
+ client_secret: clientSecret,
286
+ refresh_token: refreshToken,
287
+ grant_type: "refresh_token"
288
+ }), "refresh");
289
+ }
290
+ async function exchangeAuthCode(code, clientId, clientSecret, redirectUri) {
291
+ const tokens = await postOAuthToken(new URLSearchParams({
292
+ client_id: clientId,
293
+ client_secret: clientSecret,
294
+ code,
295
+ redirect_uri: redirectUri,
296
+ grant_type: "authorization_code"
297
+ }), "exchange");
298
+ const refreshToken = tokens.refresh_token;
299
+ return {
300
+ ...tokens,
301
+ refreshToken
302
+ };
303
+ }
304
+ async function postOAuthToken(body, op) {
305
+ let lastError;
306
+ for (let attempt = 0; attempt < OAUTH_MAX_ATTEMPTS; attempt++) {
307
+ if (OAUTH_BACKOFF_MS[attempt]) await new Promise((r) => setTimeout(r, OAUTH_BACKOFF_MS[attempt]));
308
+ const res = await fetch(OAUTH_TOKEN_URL, {
309
+ method: "POST",
310
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
311
+ body,
312
+ signal: AbortSignal.timeout(OAUTH_TIMEOUT_MS)
313
+ }).catch((err) => {
314
+ lastError = err;
315
+ return null;
316
+ });
317
+ if (!res) continue;
318
+ if (!res.ok) {
319
+ const info = parseGoogleError(await res.text(), res.status);
320
+ throw new GscApiError(`Failed to ${op} token: ${info.message}`, info);
321
+ }
322
+ const data = await res.json();
323
+ return {
324
+ accessToken: data.access_token,
325
+ expiresAt: Math.floor(Date.now() / 1e3) + data.expires_in,
326
+ refresh_token: data.refresh_token
327
+ };
328
+ }
329
+ throw lastError instanceof Error ? lastError : /* @__PURE__ */ new Error(`OAuth ${op} failed after ${OAUTH_MAX_ATTEMPTS} attempts`);
330
+ }
75
331
  async function fetchSites(client) {
76
332
  return client.sites();
77
333
  }
@@ -253,6 +509,1511 @@ function getBackfillProgress(oldestDateSynced, newestDateSynced) {
253
509
  isComplete: oldestDateSynced <= oldestGsc
254
510
  };
255
511
  }
512
+ var countries_default = [
513
+ {
514
+ "name": "Afghanistan",
515
+ "alpha-2": "AF",
516
+ "alpha-3": "AFG",
517
+ "country-code": "004"
518
+ },
519
+ {
520
+ "name": "Åland Islands",
521
+ "alpha-2": "AX",
522
+ "alpha-3": "ALA",
523
+ "country-code": "248"
524
+ },
525
+ {
526
+ "name": "Albania",
527
+ "alpha-2": "AL",
528
+ "alpha-3": "ALB",
529
+ "country-code": "008"
530
+ },
531
+ {
532
+ "name": "Algeria",
533
+ "alpha-2": "DZ",
534
+ "alpha-3": "DZA",
535
+ "country-code": "012"
536
+ },
537
+ {
538
+ "name": "American Samoa",
539
+ "alpha-2": "AS",
540
+ "alpha-3": "ASM",
541
+ "country-code": "016"
542
+ },
543
+ {
544
+ "name": "Andorra",
545
+ "alpha-2": "AD",
546
+ "alpha-3": "AND",
547
+ "country-code": "020"
548
+ },
549
+ {
550
+ "name": "Angola",
551
+ "alpha-2": "AO",
552
+ "alpha-3": "AGO",
553
+ "country-code": "024"
554
+ },
555
+ {
556
+ "name": "Anguilla",
557
+ "alpha-2": "AI",
558
+ "alpha-3": "AIA",
559
+ "country-code": "660"
560
+ },
561
+ {
562
+ "name": "Antarctica",
563
+ "alpha-2": "AQ",
564
+ "alpha-3": "ATA",
565
+ "country-code": "010"
566
+ },
567
+ {
568
+ "name": "Antigua and Barbuda",
569
+ "alpha-2": "AG",
570
+ "alpha-3": "ATG",
571
+ "country-code": "028"
572
+ },
573
+ {
574
+ "name": "Argentina",
575
+ "alpha-2": "AR",
576
+ "alpha-3": "ARG",
577
+ "country-code": "032"
578
+ },
579
+ {
580
+ "name": "Armenia",
581
+ "alpha-2": "AM",
582
+ "alpha-3": "ARM",
583
+ "country-code": "051"
584
+ },
585
+ {
586
+ "name": "Aruba",
587
+ "alpha-2": "AW",
588
+ "alpha-3": "ABW",
589
+ "country-code": "533"
590
+ },
591
+ {
592
+ "name": "Australia",
593
+ "alpha-2": "AU",
594
+ "alpha-3": "AUS",
595
+ "country-code": "036"
596
+ },
597
+ {
598
+ "name": "Austria",
599
+ "alpha-2": "AT",
600
+ "alpha-3": "AUT",
601
+ "country-code": "040"
602
+ },
603
+ {
604
+ "name": "Azerbaijan",
605
+ "alpha-2": "AZ",
606
+ "alpha-3": "AZE",
607
+ "country-code": "031"
608
+ },
609
+ {
610
+ "name": "Bahamas",
611
+ "alpha-2": "BS",
612
+ "alpha-3": "BHS",
613
+ "country-code": "044"
614
+ },
615
+ {
616
+ "name": "Bahrain",
617
+ "alpha-2": "BH",
618
+ "alpha-3": "BHR",
619
+ "country-code": "048"
620
+ },
621
+ {
622
+ "name": "Bangladesh",
623
+ "alpha-2": "BD",
624
+ "alpha-3": "BGD",
625
+ "country-code": "050"
626
+ },
627
+ {
628
+ "name": "Barbados",
629
+ "alpha-2": "BB",
630
+ "alpha-3": "BRB",
631
+ "country-code": "052"
632
+ },
633
+ {
634
+ "name": "Belarus",
635
+ "alpha-2": "BY",
636
+ "alpha-3": "BLR",
637
+ "country-code": "112"
638
+ },
639
+ {
640
+ "name": "Belgium",
641
+ "alpha-2": "BE",
642
+ "alpha-3": "BEL",
643
+ "country-code": "056"
644
+ },
645
+ {
646
+ "name": "Belize",
647
+ "alpha-2": "BZ",
648
+ "alpha-3": "BLZ",
649
+ "country-code": "084"
650
+ },
651
+ {
652
+ "name": "Benin",
653
+ "alpha-2": "BJ",
654
+ "alpha-3": "BEN",
655
+ "country-code": "204"
656
+ },
657
+ {
658
+ "name": "Bermuda",
659
+ "alpha-2": "BM",
660
+ "alpha-3": "BMU",
661
+ "country-code": "060"
662
+ },
663
+ {
664
+ "name": "Bhutan",
665
+ "alpha-2": "BT",
666
+ "alpha-3": "BTN",
667
+ "country-code": "064"
668
+ },
669
+ {
670
+ "name": "Bolivia (Plurinational State of)",
671
+ "alpha-2": "BO",
672
+ "alpha-3": "BOL",
673
+ "country-code": "068"
674
+ },
675
+ {
676
+ "name": "Bonaire, Sint Eustatius and Saba",
677
+ "alpha-2": "BQ",
678
+ "alpha-3": "BES",
679
+ "country-code": "535"
680
+ },
681
+ {
682
+ "name": "Bosnia and Herzegovina",
683
+ "alpha-2": "BA",
684
+ "alpha-3": "BIH",
685
+ "country-code": "070"
686
+ },
687
+ {
688
+ "name": "Botswana",
689
+ "alpha-2": "BW",
690
+ "alpha-3": "BWA",
691
+ "country-code": "072"
692
+ },
693
+ {
694
+ "name": "Bouvet Island",
695
+ "alpha-2": "BV",
696
+ "alpha-3": "BVT",
697
+ "country-code": "074"
698
+ },
699
+ {
700
+ "name": "Brazil",
701
+ "alpha-2": "BR",
702
+ "alpha-3": "BRA",
703
+ "country-code": "076"
704
+ },
705
+ {
706
+ "name": "British Indian Ocean Territory",
707
+ "alpha-2": "IO",
708
+ "alpha-3": "IOT",
709
+ "country-code": "086"
710
+ },
711
+ {
712
+ "name": "Brunei Darussalam",
713
+ "alpha-2": "BN",
714
+ "alpha-3": "BRN",
715
+ "country-code": "096"
716
+ },
717
+ {
718
+ "name": "Bulgaria",
719
+ "alpha-2": "BG",
720
+ "alpha-3": "BGR",
721
+ "country-code": "100"
722
+ },
723
+ {
724
+ "name": "Burkina Faso",
725
+ "alpha-2": "BF",
726
+ "alpha-3": "BFA",
727
+ "country-code": "854"
728
+ },
729
+ {
730
+ "name": "Burundi",
731
+ "alpha-2": "BI",
732
+ "alpha-3": "BDI",
733
+ "country-code": "108"
734
+ },
735
+ {
736
+ "name": "Cabo Verde",
737
+ "alpha-2": "CV",
738
+ "alpha-3": "CPV",
739
+ "country-code": "132"
740
+ },
741
+ {
742
+ "name": "Cambodia",
743
+ "alpha-2": "KH",
744
+ "alpha-3": "KHM",
745
+ "country-code": "116"
746
+ },
747
+ {
748
+ "name": "Cameroon",
749
+ "alpha-2": "CM",
750
+ "alpha-3": "CMR",
751
+ "country-code": "120"
752
+ },
753
+ {
754
+ "name": "Canada",
755
+ "alpha-2": "CA",
756
+ "alpha-3": "CAN",
757
+ "country-code": "124"
758
+ },
759
+ {
760
+ "name": "Cayman Islands",
761
+ "alpha-2": "KY",
762
+ "alpha-3": "CYM",
763
+ "country-code": "136"
764
+ },
765
+ {
766
+ "name": "Central African Republic",
767
+ "alpha-2": "CF",
768
+ "alpha-3": "CAF",
769
+ "country-code": "140"
770
+ },
771
+ {
772
+ "name": "Chad",
773
+ "alpha-2": "TD",
774
+ "alpha-3": "TCD",
775
+ "country-code": "148"
776
+ },
777
+ {
778
+ "name": "Chile",
779
+ "alpha-2": "CL",
780
+ "alpha-3": "CHL",
781
+ "country-code": "152"
782
+ },
783
+ {
784
+ "name": "China",
785
+ "alpha-2": "CN",
786
+ "alpha-3": "CHN",
787
+ "country-code": "156"
788
+ },
789
+ {
790
+ "name": "Christmas Island",
791
+ "alpha-2": "CX",
792
+ "alpha-3": "CXR",
793
+ "country-code": "162"
794
+ },
795
+ {
796
+ "name": "Cocos (Keeling) Islands",
797
+ "alpha-2": "CC",
798
+ "alpha-3": "CCK",
799
+ "country-code": "166"
800
+ },
801
+ {
802
+ "name": "Colombia",
803
+ "alpha-2": "CO",
804
+ "alpha-3": "COL",
805
+ "country-code": "170"
806
+ },
807
+ {
808
+ "name": "Comoros",
809
+ "alpha-2": "KM",
810
+ "alpha-3": "COM",
811
+ "country-code": "174"
812
+ },
813
+ {
814
+ "name": "Congo",
815
+ "alpha-2": "CG",
816
+ "alpha-3": "COG",
817
+ "country-code": "178"
818
+ },
819
+ {
820
+ "name": "Congo, Democratic Republic of the",
821
+ "alpha-2": "CD",
822
+ "alpha-3": "COD",
823
+ "country-code": "180"
824
+ },
825
+ {
826
+ "name": "Cook Islands",
827
+ "alpha-2": "CK",
828
+ "alpha-3": "COK",
829
+ "country-code": "184"
830
+ },
831
+ {
832
+ "name": "Costa Rica",
833
+ "alpha-2": "CR",
834
+ "alpha-3": "CRI",
835
+ "country-code": "188"
836
+ },
837
+ {
838
+ "name": "Côte d'Ivoire",
839
+ "alpha-2": "CI",
840
+ "alpha-3": "CIV",
841
+ "country-code": "384"
842
+ },
843
+ {
844
+ "name": "Croatia",
845
+ "alpha-2": "HR",
846
+ "alpha-3": "HRV",
847
+ "country-code": "191"
848
+ },
849
+ {
850
+ "name": "Cuba",
851
+ "alpha-2": "CU",
852
+ "alpha-3": "CUB",
853
+ "country-code": "192"
854
+ },
855
+ {
856
+ "name": "Curaçao",
857
+ "alpha-2": "CW",
858
+ "alpha-3": "CUW",
859
+ "country-code": "531"
860
+ },
861
+ {
862
+ "name": "Cyprus",
863
+ "alpha-2": "CY",
864
+ "alpha-3": "CYP",
865
+ "country-code": "196"
866
+ },
867
+ {
868
+ "name": "Czechia",
869
+ "alpha-2": "CZ",
870
+ "alpha-3": "CZE",
871
+ "country-code": "203"
872
+ },
873
+ {
874
+ "name": "Denmark",
875
+ "alpha-2": "DK",
876
+ "alpha-3": "DNK",
877
+ "country-code": "208"
878
+ },
879
+ {
880
+ "name": "Djibouti",
881
+ "alpha-2": "DJ",
882
+ "alpha-3": "DJI",
883
+ "country-code": "262"
884
+ },
885
+ {
886
+ "name": "Dominica",
887
+ "alpha-2": "DM",
888
+ "alpha-3": "DMA",
889
+ "country-code": "212"
890
+ },
891
+ {
892
+ "name": "Dominican Republic",
893
+ "alpha-2": "DO",
894
+ "alpha-3": "DOM",
895
+ "country-code": "214"
896
+ },
897
+ {
898
+ "name": "Ecuador",
899
+ "alpha-2": "EC",
900
+ "alpha-3": "ECU",
901
+ "country-code": "218"
902
+ },
903
+ {
904
+ "name": "Egypt",
905
+ "alpha-2": "EG",
906
+ "alpha-3": "EGY",
907
+ "country-code": "818"
908
+ },
909
+ {
910
+ "name": "El Salvador",
911
+ "alpha-2": "SV",
912
+ "alpha-3": "SLV",
913
+ "country-code": "222"
914
+ },
915
+ {
916
+ "name": "Equatorial Guinea",
917
+ "alpha-2": "GQ",
918
+ "alpha-3": "GNQ",
919
+ "country-code": "226"
920
+ },
921
+ {
922
+ "name": "Eritrea",
923
+ "alpha-2": "ER",
924
+ "alpha-3": "ERI",
925
+ "country-code": "232"
926
+ },
927
+ {
928
+ "name": "Estonia",
929
+ "alpha-2": "EE",
930
+ "alpha-3": "EST",
931
+ "country-code": "233"
932
+ },
933
+ {
934
+ "name": "Eswatini",
935
+ "alpha-2": "SZ",
936
+ "alpha-3": "SWZ",
937
+ "country-code": "748"
938
+ },
939
+ {
940
+ "name": "Ethiopia",
941
+ "alpha-2": "ET",
942
+ "alpha-3": "ETH",
943
+ "country-code": "231"
944
+ },
945
+ {
946
+ "name": "Falkland Islands (Malvinas)",
947
+ "alpha-2": "FK",
948
+ "alpha-3": "FLK",
949
+ "country-code": "238"
950
+ },
951
+ {
952
+ "name": "Faroe Islands",
953
+ "alpha-2": "FO",
954
+ "alpha-3": "FRO",
955
+ "country-code": "234"
956
+ },
957
+ {
958
+ "name": "Fiji",
959
+ "alpha-2": "FJ",
960
+ "alpha-3": "FJI",
961
+ "country-code": "242"
962
+ },
963
+ {
964
+ "name": "Finland",
965
+ "alpha-2": "FI",
966
+ "alpha-3": "FIN",
967
+ "country-code": "246"
968
+ },
969
+ {
970
+ "name": "France",
971
+ "alpha-2": "FR",
972
+ "alpha-3": "FRA",
973
+ "country-code": "250"
974
+ },
975
+ {
976
+ "name": "French Guiana",
977
+ "alpha-2": "GF",
978
+ "alpha-3": "GUF",
979
+ "country-code": "254"
980
+ },
981
+ {
982
+ "name": "French Polynesia",
983
+ "alpha-2": "PF",
984
+ "alpha-3": "PYF",
985
+ "country-code": "258"
986
+ },
987
+ {
988
+ "name": "French Southern Territories",
989
+ "alpha-2": "TF",
990
+ "alpha-3": "ATF",
991
+ "country-code": "260"
992
+ },
993
+ {
994
+ "name": "Gabon",
995
+ "alpha-2": "GA",
996
+ "alpha-3": "GAB",
997
+ "country-code": "266"
998
+ },
999
+ {
1000
+ "name": "Gambia",
1001
+ "alpha-2": "GM",
1002
+ "alpha-3": "GMB",
1003
+ "country-code": "270"
1004
+ },
1005
+ {
1006
+ "name": "Georgia",
1007
+ "alpha-2": "GE",
1008
+ "alpha-3": "GEO",
1009
+ "country-code": "268"
1010
+ },
1011
+ {
1012
+ "name": "Germany",
1013
+ "alpha-2": "DE",
1014
+ "alpha-3": "DEU",
1015
+ "country-code": "276"
1016
+ },
1017
+ {
1018
+ "name": "Ghana",
1019
+ "alpha-2": "GH",
1020
+ "alpha-3": "GHA",
1021
+ "country-code": "288"
1022
+ },
1023
+ {
1024
+ "name": "Gibraltar",
1025
+ "alpha-2": "GI",
1026
+ "alpha-3": "GIB",
1027
+ "country-code": "292"
1028
+ },
1029
+ {
1030
+ "name": "Greece",
1031
+ "alpha-2": "GR",
1032
+ "alpha-3": "GRC",
1033
+ "country-code": "300"
1034
+ },
1035
+ {
1036
+ "name": "Greenland",
1037
+ "alpha-2": "GL",
1038
+ "alpha-3": "GRL",
1039
+ "country-code": "304"
1040
+ },
1041
+ {
1042
+ "name": "Grenada",
1043
+ "alpha-2": "GD",
1044
+ "alpha-3": "GRD",
1045
+ "country-code": "308"
1046
+ },
1047
+ {
1048
+ "name": "Guadeloupe",
1049
+ "alpha-2": "GP",
1050
+ "alpha-3": "GLP",
1051
+ "country-code": "312"
1052
+ },
1053
+ {
1054
+ "name": "Guam",
1055
+ "alpha-2": "GU",
1056
+ "alpha-3": "GUM",
1057
+ "country-code": "316"
1058
+ },
1059
+ {
1060
+ "name": "Guatemala",
1061
+ "alpha-2": "GT",
1062
+ "alpha-3": "GTM",
1063
+ "country-code": "320"
1064
+ },
1065
+ {
1066
+ "name": "Guernsey",
1067
+ "alpha-2": "GG",
1068
+ "alpha-3": "GGY",
1069
+ "country-code": "831"
1070
+ },
1071
+ {
1072
+ "name": "Guinea",
1073
+ "alpha-2": "GN",
1074
+ "alpha-3": "GIN",
1075
+ "country-code": "324"
1076
+ },
1077
+ {
1078
+ "name": "Guinea-Bissau",
1079
+ "alpha-2": "GW",
1080
+ "alpha-3": "GNB",
1081
+ "country-code": "624"
1082
+ },
1083
+ {
1084
+ "name": "Guyana",
1085
+ "alpha-2": "GY",
1086
+ "alpha-3": "GUY",
1087
+ "country-code": "328"
1088
+ },
1089
+ {
1090
+ "name": "Haiti",
1091
+ "alpha-2": "HT",
1092
+ "alpha-3": "HTI",
1093
+ "country-code": "332"
1094
+ },
1095
+ {
1096
+ "name": "Heard Island and McDonald Islands",
1097
+ "alpha-2": "HM",
1098
+ "alpha-3": "HMD",
1099
+ "country-code": "334"
1100
+ },
1101
+ {
1102
+ "name": "Holy See",
1103
+ "alpha-2": "VA",
1104
+ "alpha-3": "VAT",
1105
+ "country-code": "336"
1106
+ },
1107
+ {
1108
+ "name": "Honduras",
1109
+ "alpha-2": "HN",
1110
+ "alpha-3": "HND",
1111
+ "country-code": "340"
1112
+ },
1113
+ {
1114
+ "name": "Hong Kong",
1115
+ "alpha-2": "HK",
1116
+ "alpha-3": "HKG",
1117
+ "country-code": "344"
1118
+ },
1119
+ {
1120
+ "name": "Hungary",
1121
+ "alpha-2": "HU",
1122
+ "alpha-3": "HUN",
1123
+ "country-code": "348"
1124
+ },
1125
+ {
1126
+ "name": "Iceland",
1127
+ "alpha-2": "IS",
1128
+ "alpha-3": "ISL",
1129
+ "country-code": "352"
1130
+ },
1131
+ {
1132
+ "name": "India",
1133
+ "alpha-2": "IN",
1134
+ "alpha-3": "IND",
1135
+ "country-code": "356"
1136
+ },
1137
+ {
1138
+ "name": "Indonesia",
1139
+ "alpha-2": "ID",
1140
+ "alpha-3": "IDN",
1141
+ "country-code": "360"
1142
+ },
1143
+ {
1144
+ "name": "Iran (Islamic Republic of)",
1145
+ "alpha-2": "IR",
1146
+ "alpha-3": "IRN",
1147
+ "country-code": "364"
1148
+ },
1149
+ {
1150
+ "name": "Iraq",
1151
+ "alpha-2": "IQ",
1152
+ "alpha-3": "IRQ",
1153
+ "country-code": "368"
1154
+ },
1155
+ {
1156
+ "name": "Ireland",
1157
+ "alpha-2": "IE",
1158
+ "alpha-3": "IRL",
1159
+ "country-code": "372"
1160
+ },
1161
+ {
1162
+ "name": "Isle of Man",
1163
+ "alpha-2": "IM",
1164
+ "alpha-3": "IMN",
1165
+ "country-code": "833"
1166
+ },
1167
+ {
1168
+ "name": "Israel",
1169
+ "alpha-2": "IL",
1170
+ "alpha-3": "ISR",
1171
+ "country-code": "376"
1172
+ },
1173
+ {
1174
+ "name": "Italy",
1175
+ "alpha-2": "IT",
1176
+ "alpha-3": "ITA",
1177
+ "country-code": "380"
1178
+ },
1179
+ {
1180
+ "name": "Jamaica",
1181
+ "alpha-2": "JM",
1182
+ "alpha-3": "JAM",
1183
+ "country-code": "388"
1184
+ },
1185
+ {
1186
+ "name": "Japan",
1187
+ "alpha-2": "JP",
1188
+ "alpha-3": "JPN",
1189
+ "country-code": "392"
1190
+ },
1191
+ {
1192
+ "name": "Jersey",
1193
+ "alpha-2": "JE",
1194
+ "alpha-3": "JEY",
1195
+ "country-code": "832"
1196
+ },
1197
+ {
1198
+ "name": "Jordan",
1199
+ "alpha-2": "JO",
1200
+ "alpha-3": "JOR",
1201
+ "country-code": "400"
1202
+ },
1203
+ {
1204
+ "name": "Kazakhstan",
1205
+ "alpha-2": "KZ",
1206
+ "alpha-3": "KAZ",
1207
+ "country-code": "398"
1208
+ },
1209
+ {
1210
+ "name": "Kenya",
1211
+ "alpha-2": "KE",
1212
+ "alpha-3": "KEN",
1213
+ "country-code": "404"
1214
+ },
1215
+ {
1216
+ "name": "Kiribati",
1217
+ "alpha-2": "KI",
1218
+ "alpha-3": "KIR",
1219
+ "country-code": "296"
1220
+ },
1221
+ {
1222
+ "name": "Korea (Democratic People's Republic of)",
1223
+ "alpha-2": "KP",
1224
+ "alpha-3": "PRK",
1225
+ "country-code": "408"
1226
+ },
1227
+ {
1228
+ "name": "Korea, Republic of",
1229
+ "alpha-2": "KR",
1230
+ "alpha-3": "KOR",
1231
+ "country-code": "410"
1232
+ },
1233
+ {
1234
+ "name": "Kuwait",
1235
+ "alpha-2": "KW",
1236
+ "alpha-3": "KWT",
1237
+ "country-code": "414"
1238
+ },
1239
+ {
1240
+ "name": "Kyrgyzstan",
1241
+ "alpha-2": "KG",
1242
+ "alpha-3": "KGZ",
1243
+ "country-code": "417"
1244
+ },
1245
+ {
1246
+ "name": "Lao People's Democratic Republic",
1247
+ "alpha-2": "LA",
1248
+ "alpha-3": "LAO",
1249
+ "country-code": "418"
1250
+ },
1251
+ {
1252
+ "name": "Latvia",
1253
+ "alpha-2": "LV",
1254
+ "alpha-3": "LVA",
1255
+ "country-code": "428"
1256
+ },
1257
+ {
1258
+ "name": "Lebanon",
1259
+ "alpha-2": "LB",
1260
+ "alpha-3": "LBN",
1261
+ "country-code": "422"
1262
+ },
1263
+ {
1264
+ "name": "Lesotho",
1265
+ "alpha-2": "LS",
1266
+ "alpha-3": "LSO",
1267
+ "country-code": "426"
1268
+ },
1269
+ {
1270
+ "name": "Liberia",
1271
+ "alpha-2": "LR",
1272
+ "alpha-3": "LBR",
1273
+ "country-code": "430"
1274
+ },
1275
+ {
1276
+ "name": "Libya",
1277
+ "alpha-2": "LY",
1278
+ "alpha-3": "LBY",
1279
+ "country-code": "434"
1280
+ },
1281
+ {
1282
+ "name": "Liechtenstein",
1283
+ "alpha-2": "LI",
1284
+ "alpha-3": "LIE",
1285
+ "country-code": "438"
1286
+ },
1287
+ {
1288
+ "name": "Lithuania",
1289
+ "alpha-2": "LT",
1290
+ "alpha-3": "LTU",
1291
+ "country-code": "440"
1292
+ },
1293
+ {
1294
+ "name": "Luxembourg",
1295
+ "alpha-2": "LU",
1296
+ "alpha-3": "LUX",
1297
+ "country-code": "442"
1298
+ },
1299
+ {
1300
+ "name": "Macao",
1301
+ "alpha-2": "MO",
1302
+ "alpha-3": "MAC",
1303
+ "country-code": "446"
1304
+ },
1305
+ {
1306
+ "name": "Madagascar",
1307
+ "alpha-2": "MG",
1308
+ "alpha-3": "MDG",
1309
+ "country-code": "450"
1310
+ },
1311
+ {
1312
+ "name": "Malawi",
1313
+ "alpha-2": "MW",
1314
+ "alpha-3": "MWI",
1315
+ "country-code": "454"
1316
+ },
1317
+ {
1318
+ "name": "Malaysia",
1319
+ "alpha-2": "MY",
1320
+ "alpha-3": "MYS",
1321
+ "country-code": "458"
1322
+ },
1323
+ {
1324
+ "name": "Maldives",
1325
+ "alpha-2": "MV",
1326
+ "alpha-3": "MDV",
1327
+ "country-code": "462"
1328
+ },
1329
+ {
1330
+ "name": "Mali",
1331
+ "alpha-2": "ML",
1332
+ "alpha-3": "MLI",
1333
+ "country-code": "466"
1334
+ },
1335
+ {
1336
+ "name": "Malta",
1337
+ "alpha-2": "MT",
1338
+ "alpha-3": "MLT",
1339
+ "country-code": "470"
1340
+ },
1341
+ {
1342
+ "name": "Marshall Islands",
1343
+ "alpha-2": "MH",
1344
+ "alpha-3": "MHL",
1345
+ "country-code": "584"
1346
+ },
1347
+ {
1348
+ "name": "Martinique",
1349
+ "alpha-2": "MQ",
1350
+ "alpha-3": "MTQ",
1351
+ "country-code": "474"
1352
+ },
1353
+ {
1354
+ "name": "Mauritania",
1355
+ "alpha-2": "MR",
1356
+ "alpha-3": "MRT",
1357
+ "country-code": "478"
1358
+ },
1359
+ {
1360
+ "name": "Mauritius",
1361
+ "alpha-2": "MU",
1362
+ "alpha-3": "MUS",
1363
+ "country-code": "480"
1364
+ },
1365
+ {
1366
+ "name": "Mayotte",
1367
+ "alpha-2": "YT",
1368
+ "alpha-3": "MYT",
1369
+ "country-code": "175"
1370
+ },
1371
+ {
1372
+ "name": "Mexico",
1373
+ "alpha-2": "MX",
1374
+ "alpha-3": "MEX",
1375
+ "country-code": "484"
1376
+ },
1377
+ {
1378
+ "name": "Micronesia (Federated States of)",
1379
+ "alpha-2": "FM",
1380
+ "alpha-3": "FSM",
1381
+ "country-code": "583"
1382
+ },
1383
+ {
1384
+ "name": "Moldova, Republic of",
1385
+ "alpha-2": "MD",
1386
+ "alpha-3": "MDA",
1387
+ "country-code": "498"
1388
+ },
1389
+ {
1390
+ "name": "Monaco",
1391
+ "alpha-2": "MC",
1392
+ "alpha-3": "MCO",
1393
+ "country-code": "492"
1394
+ },
1395
+ {
1396
+ "name": "Mongolia",
1397
+ "alpha-2": "MN",
1398
+ "alpha-3": "MNG",
1399
+ "country-code": "496"
1400
+ },
1401
+ {
1402
+ "name": "Montenegro",
1403
+ "alpha-2": "ME",
1404
+ "alpha-3": "MNE",
1405
+ "country-code": "499"
1406
+ },
1407
+ {
1408
+ "name": "Montserrat",
1409
+ "alpha-2": "MS",
1410
+ "alpha-3": "MSR",
1411
+ "country-code": "500"
1412
+ },
1413
+ {
1414
+ "name": "Morocco",
1415
+ "alpha-2": "MA",
1416
+ "alpha-3": "MAR",
1417
+ "country-code": "504"
1418
+ },
1419
+ {
1420
+ "name": "Mozambique",
1421
+ "alpha-2": "MZ",
1422
+ "alpha-3": "MOZ",
1423
+ "country-code": "508"
1424
+ },
1425
+ {
1426
+ "name": "Myanmar",
1427
+ "alpha-2": "MM",
1428
+ "alpha-3": "MMR",
1429
+ "country-code": "104"
1430
+ },
1431
+ {
1432
+ "name": "Namibia",
1433
+ "alpha-2": "NA",
1434
+ "alpha-3": "NAM",
1435
+ "country-code": "516"
1436
+ },
1437
+ {
1438
+ "name": "Nauru",
1439
+ "alpha-2": "NR",
1440
+ "alpha-3": "NRU",
1441
+ "country-code": "520"
1442
+ },
1443
+ {
1444
+ "name": "Nepal",
1445
+ "alpha-2": "NP",
1446
+ "alpha-3": "NPL",
1447
+ "country-code": "524"
1448
+ },
1449
+ {
1450
+ "name": "Netherlands",
1451
+ "alpha-2": "NL",
1452
+ "alpha-3": "NLD",
1453
+ "country-code": "528"
1454
+ },
1455
+ {
1456
+ "name": "New Caledonia",
1457
+ "alpha-2": "NC",
1458
+ "alpha-3": "NCL",
1459
+ "country-code": "540"
1460
+ },
1461
+ {
1462
+ "name": "New Zealand",
1463
+ "alpha-2": "NZ",
1464
+ "alpha-3": "NZL",
1465
+ "country-code": "554"
1466
+ },
1467
+ {
1468
+ "name": "Nicaragua",
1469
+ "alpha-2": "NI",
1470
+ "alpha-3": "NIC",
1471
+ "country-code": "558"
1472
+ },
1473
+ {
1474
+ "name": "Niger",
1475
+ "alpha-2": "NE",
1476
+ "alpha-3": "NER",
1477
+ "country-code": "562"
1478
+ },
1479
+ {
1480
+ "name": "Nigeria",
1481
+ "alpha-2": "NG",
1482
+ "alpha-3": "NGA",
1483
+ "country-code": "566"
1484
+ },
1485
+ {
1486
+ "name": "Niue",
1487
+ "alpha-2": "NU",
1488
+ "alpha-3": "NIU",
1489
+ "country-code": "570"
1490
+ },
1491
+ {
1492
+ "name": "Norfolk Island",
1493
+ "alpha-2": "NF",
1494
+ "alpha-3": "NFK",
1495
+ "country-code": "574"
1496
+ },
1497
+ {
1498
+ "name": "North Macedonia",
1499
+ "alpha-2": "MK",
1500
+ "alpha-3": "MKD",
1501
+ "country-code": "807"
1502
+ },
1503
+ {
1504
+ "name": "Northern Mariana Islands",
1505
+ "alpha-2": "MP",
1506
+ "alpha-3": "MNP",
1507
+ "country-code": "580"
1508
+ },
1509
+ {
1510
+ "name": "Norway",
1511
+ "alpha-2": "NO",
1512
+ "alpha-3": "NOR",
1513
+ "country-code": "578"
1514
+ },
1515
+ {
1516
+ "name": "Oman",
1517
+ "alpha-2": "OM",
1518
+ "alpha-3": "OMN",
1519
+ "country-code": "512"
1520
+ },
1521
+ {
1522
+ "name": "Pakistan",
1523
+ "alpha-2": "PK",
1524
+ "alpha-3": "PAK",
1525
+ "country-code": "586"
1526
+ },
1527
+ {
1528
+ "name": "Palau",
1529
+ "alpha-2": "PW",
1530
+ "alpha-3": "PLW",
1531
+ "country-code": "585"
1532
+ },
1533
+ {
1534
+ "name": "Palestine, State of",
1535
+ "alpha-2": "PS",
1536
+ "alpha-3": "PSE",
1537
+ "country-code": "275"
1538
+ },
1539
+ {
1540
+ "name": "Panama",
1541
+ "alpha-2": "PA",
1542
+ "alpha-3": "PAN",
1543
+ "country-code": "591"
1544
+ },
1545
+ {
1546
+ "name": "Papua New Guinea",
1547
+ "alpha-2": "PG",
1548
+ "alpha-3": "PNG",
1549
+ "country-code": "598"
1550
+ },
1551
+ {
1552
+ "name": "Paraguay",
1553
+ "alpha-2": "PY",
1554
+ "alpha-3": "PRY",
1555
+ "country-code": "600"
1556
+ },
1557
+ {
1558
+ "name": "Peru",
1559
+ "alpha-2": "PE",
1560
+ "alpha-3": "PER",
1561
+ "country-code": "604"
1562
+ },
1563
+ {
1564
+ "name": "Philippines",
1565
+ "alpha-2": "PH",
1566
+ "alpha-3": "PHL",
1567
+ "country-code": "608"
1568
+ },
1569
+ {
1570
+ "name": "Pitcairn",
1571
+ "alpha-2": "PN",
1572
+ "alpha-3": "PCN",
1573
+ "country-code": "612"
1574
+ },
1575
+ {
1576
+ "name": "Poland",
1577
+ "alpha-2": "PL",
1578
+ "alpha-3": "POL",
1579
+ "country-code": "616"
1580
+ },
1581
+ {
1582
+ "name": "Portugal",
1583
+ "alpha-2": "PT",
1584
+ "alpha-3": "PRT",
1585
+ "country-code": "620"
1586
+ },
1587
+ {
1588
+ "name": "Puerto Rico",
1589
+ "alpha-2": "PR",
1590
+ "alpha-3": "PRI",
1591
+ "country-code": "630"
1592
+ },
1593
+ {
1594
+ "name": "Qatar",
1595
+ "alpha-2": "QA",
1596
+ "alpha-3": "QAT",
1597
+ "country-code": "634"
1598
+ },
1599
+ {
1600
+ "name": "Réunion",
1601
+ "alpha-2": "RE",
1602
+ "alpha-3": "REU",
1603
+ "country-code": "638"
1604
+ },
1605
+ {
1606
+ "name": "Romania",
1607
+ "alpha-2": "RO",
1608
+ "alpha-3": "ROU",
1609
+ "country-code": "642"
1610
+ },
1611
+ {
1612
+ "name": "Russian Federation",
1613
+ "alpha-2": "RU",
1614
+ "alpha-3": "RUS",
1615
+ "country-code": "643"
1616
+ },
1617
+ {
1618
+ "name": "Rwanda",
1619
+ "alpha-2": "RW",
1620
+ "alpha-3": "RWA",
1621
+ "country-code": "646"
1622
+ },
1623
+ {
1624
+ "name": "Saint Barthélemy",
1625
+ "alpha-2": "BL",
1626
+ "alpha-3": "BLM",
1627
+ "country-code": "652"
1628
+ },
1629
+ {
1630
+ "name": "Saint Helena, Ascension and Tristan da Cunha",
1631
+ "alpha-2": "SH",
1632
+ "alpha-3": "SHN",
1633
+ "country-code": "654"
1634
+ },
1635
+ {
1636
+ "name": "Saint Kitts and Nevis",
1637
+ "alpha-2": "KN",
1638
+ "alpha-3": "KNA",
1639
+ "country-code": "659"
1640
+ },
1641
+ {
1642
+ "name": "Saint Lucia",
1643
+ "alpha-2": "LC",
1644
+ "alpha-3": "LCA",
1645
+ "country-code": "662"
1646
+ },
1647
+ {
1648
+ "name": "Saint Martin (French part)",
1649
+ "alpha-2": "MF",
1650
+ "alpha-3": "MAF",
1651
+ "country-code": "663"
1652
+ },
1653
+ {
1654
+ "name": "Saint Pierre and Miquelon",
1655
+ "alpha-2": "PM",
1656
+ "alpha-3": "SPM",
1657
+ "country-code": "666"
1658
+ },
1659
+ {
1660
+ "name": "Saint Vincent and the Grenadines",
1661
+ "alpha-2": "VC",
1662
+ "alpha-3": "VCT",
1663
+ "country-code": "670"
1664
+ },
1665
+ {
1666
+ "name": "Samoa",
1667
+ "alpha-2": "WS",
1668
+ "alpha-3": "WSM",
1669
+ "country-code": "882"
1670
+ },
1671
+ {
1672
+ "name": "San Marino",
1673
+ "alpha-2": "SM",
1674
+ "alpha-3": "SMR",
1675
+ "country-code": "674"
1676
+ },
1677
+ {
1678
+ "name": "Sao Tome and Principe",
1679
+ "alpha-2": "ST",
1680
+ "alpha-3": "STP",
1681
+ "country-code": "678"
1682
+ },
1683
+ {
1684
+ "name": "Saudi Arabia",
1685
+ "alpha-2": "SA",
1686
+ "alpha-3": "SAU",
1687
+ "country-code": "682"
1688
+ },
1689
+ {
1690
+ "name": "Senegal",
1691
+ "alpha-2": "SN",
1692
+ "alpha-3": "SEN",
1693
+ "country-code": "686"
1694
+ },
1695
+ {
1696
+ "name": "Serbia",
1697
+ "alpha-2": "RS",
1698
+ "alpha-3": "SRB",
1699
+ "country-code": "688"
1700
+ },
1701
+ {
1702
+ "name": "Seychelles",
1703
+ "alpha-2": "SC",
1704
+ "alpha-3": "SYC",
1705
+ "country-code": "690"
1706
+ },
1707
+ {
1708
+ "name": "Sierra Leone",
1709
+ "alpha-2": "SL",
1710
+ "alpha-3": "SLE",
1711
+ "country-code": "694"
1712
+ },
1713
+ {
1714
+ "name": "Singapore",
1715
+ "alpha-2": "SG",
1716
+ "alpha-3": "SGP",
1717
+ "country-code": "702"
1718
+ },
1719
+ {
1720
+ "name": "Sint Maarten (Dutch part)",
1721
+ "alpha-2": "SX",
1722
+ "alpha-3": "SXM",
1723
+ "country-code": "534"
1724
+ },
1725
+ {
1726
+ "name": "Slovakia",
1727
+ "alpha-2": "SK",
1728
+ "alpha-3": "SVK",
1729
+ "country-code": "703"
1730
+ },
1731
+ {
1732
+ "name": "Slovenia",
1733
+ "alpha-2": "SI",
1734
+ "alpha-3": "SVN",
1735
+ "country-code": "705"
1736
+ },
1737
+ {
1738
+ "name": "Solomon Islands",
1739
+ "alpha-2": "SB",
1740
+ "alpha-3": "SLB",
1741
+ "country-code": "090"
1742
+ },
1743
+ {
1744
+ "name": "Somalia",
1745
+ "alpha-2": "SO",
1746
+ "alpha-3": "SOM",
1747
+ "country-code": "706"
1748
+ },
1749
+ {
1750
+ "name": "South Africa",
1751
+ "alpha-2": "ZA",
1752
+ "alpha-3": "ZAF",
1753
+ "country-code": "710"
1754
+ },
1755
+ {
1756
+ "name": "South Georgia and the South Sandwich Islands",
1757
+ "alpha-2": "GS",
1758
+ "alpha-3": "SGS",
1759
+ "country-code": "239"
1760
+ },
1761
+ {
1762
+ "name": "South Sudan",
1763
+ "alpha-2": "SS",
1764
+ "alpha-3": "SSD",
1765
+ "country-code": "728"
1766
+ },
1767
+ {
1768
+ "name": "Spain",
1769
+ "alpha-2": "ES",
1770
+ "alpha-3": "ESP",
1771
+ "country-code": "724"
1772
+ },
1773
+ {
1774
+ "name": "Sri Lanka",
1775
+ "alpha-2": "LK",
1776
+ "alpha-3": "LKA",
1777
+ "country-code": "144"
1778
+ },
1779
+ {
1780
+ "name": "Sudan",
1781
+ "alpha-2": "SD",
1782
+ "alpha-3": "SDN",
1783
+ "country-code": "729"
1784
+ },
1785
+ {
1786
+ "name": "Suriname",
1787
+ "alpha-2": "SR",
1788
+ "alpha-3": "SUR",
1789
+ "country-code": "740"
1790
+ },
1791
+ {
1792
+ "name": "Svalbard and Jan Mayen",
1793
+ "alpha-2": "SJ",
1794
+ "alpha-3": "SJM",
1795
+ "country-code": "744"
1796
+ },
1797
+ {
1798
+ "name": "Sweden",
1799
+ "alpha-2": "SE",
1800
+ "alpha-3": "SWE",
1801
+ "country-code": "752"
1802
+ },
1803
+ {
1804
+ "name": "Switzerland",
1805
+ "alpha-2": "CH",
1806
+ "alpha-3": "CHE",
1807
+ "country-code": "756"
1808
+ },
1809
+ {
1810
+ "name": "Syrian Arab Republic",
1811
+ "alpha-2": "SY",
1812
+ "alpha-3": "SYR",
1813
+ "country-code": "760"
1814
+ },
1815
+ {
1816
+ "name": "Taiwan",
1817
+ "alpha-2": "TW",
1818
+ "alpha-3": "TWN",
1819
+ "country-code": "158"
1820
+ },
1821
+ {
1822
+ "name": "Tajikistan",
1823
+ "alpha-2": "TJ",
1824
+ "alpha-3": "TJK",
1825
+ "country-code": "762"
1826
+ },
1827
+ {
1828
+ "name": "Tanzania, United Republic of",
1829
+ "alpha-2": "TZ",
1830
+ "alpha-3": "TZA",
1831
+ "country-code": "834"
1832
+ },
1833
+ {
1834
+ "name": "Thailand",
1835
+ "alpha-2": "TH",
1836
+ "alpha-3": "THA",
1837
+ "country-code": "764"
1838
+ },
1839
+ {
1840
+ "name": "Timor-Leste",
1841
+ "alpha-2": "TL",
1842
+ "alpha-3": "TLS",
1843
+ "country-code": "626"
1844
+ },
1845
+ {
1846
+ "name": "Togo",
1847
+ "alpha-2": "TG",
1848
+ "alpha-3": "TGO",
1849
+ "country-code": "768"
1850
+ },
1851
+ {
1852
+ "name": "Tokelau",
1853
+ "alpha-2": "TK",
1854
+ "alpha-3": "TKL",
1855
+ "country-code": "772"
1856
+ },
1857
+ {
1858
+ "name": "Tonga",
1859
+ "alpha-2": "TO",
1860
+ "alpha-3": "TON",
1861
+ "country-code": "776"
1862
+ },
1863
+ {
1864
+ "name": "Trinidad and Tobago",
1865
+ "alpha-2": "TT",
1866
+ "alpha-3": "TTO",
1867
+ "country-code": "780"
1868
+ },
1869
+ {
1870
+ "name": "Tunisia",
1871
+ "alpha-2": "TN",
1872
+ "alpha-3": "TUN",
1873
+ "country-code": "788"
1874
+ },
1875
+ {
1876
+ "name": "Turkey",
1877
+ "alpha-2": "TR",
1878
+ "alpha-3": "TUR",
1879
+ "country-code": "792"
1880
+ },
1881
+ {
1882
+ "name": "Turkmenistan",
1883
+ "alpha-2": "TM",
1884
+ "alpha-3": "TKM",
1885
+ "country-code": "795"
1886
+ },
1887
+ {
1888
+ "name": "Turks and Caicos Islands",
1889
+ "alpha-2": "TC",
1890
+ "alpha-3": "TCA",
1891
+ "country-code": "796"
1892
+ },
1893
+ {
1894
+ "name": "Tuvalu",
1895
+ "alpha-2": "TV",
1896
+ "alpha-3": "TUV",
1897
+ "country-code": "798"
1898
+ },
1899
+ {
1900
+ "name": "Uganda",
1901
+ "alpha-2": "UG",
1902
+ "alpha-3": "UGA",
1903
+ "country-code": "800"
1904
+ },
1905
+ {
1906
+ "name": "Ukraine",
1907
+ "alpha-2": "UA",
1908
+ "alpha-3": "UKR",
1909
+ "country-code": "804"
1910
+ },
1911
+ {
1912
+ "name": "United Arab Emirates",
1913
+ "alpha-2": "AE",
1914
+ "alpha-3": "ARE",
1915
+ "country-code": "784"
1916
+ },
1917
+ {
1918
+ "name": "United Kingdom",
1919
+ "alpha-2": "GB",
1920
+ "alpha-3": "GBR",
1921
+ "country-code": "826"
1922
+ },
1923
+ {
1924
+ "name": "America",
1925
+ "alpha-2": "US",
1926
+ "alpha-3": "USA",
1927
+ "country-code": "840"
1928
+ },
1929
+ {
1930
+ "name": "United States Minor Outlying Islands",
1931
+ "alpha-2": "UM",
1932
+ "alpha-3": "UMI",
1933
+ "country-code": "581"
1934
+ },
1935
+ {
1936
+ "name": "Uruguay",
1937
+ "alpha-2": "UY",
1938
+ "alpha-3": "URY",
1939
+ "country-code": "858"
1940
+ },
1941
+ {
1942
+ "name": "Uzbekistan",
1943
+ "alpha-2": "UZ",
1944
+ "alpha-3": "UZB",
1945
+ "country-code": "860"
1946
+ },
1947
+ {
1948
+ "name": "Vanuatu",
1949
+ "alpha-2": "VU",
1950
+ "alpha-3": "VUT",
1951
+ "country-code": "548"
1952
+ },
1953
+ {
1954
+ "name": "Venezuela (Bolivarian Republic of)",
1955
+ "alpha-2": "VE",
1956
+ "alpha-3": "VEN",
1957
+ "country-code": "862"
1958
+ },
1959
+ {
1960
+ "name": "Vietnam",
1961
+ "alpha-2": "VN",
1962
+ "alpha-3": "VNM",
1963
+ "country-code": "704"
1964
+ },
1965
+ {
1966
+ "name": "Virgin Islands (British)",
1967
+ "alpha-2": "VG",
1968
+ "alpha-3": "VGB",
1969
+ "country-code": "092"
1970
+ },
1971
+ {
1972
+ "name": "Virgin Islands (U.S.)",
1973
+ "alpha-2": "VI",
1974
+ "alpha-3": "VIR",
1975
+ "country-code": "850"
1976
+ },
1977
+ {
1978
+ "name": "Wallis and Futuna",
1979
+ "alpha-2": "WF",
1980
+ "alpha-3": "WLF",
1981
+ "country-code": "876"
1982
+ },
1983
+ {
1984
+ "name": "Western Sahara",
1985
+ "alpha-2": "EH",
1986
+ "alpha-3": "ESH",
1987
+ "country-code": "732"
1988
+ },
1989
+ {
1990
+ "name": "Yemen",
1991
+ "alpha-2": "YE",
1992
+ "alpha-3": "YEM",
1993
+ "country-code": "887"
1994
+ },
1995
+ {
1996
+ "name": "Zambia",
1997
+ "alpha-2": "ZM",
1998
+ "alpha-3": "ZMB",
1999
+ "country-code": "894"
2000
+ },
2001
+ {
2002
+ "name": "Zimbabwe",
2003
+ "alpha-2": "ZW",
2004
+ "alpha-3": "ZWE",
2005
+ "country-code": "716"
2006
+ }
2007
+ ];
2008
+ const SearchTypes = {
2009
+ WEB: "web",
2010
+ IMAGE: "image",
2011
+ VIDEO: "video",
2012
+ NEWS: "news",
2013
+ DISCOVER: "discover",
2014
+ GOOGLE_NEWS: "googleNews"
2015
+ };
2016
+ Object.fromEntries(countries_default.map((c) => [c["alpha-3"], c["alpha-3"].toLowerCase()]));
256
2017
  const DATE_OPERATORS = [
257
2018
  "gte",
258
2019
  "gt",
@@ -281,6 +2042,7 @@ function isSpecialOperator(op) {
281
2042
  function isQueryParam(value) {
282
2043
  return QUERY_PARAMS.includes(value);
283
2044
  }
2045
+ new Set(Object.values(SearchTypes));
284
2046
  function extractSpecialFilters(filter) {
285
2047
  if (!filter) return {};
286
2048
  let startDate;
@@ -704,160 +2466,6 @@ function googleSearchConsole(auth, options = {}) {
704
2466
  _rawQuery: rawQuery
705
2467
  };
706
2468
  }
707
- const GSC_QUOTAS = {
708
- searchAnalytics: 25e3,
709
- urlInspection: 2e3,
710
- indexing: 200
711
- };
712
- function pickField(error, paths, is) {
713
- if (!error || typeof error !== "object") return void 0;
714
- for (const path of paths) {
715
- let current = error;
716
- for (const key of path) {
717
- if (!current || typeof current !== "object") {
718
- current = void 0;
719
- break;
720
- }
721
- current = current[key];
722
- }
723
- if (is(current)) return current;
724
- }
725
- }
726
- const isNumber = (v) => typeof v === "number";
727
- const isString = (v) => typeof v === "string";
728
- function extractStatus(error) {
729
- return pickField(error, [
730
- ["statusCode"],
731
- ["status"],
732
- ["response", "status"],
733
- ["code"]
734
- ], isNumber);
735
- }
736
- function extractMessage(error) {
737
- if (!error) return "Unknown error";
738
- if (typeof error === "string") return error;
739
- if (error instanceof Error) return error.message;
740
- if (typeof error !== "object") return String(error);
741
- return pickField(error, [
742
- [
743
- "data",
744
- "error",
745
- "message"
746
- ],
747
- ["message"],
748
- ["statusMessage"]
749
- ], isString) ?? String(error);
750
- }
751
- function extractRetryAfter(error) {
752
- const raw = pickField(error, [
753
- ["headers", "retry-after"],
754
- ["headers", "Retry-After"],
755
- [
756
- "response",
757
- "headers",
758
- "retry-after"
759
- ],
760
- [
761
- "response",
762
- "headers",
763
- "Retry-After"
764
- ]
765
- ], (v) => typeof v === "number" || typeof v === "string");
766
- if (typeof raw === "number") return raw;
767
- if (typeof raw === "string") {
768
- const seconds = Number.parseInt(raw, 10);
769
- return Number.isNaN(seconds) ? void 0 : seconds;
770
- }
771
- }
772
- const QUOTA_MESSAGE_RE = /quota|rate\s*limit/i;
773
- function classifyError(cause) {
774
- const status = extractStatus(cause);
775
- const message = extractMessage(cause);
776
- if (status === 401) return {
777
- kind: "auth-expired",
778
- message,
779
- cause
780
- };
781
- if (status === 429) return {
782
- kind: "rate-limited",
783
- message,
784
- retryAfter: extractRetryAfter(cause),
785
- cause
786
- };
787
- if (status === 403) {
788
- if (QUOTA_MESSAGE_RE.test(message)) return {
789
- kind: "rate-limited",
790
- message,
791
- retryAfter: extractRetryAfter(cause),
792
- cause
793
- };
794
- return {
795
- kind: "auth-expired",
796
- message,
797
- cause
798
- };
799
- }
800
- if (status === 404) return {
801
- kind: "not-found",
802
- message,
803
- cause
804
- };
805
- if (status === 400 || status === 422) return {
806
- kind: "validation",
807
- message,
808
- cause
809
- };
810
- return {
811
- kind: "transport",
812
- message,
813
- status,
814
- cause
815
- };
816
- }
817
- function storageError(message, cause) {
818
- return {
819
- kind: "storage",
820
- message,
821
- cause
822
- };
823
- }
824
- const PERMISSION_SIGNALS = [
825
- "403 forbidden",
826
- "permission_denied",
827
- "does not have sufficient permission",
828
- "insufficient permission"
829
- ];
830
- function isPermissionDeniedError(err) {
831
- const msg = String(err?.message ?? err ?? "").toLowerCase();
832
- return PERMISSION_SIGNALS.some((s) => msg.includes(s));
833
- }
834
- function suggestionFor(err) {
835
- switch (err.kind) {
836
- case "auth-expired": return "Run `gscdump auth` to re-authenticate.";
837
- case "rate-limited": {
838
- const retryIn = err.retryAfter ? `${err.retryAfter}s` : "a few minutes";
839
- if (QUOTA_MESSAGE_RE.test(err.message)) {
840
- if (err.message.includes("Indexing API")) return `Indexing API quota exhausted (~${GSC_QUOTAS.indexing}/day). Try again tomorrow.`;
841
- return `Quota or rate limit hit (Search Analytics ~${GSC_QUOTAS.searchAnalytics}/day). Try again in ${retryIn}.`;
842
- }
843
- return `Rate limited. Slow down requests. Try again in ${retryIn}.`;
844
- }
845
- case "not-found":
846
- case "validation":
847
- case "storage":
848
- case "transport": return "";
849
- }
850
- }
851
- function formatErrorForCli(cause) {
852
- const err = classifyError(cause);
853
- const lines = [`\x1B[31m${err.message}\x1B[0m`];
854
- const suggestion = suggestionFor(err);
855
- if (suggestion) {
856
- lines.push("");
857
- lines.push(suggestion);
858
- }
859
- return lines.join("\n");
860
- }
861
2469
  const INDEXING_ISSUE_FILTERS = {
862
2470
  canonical_mismatch: `user_canonical IS NOT NULL AND google_canonical IS NOT NULL AND user_canonical != google_canonical`,
863
2471
  stale_crawl: `last_crawl_time < datetime('now', '-30 days')`,
@@ -918,6 +2526,97 @@ const INDEXING_ISSUE_SEVERITY = {
918
2526
  rich_results_warning: "warning",
919
2527
  rich_results_pass: "info"
920
2528
  };
2529
+ const SCHEME_RE = /^(sc-domain:|https?:\/\/)/;
2530
+ function parseGscSiteUrl(siteUrl) {
2531
+ const isDomain = siteUrl.startsWith("sc-domain:");
2532
+ let hostname = siteUrl;
2533
+ if (isDomain) hostname = siteUrl.slice(10);
2534
+ else try {
2535
+ hostname = new URL(siteUrl).hostname;
2536
+ } catch {
2537
+ hostname = siteUrl;
2538
+ }
2539
+ const displayLabel = siteUrl.replace(SCHEME_RE, "").replace(/\/$/, "");
2540
+ return {
2541
+ label: siteUrl,
2542
+ hostname,
2543
+ displayLabel,
2544
+ propertyType: isDomain ? "domain" : "url-prefix",
2545
+ isDomain
2546
+ };
2547
+ }
2548
+ function normalizeRegistrationTarget(inputUrl) {
2549
+ const trimmed = inputUrl.trim();
2550
+ if (!trimmed) return null;
2551
+ const inputParsed = parseGscSiteUrl(trimmed);
2552
+ if (inputParsed.isDomain) return inputParsed.hostname.toLowerCase();
2553
+ return trimmed.match(/^(?:https?:\/\/)?([^/]+)/)?.[1]?.toLowerCase() ?? null;
2554
+ }
2555
+ const VERIFIED_PERMISSIONS = new Set([
2556
+ "siteOwner",
2557
+ "siteFullUser",
2558
+ "siteRestrictedUser"
2559
+ ]);
2560
+ function isVerifiedGscProperty(property) {
2561
+ return !!property?.permissionLevel && VERIFIED_PERMISSIONS.has(property.permissionLevel);
2562
+ }
2563
+ function isVerifiedGscPermission(level) {
2564
+ return !!level && VERIFIED_PERMISSIONS.has(level);
2565
+ }
2566
+ const stripWww = (d) => d.replace(/^www\./, "");
2567
+ function gscPropertyMatchesTarget(targetDomain, propertyUrl) {
2568
+ if (!propertyUrl) return false;
2569
+ const cleanTarget = stripWww(targetDomain);
2570
+ const parsed = parseGscSiteUrl(propertyUrl);
2571
+ if (parsed.isDomain) return cleanTarget === parsed.hostname || cleanTarget.endsWith(`.${parsed.hostname}`);
2572
+ const match = propertyUrl.match(/^https?:\/\/([^/]+)/);
2573
+ return !!match && stripWww(match[1].toLowerCase()) === cleanTarget;
2574
+ }
2575
+ function matchGscSite(siteUrl, gscSiteUrl) {
2576
+ if (!siteUrl || !gscSiteUrl) return false;
2577
+ const getHostname = (url) => {
2578
+ if (url.startsWith("sc-domain:")) return url.replace("sc-domain:", "");
2579
+ try {
2580
+ return new URL(url).hostname;
2581
+ } catch {
2582
+ return url;
2583
+ }
2584
+ };
2585
+ return gscPropertyMatchesTarget(getHostname(siteUrl), gscSiteUrl);
2586
+ }
2587
+ function pickBestGscProperty(origin, availableSites) {
2588
+ const matches = availableSites.filter((p) => matchGscSite(origin, p.siteUrl));
2589
+ if (!matches.length) return void 0;
2590
+ const isDomain = (p) => !!p.siteUrl?.startsWith("sc-domain:");
2591
+ const verified = matches.filter((p) => isVerifiedGscPermission(p.permissionLevel));
2592
+ const pool = verified.length ? verified : matches;
2593
+ return pool.find(isDomain) ?? pool[0];
2594
+ }
2595
+ function findBestGscProperty(targetDomain, properties) {
2596
+ const cleanTarget = stripWww(targetDomain);
2597
+ const domainProperty = properties.find((property) => {
2598
+ if (!property.siteUrl) return false;
2599
+ const parsed = parseGscSiteUrl(property.siteUrl);
2600
+ if (!parsed.isDomain) return false;
2601
+ return cleanTarget === parsed.hostname || cleanTarget.endsWith(`.${parsed.hostname}`);
2602
+ });
2603
+ const urlProperty = properties.find((property) => {
2604
+ if (!property.siteUrl) return false;
2605
+ const match = property.siteUrl.match(/^https?:\/\/([^/]+)/);
2606
+ return match && stripWww(match[1].toLowerCase()) === cleanTarget;
2607
+ });
2608
+ return {
2609
+ matchedSite: (isVerifiedGscProperty(domainProperty) ? domainProperty : isVerifiedGscProperty(urlProperty) ? urlProperty : domainProperty || urlProperty) ?? null,
2610
+ domainProperty: domainProperty ?? null,
2611
+ urlProperty: urlProperty ?? null
2612
+ };
2613
+ }
2614
+ function findExactGscProperty(propertyUrl, properties) {
2615
+ return properties.find((property) => property.siteUrl === propertyUrl) ?? null;
2616
+ }
2617
+ function formatGscPropertyCandidates(candidates) {
2618
+ return candidates.filter((c) => !!c).map((property) => `${property.siteUrl} (${property.permissionLevel})`).join(", ");
2619
+ }
921
2620
  const INDEXING_DAILY_LIMIT = 2e3;
922
2621
  const INDEXING_EFFECTIVE_LIMIT = 1800;
923
2622
  function hasGscReadScope(scopes) {
@@ -1120,4 +2819,4 @@ async function fetchSitemapUrls(sitemapUrl, options = {}) {
1120
2819
  await visit(sitemapUrl, 0);
1121
2820
  return out;
1122
2821
  }
1123
- export { DAYS_PER_RANGE, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_QUOTAS, GSC_RETENTION_MONTHS, INDEXING_DAILY_LIMIT, INDEXING_EFFECTIVE_LIMIT, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, MS_PER_DAY, accountNextActions, accountStatuses, addDays, addSite, analyticsNextActions, analyticsStatuses, batchInspectUrls, batchRequestIndexing, classifyError, countDays, createAuth, createFetch, daysAgo, deleteSite, deleteSitemap, discoverSitemap, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, formatErrorForCli, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingMetadata, getLatestGscDate, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, groupIntoRanges, gscdumpApi, hasGscReadScope, hasGscWriteScope, hasIndexingScope, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, inspectUrl, isPermissionDeniedError, isValidGscDate, lifecycleErrorCodes, lifecycleWebhookEvents, listVerifiedSites, parseGrantedScopes, progressBar, propertyNextActions, propertyStatuses, querySourceModes, requestIndexing, rowWithMetricDefaults, runSequentialBatch, siteUrlToVerificationSite, sitemapNextActions, sitemapStatuses, storageError, submitSitemap, toIsoDate, unverifySite, verificationMethodsFor, verifySite };
2822
+ export { DAYS_PER_RANGE, GSCDUMP_ONBOARDING_CONTRACT_VERSION, GSCDUMP_OPTIONAL_INDEXING_SCOPE, GSCDUMP_REQUIRED_ANALYTICS_SCOPE, GSC_FINALIZED_LAG_DAYS, GSC_FRESHEST_LAG_DAYS, GSC_QUOTAS, GSC_RETENTION_MONTHS, GscApiError, INDEXING_DAILY_LIMIT, INDEXING_EFFECTIVE_LIMIT, INDEXING_ISSUE_FILTERS, INDEXING_ISSUE_LABELS, INDEXING_ISSUE_SEVERITY, MS_PER_DAY, accountNextActions, accountStatuses, addDays, addSite, analyticsNextActions, analyticsStatuses, batchInspectUrls, batchRequestIndexing, classifyError, countDays, createAuth, createFetch, daysAgo, deleteSite, deleteSitemap, discoverSitemap, exchangeAuthCode, fetchSitemap, fetchSitemapUrls, fetchSitemaps, fetchSites, fetchSitesWithSitemaps, findBestGscProperty, findExactGscProperty, formatErrorForCli, formatGscPropertyCandidates, generateGscDateRange, getBackfillProgress, getDateRange, getFreshestGscDate, getIndexingMetadata, getLatestGscDate, getNextDate, getOldestGscDate, getPendingDates, getPreviousDate, getPstDate, getVerificationToken, getVerifiedSite, googleSearchConsole, groupIntoRanges, gscPropertyMatchesTarget, gscdumpApi, hasGscReadScope, hasGscWriteScope, hasIndexingScope, hasOptionalIndexingScope, hasRequiredAnalyticsScope, indexingNextActions, indexingStatuses, inspectUrl, isPermissionDeniedError, isValidGscDate, isVerifiedGscPermission, isVerifiedGscProperty, lifecycleErrorCodes, lifecycleWebhookEvents, listVerifiedSites, matchGscSite, normalizeRegistrationTarget, parseGoogleError, parseGrantedScopes, parseGscSiteUrl, pickBestGscProperty, progressBar, propertyNextActions, propertyStatuses, querySourceModes, refreshAccessToken, requestIndexing, rethrowAsGscApiError, rowWithMetricDefaults, runSequentialBatch, siteUrlToVerificationSite, sitemapNextActions, sitemapStatuses, storageError, submitSitemap, toIsoDate, unverifySite, verificationMethodsFor, verifySite };