semrush-cli 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { Schema } from "effect";
2
2
 
3
3
  //#region package.json
4
- var version$1 = "0.1.1";
4
+ var version$1 = "0.3.0";
5
5
 
6
6
  //#endregion
7
7
  //#region src/report-catalog.json
@@ -17,7 +17,10 @@ var report_catalog_default = {
17
17
  "properties": {},
18
18
  "title": "EmptyQuery",
19
19
  "type": "object"
20
- }
20
+ },
21
+ "mutation": false,
22
+ "destructive": false,
23
+ "http_method": ""
21
24
  },
22
25
  keyword_overview: {
23
26
  "method": "keywords.GetInfo",
@@ -44,7 +47,10 @@ var report_catalog_default = {
44
47
  "required": ["keyword"],
45
48
  "title": "KeywordQuery",
46
49
  "type": "object"
47
- }
50
+ },
51
+ "mutation": false,
52
+ "destructive": false,
53
+ "http_method": ""
48
54
  },
49
55
  keyword_ideas: {
50
56
  "method": "ideas.GetKeywords",
@@ -83,7 +89,10 @@ var report_catalog_default = {
83
89
  "required": ["keyword"],
84
90
  "title": "IdeasQuery",
85
91
  "type": "object"
86
- }
92
+ },
93
+ "mutation": false,
94
+ "destructive": false,
95
+ "http_method": ""
87
96
  },
88
97
  keyword_ideas_summary: {
89
98
  "method": "ideas.GetKeywordsSummary",
@@ -115,7 +124,10 @@ var report_catalog_default = {
115
124
  "required": ["keyword"],
116
125
  "title": "IdeasSummaryQuery",
117
126
  "type": "object"
118
- }
127
+ },
128
+ "mutation": false,
129
+ "destructive": false,
130
+ "http_method": ""
119
131
  },
120
132
  keyword_serp: {
121
133
  "method": "serp.GetURLs",
@@ -149,7 +161,10 @@ var report_catalog_default = {
149
161
  "required": ["keyword"],
150
162
  "title": "KeywordListQuery",
151
163
  "type": "object"
152
- }
164
+ },
165
+ "mutation": false,
166
+ "destructive": false,
167
+ "http_method": ""
153
168
  },
154
169
  keyword_ads: {
155
170
  "method": "adwords.GetCopies",
@@ -183,7 +198,10 @@ var report_catalog_default = {
183
198
  "required": ["keyword"],
184
199
  "title": "KeywordListQuery",
185
200
  "type": "object"
186
- }
201
+ },
202
+ "mutation": false,
203
+ "destructive": false,
204
+ "http_method": ""
187
205
  },
188
206
  keyword_clusters: {
189
207
  "method": "clusters.Get",
@@ -210,7 +228,10 @@ var report_catalog_default = {
210
228
  "required": ["keyword"],
211
229
  "title": "KeywordQuery",
212
230
  "type": "object"
213
- }
231
+ },
232
+ "mutation": false,
233
+ "destructive": false,
234
+ "http_method": ""
214
235
  },
215
236
  keyword_magic: {
216
237
  "method": "ideas.GetKeywords",
@@ -291,7 +312,10 @@ var report_catalog_default = {
291
312
  "required": ["keyword"],
292
313
  "title": "MagicQuery",
293
314
  "type": "object"
294
- }
315
+ },
316
+ "mutation": false,
317
+ "destructive": false,
318
+ "http_method": ""
295
319
  },
296
320
  keyword_magic_summary: {
297
321
  "method": "ideas.GetKeywordsSummary",
@@ -359,7 +383,10 @@ var report_catalog_default = {
359
383
  "required": ["keyword"],
360
384
  "title": "MagicSummaryQuery",
361
385
  "type": "object"
362
- }
386
+ },
387
+ "mutation": false,
388
+ "destructive": false,
389
+ "http_method": ""
363
390
  },
364
391
  keyword_magic_groups: {
365
392
  "method": "ideas.GetGroups",
@@ -440,7 +467,10 @@ var report_catalog_default = {
440
467
  "required": ["keyword"],
441
468
  "title": "MagicQuery",
442
469
  "type": "object"
443
- }
470
+ },
471
+ "mutation": false,
472
+ "destructive": false,
473
+ "http_method": ""
444
474
  },
445
475
  domain_overview: {
446
476
  "method": "organic.Summary",
@@ -468,7 +498,10 @@ var report_catalog_default = {
468
498
  "required": ["domain"],
469
499
  "title": "DomainQuery",
470
500
  "type": "object"
471
- }
501
+ },
502
+ "mutation": false,
503
+ "destructive": false,
504
+ "http_method": ""
472
505
  },
473
506
  domain_keywords: {
474
507
  "method": "organic.Positions",
@@ -547,7 +580,10 @@ var report_catalog_default = {
547
580
  "required": ["domain"],
548
581
  "title": "DomainReportQuery",
549
582
  "type": "object"
550
- }
583
+ },
584
+ "mutation": false,
585
+ "destructive": false,
586
+ "http_method": ""
551
587
  },
552
588
  domain_pages: {
553
589
  "method": "organic.PagesV3",
@@ -626,7 +662,10 @@ var report_catalog_default = {
626
662
  "required": ["domain"],
627
663
  "title": "DomainPagesQuery",
628
664
  "type": "object"
629
- }
665
+ },
666
+ "mutation": false,
667
+ "destructive": false,
668
+ "http_method": ""
630
669
  },
631
670
  domain_subdomains: {
632
671
  "method": "organic.Subdomains",
@@ -705,7 +744,10 @@ var report_catalog_default = {
705
744
  "required": ["domain"],
706
745
  "title": "DomainPagesQuery",
707
746
  "type": "object"
708
- }
747
+ },
748
+ "mutation": false,
749
+ "destructive": false,
750
+ "http_method": ""
709
751
  },
710
752
  domain_position_changes: {
711
753
  "method": "organic.PositionChangesV2",
@@ -784,7 +826,10 @@ var report_catalog_default = {
784
826
  "required": ["domain"],
785
827
  "title": "DomainChangesQuery",
786
828
  "type": "object"
787
- }
829
+ },
830
+ "mutation": false,
831
+ "destructive": false,
832
+ "http_method": ""
788
833
  },
789
834
  domain_competitors: {
790
835
  "method": "organic.Competitors",
@@ -857,7 +902,10 @@ var report_catalog_default = {
857
902
  "required": ["domain"],
858
903
  "title": "DomainCompetitorsQuery",
859
904
  "type": "object"
860
- }
905
+ },
906
+ "mutation": false,
907
+ "destructive": false,
908
+ "http_method": ""
861
909
  },
862
910
  domain_backlinks: {
863
911
  "method": "backlinks.Overview",
@@ -877,7 +925,10 @@ var report_catalog_default = {
877
925
  "required": ["domain"],
878
926
  "title": "DomainIdentityQuery",
879
927
  "type": "object"
880
- }
928
+ },
929
+ "mutation": false,
930
+ "destructive": false,
931
+ "http_method": ""
881
932
  },
882
933
  domain_ai_visibility: {
883
934
  "method": "organic.AiSeoSummary",
@@ -897,7 +948,10 @@ var report_catalog_default = {
897
948
  "required": ["domain"],
898
949
  "title": "DomainIdentityQuery",
899
950
  "type": "object"
900
- }
951
+ },
952
+ "mutation": false,
953
+ "destructive": false,
954
+ "http_method": ""
901
955
  },
902
956
  domain_ai_countries: {
903
957
  "method": "organic.AiDistributionByCountry",
@@ -917,7 +971,10 @@ var report_catalog_default = {
917
971
  "required": ["domain"],
918
972
  "title": "DomainIdentityQuery",
919
973
  "type": "object"
920
- }
974
+ },
975
+ "mutation": false,
976
+ "destructive": false,
977
+ "http_method": ""
921
978
  },
922
979
  domain_ai_sources: {
923
980
  "method": "organic.AiTopSources",
@@ -958,7 +1015,10 @@ var report_catalog_default = {
958
1015
  "required": ["domain"],
959
1016
  "title": "AiSourcesQuery",
960
1017
  "type": "object"
961
- }
1018
+ },
1019
+ "mutation": false,
1020
+ "destructive": false,
1021
+ "http_method": ""
962
1022
  },
963
1023
  domain_trends: {
964
1024
  "method": "organic.OverviewTrend",
@@ -997,7 +1057,10 @@ var report_catalog_default = {
997
1057
  "required": ["domain"],
998
1058
  "title": "DomainTrendQuery",
999
1059
  "type": "object"
1000
- }
1060
+ },
1061
+ "mutation": false,
1062
+ "destructive": false,
1063
+ "http_method": ""
1001
1064
  },
1002
1065
  domain_paid_keywords: {
1003
1066
  "method": "adwords.PositionsOverview",
@@ -1032,7 +1095,10 @@ var report_catalog_default = {
1032
1095
  "required": ["domain"],
1033
1096
  "title": "DomainListQuery",
1034
1097
  "type": "object"
1035
- }
1098
+ },
1099
+ "mutation": false,
1100
+ "destructive": false,
1101
+ "http_method": ""
1036
1102
  },
1037
1103
  domain_paid_competitors: {
1038
1104
  "method": "adwords.CompetitorsOverview",
@@ -1067,7 +1133,10 @@ var report_catalog_default = {
1067
1133
  "required": ["domain"],
1068
1134
  "title": "DomainListQuery",
1069
1135
  "type": "object"
1070
- }
1136
+ },
1137
+ "mutation": false,
1138
+ "destructive": false,
1139
+ "http_method": ""
1071
1140
  },
1072
1141
  domain_topics: {
1073
1142
  "method": "organic.TopicsResult",
@@ -1095,7 +1164,10 @@ var report_catalog_default = {
1095
1164
  "required": ["domain"],
1096
1165
  "title": "DomainQuery",
1097
1166
  "type": "object"
1098
- }
1167
+ },
1168
+ "mutation": false,
1169
+ "destructive": false,
1170
+ "http_method": ""
1099
1171
  },
1100
1172
  domain_topics_status: {
1101
1173
  "method": "organic.TopicsStatus",
@@ -1123,7 +1195,10 @@ var report_catalog_default = {
1123
1195
  "required": ["domain"],
1124
1196
  "title": "DomainQuery",
1125
1197
  "type": "object"
1126
- }
1198
+ },
1199
+ "mutation": false,
1200
+ "destructive": false,
1201
+ "http_method": ""
1127
1202
  },
1128
1203
  databases: {
1129
1204
  "method": "user.Databases",
@@ -1136,7 +1211,10 @@ var report_catalog_default = {
1136
1211
  "properties": {},
1137
1212
  "title": "EmptyQuery",
1138
1213
  "type": "object"
1139
- }
1214
+ },
1215
+ "mutation": false,
1216
+ "destructive": false,
1217
+ "http_method": ""
1140
1218
  },
1141
1219
  snapshot_dates: {
1142
1220
  "method": "organic.SnapshotDates",
@@ -1161,7 +1239,10 @@ var report_catalog_default = {
1161
1239
  },
1162
1240
  "title": "HistoryQuery",
1163
1241
  "type": "object"
1164
- }
1242
+ },
1243
+ "mutation": false,
1244
+ "destructive": false,
1245
+ "http_method": ""
1165
1246
  },
1166
1247
  report_permissions: {
1167
1248
  "method": "dpa.UserPermissions",
@@ -1179,7 +1260,10 @@ var report_catalog_default = {
1179
1260
  } },
1180
1261
  "title": "DatabaseQuery",
1181
1262
  "type": "object"
1182
- }
1263
+ },
1264
+ "mutation": false,
1265
+ "destructive": false,
1266
+ "http_method": ""
1183
1267
  },
1184
1268
  backlink_links: {
1185
1269
  "method": "backlinks",
@@ -1230,7 +1314,10 @@ var report_catalog_default = {
1230
1314
  "required": ["domain"],
1231
1315
  "title": "BacklinkListQuery",
1232
1316
  "type": "object"
1233
- }
1317
+ },
1318
+ "mutation": false,
1319
+ "destructive": false,
1320
+ "http_method": ""
1234
1321
  },
1235
1322
  backlink_referring_domains: {
1236
1323
  "method": "backlinks_refdomains",
@@ -1281,7 +1368,10 @@ var report_catalog_default = {
1281
1368
  "required": ["domain"],
1282
1369
  "title": "BacklinkListQuery",
1283
1370
  "type": "object"
1284
- }
1371
+ },
1372
+ "mutation": false,
1373
+ "destructive": false,
1374
+ "http_method": ""
1285
1375
  },
1286
1376
  backlink_history: {
1287
1377
  "method": "historical",
@@ -1308,7 +1398,10 @@ var report_catalog_default = {
1308
1398
  "required": ["domain"],
1309
1399
  "title": "BacklinkQuery",
1310
1400
  "type": "object"
1311
- }
1401
+ },
1402
+ "mutation": false,
1403
+ "destructive": false,
1404
+ "http_method": ""
1312
1405
  },
1313
1406
  backlink_competitors: {
1314
1407
  "method": "competitors",
@@ -1335,7 +1428,10 @@ var report_catalog_default = {
1335
1428
  "required": ["domain"],
1336
1429
  "title": "BacklinkQuery",
1337
1430
  "type": "object"
1338
- }
1431
+ },
1432
+ "mutation": false,
1433
+ "destructive": false,
1434
+ "http_method": ""
1339
1435
  },
1340
1436
  backlink_top_pages: {
1341
1437
  "method": "backlinks_pages",
@@ -1386,7 +1482,10 @@ var report_catalog_default = {
1386
1482
  "required": ["domain"],
1387
1483
  "title": "BacklinkListQuery",
1388
1484
  "type": "object"
1389
- }
1485
+ },
1486
+ "mutation": false,
1487
+ "destructive": false,
1488
+ "http_method": ""
1390
1489
  },
1391
1490
  backlink_anchors: {
1392
1491
  "method": "backlinks_anchors",
@@ -1437,7 +1536,10 @@ var report_catalog_default = {
1437
1536
  "required": ["domain"],
1438
1537
  "title": "BacklinkListQuery",
1439
1538
  "type": "object"
1440
- }
1539
+ },
1540
+ "mutation": false,
1541
+ "destructive": false,
1542
+ "http_method": ""
1441
1543
  },
1442
1544
  backlink_outgoing_domains: {
1443
1545
  "method": "backlinks_outgoing_domains",
@@ -1488,7 +1590,10 @@ var report_catalog_default = {
1488
1590
  "required": ["domain"],
1489
1591
  "title": "BacklinkListQuery",
1490
1592
  "type": "object"
1491
- }
1593
+ },
1594
+ "mutation": false,
1595
+ "destructive": false,
1596
+ "http_method": ""
1492
1597
  },
1493
1598
  backlink_countries: {
1494
1599
  "method": "geodomains",
@@ -1515,7 +1620,10 @@ var report_catalog_default = {
1515
1620
  "required": ["domain"],
1516
1621
  "title": "BacklinkQuery",
1517
1622
  "type": "object"
1518
- }
1623
+ },
1624
+ "mutation": false,
1625
+ "destructive": false,
1626
+ "http_method": ""
1519
1627
  },
1520
1628
  backlink_authority: {
1521
1629
  "method": "ascore",
@@ -1542,7 +1650,10 @@ var report_catalog_default = {
1542
1650
  "required": ["domain"],
1543
1651
  "title": "BacklinkQuery",
1544
1652
  "type": "object"
1545
- }
1653
+ },
1654
+ "mutation": false,
1655
+ "destructive": false,
1656
+ "http_method": ""
1546
1657
  },
1547
1658
  backlink_categories: {
1548
1659
  "method": "category-profile",
@@ -1569,7 +1680,10 @@ var report_catalog_default = {
1569
1680
  "required": ["domain"],
1570
1681
  "title": "BacklinkQuery",
1571
1682
  "type": "object"
1572
- }
1683
+ },
1684
+ "mutation": false,
1685
+ "destructive": false,
1686
+ "http_method": ""
1573
1687
  },
1574
1688
  keyword_gap: {
1575
1689
  "method": "/spectrum/v1/Gap/KeywordsList",
@@ -1625,7 +1739,10 @@ var report_catalog_default = {
1625
1739
  "required": ["domains"],
1626
1740
  "title": "GapQuery",
1627
1741
  "type": "object"
1628
- }
1742
+ },
1743
+ "mutation": false,
1744
+ "destructive": false,
1745
+ "http_method": ""
1629
1746
  },
1630
1747
  keyword_gap_totals: {
1631
1748
  "method": "/spectrum/v1/Gap/KeywordsTotals",
@@ -1660,7 +1777,10 @@ var report_catalog_default = {
1660
1777
  "required": ["domains"],
1661
1778
  "title": "GapSummaryQuery",
1662
1779
  "type": "object"
1663
- }
1780
+ },
1781
+ "mutation": false,
1782
+ "destructive": false,
1783
+ "http_method": ""
1664
1784
  },
1665
1785
  keyword_gap_overlap: {
1666
1786
  "method": "/spectrum/v1/Gap/Overlaps",
@@ -1695,7 +1815,10 @@ var report_catalog_default = {
1695
1815
  "required": ["domains"],
1696
1816
  "title": "GapSummaryQuery",
1697
1817
  "type": "object"
1698
- }
1818
+ },
1819
+ "mutation": false,
1820
+ "destructive": false,
1821
+ "http_method": ""
1699
1822
  },
1700
1823
  backlink_gap: {
1701
1824
  "method": "backlinks_matrix",
@@ -1755,7 +1878,10 @@ var report_catalog_default = {
1755
1878
  "required": ["domains"],
1756
1879
  "title": "BacklinkGapQuery",
1757
1880
  "type": "object"
1758
- }
1881
+ },
1882
+ "mutation": false,
1883
+ "destructive": false,
1884
+ "http_method": ""
1759
1885
  },
1760
1886
  backlink_comparison: {
1761
1887
  "method": "backlinks_comparison",
@@ -1776,7 +1902,10 @@ var report_catalog_default = {
1776
1902
  "required": ["domains"],
1777
1903
  "title": "BacklinkComparisonQuery",
1778
1904
  "type": "object"
1779
- }
1905
+ },
1906
+ "mutation": false,
1907
+ "destructive": false,
1908
+ "http_method": ""
1780
1909
  },
1781
1910
  projects: {
1782
1911
  "method": "/apis/v4-raw/crossroad/api/v0/crossroad/list",
@@ -1809,7 +1938,10 @@ var report_catalog_default = {
1809
1938
  },
1810
1939
  "title": "ProjectListQuery",
1811
1940
  "type": "object"
1812
- }
1941
+ },
1942
+ "mutation": false,
1943
+ "destructive": false,
1944
+ "http_method": ""
1813
1945
  },
1814
1946
  ai_capabilities: {
1815
1947
  "method": "/ai-seo/api/v2/user/user_capabilities",
@@ -1822,7 +1954,10 @@ var report_catalog_default = {
1822
1954
  "properties": {},
1823
1955
  "title": "EmptyQuery",
1824
1956
  "type": "object"
1825
- }
1957
+ },
1958
+ "mutation": false,
1959
+ "destructive": false,
1960
+ "http_method": ""
1826
1961
  },
1827
1962
  audit_campaigns: {
1828
1963
  "method": "/siteaudit/api/campaigns/seolist",
@@ -1835,7 +1970,10 @@ var report_catalog_default = {
1835
1970
  "properties": {},
1836
1971
  "title": "EmptyQuery",
1837
1972
  "type": "object"
1838
- }
1973
+ },
1974
+ "mutation": false,
1975
+ "destructive": false,
1976
+ "http_method": ""
1839
1977
  },
1840
1978
  folders: {
1841
1979
  "method": "/apis/v4-raw/folders/api/v0/folders/selector-list",
@@ -1848,7 +1986,10 @@ var report_catalog_default = {
1848
1986
  "properties": {},
1849
1987
  "title": "EmptyQuery",
1850
1988
  "type": "object"
1851
- }
1989
+ },
1990
+ "mutation": false,
1991
+ "destructive": false,
1992
+ "http_method": ""
1852
1993
  },
1853
1994
  saved_keyword_lists: {
1854
1995
  "method": "/apis/v4-raw/saved-keywords/api/v0/list/all",
@@ -1861,124 +2002,1446 @@ var report_catalog_default = {
1861
2002
  "properties": {},
1862
2003
  "title": "EmptyQuery",
1863
2004
  "type": "object"
2005
+ },
2006
+ "mutation": false,
2007
+ "destructive": false,
2008
+ "http_method": ""
2009
+ },
2010
+ project_create: {
2011
+ "method": "/apis/v4-raw/folders/api/v0/folders",
2012
+ "description": "Create a project, optionally with a website. Does not start tools or share it.",
2013
+ "transport": "project_web",
2014
+ "total_method": "",
2015
+ "web_report": "",
2016
+ "mutation": true,
2017
+ "destructive": false,
2018
+ "http_method": "POST",
2019
+ "schema": {
2020
+ "type": "object",
2021
+ "additionalProperties": false,
2022
+ "properties": {
2023
+ "name": {
2024
+ "type": "string",
2025
+ "minLength": 1,
2026
+ "maxLength": 255,
2027
+ "pattern": "^(?=.*\\S)[^~|`!#%^&*=\\[\\]\\\\\\x27/{}\":<>?]+$",
2028
+ "description": "Project name, up to 255 characters. The web UI restricts punctuation."
2029
+ },
2030
+ "domain": {
2031
+ "type": "string",
2032
+ "minLength": 1,
2033
+ "maxLength": 253,
2034
+ "pattern": "^(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z]{2,63}$",
2035
+ "description": "Domain or subdomain, without protocol or path."
2036
+ },
2037
+ "confirm": {
2038
+ "type": "boolean",
2039
+ "default": false,
2040
+ "description": "Confirm this account mutation."
2041
+ },
2042
+ "dry_run": {
2043
+ "type": "boolean",
2044
+ "default": false,
2045
+ "description": "Print the request without sending it."
2046
+ }
2047
+ },
2048
+ "required": ["name"]
1864
2049
  }
1865
- }
1866
- };
1867
-
1868
- //#endregion
1869
- //#region src/report-parameters.ts
1870
- const backlinkSorts = new Map([
1871
- ["backlinks", "page_ascore"],
1872
- ["backlinks_refdomains", "backlinksnum"],
1873
- ["backlinks_anchors", "backlinksnum"],
1874
- ["backlinks_pages", "domainsnum"],
1875
- ["backlinks_outgoing_domains", "links_num"]
1876
- ]);
1877
- const version = version$1;
1878
- const reports = report_catalog_default;
1879
- /** Fixed request shapes observed in semrush-web-mcp. No arbitrary RPC or URL input. */
1880
- function reportParameters(definition, q) {
1881
- const family = definition.transport;
1882
- if (family === "magic") return magicParameters(definition, q);
1883
- if (family === "keyword") return keywordParameters(definition, q);
1884
- if (family === "direct") return "database" in q ? {
1885
- database: q.database ?? null,
1886
- global: q.global_data ?? null,
1887
- dateFormat: "date"
1888
- } : {};
1889
- if (family === "domain") return domainParameters(definition, q);
1890
- if (family === "backlink_gap") return backlinkComparisonParameters(definition, q);
1891
- if (family.startsWith("backlink")) return backlinkParameters(definition, q);
1892
- if (family === "gap") return gapParameters(definition, q);
1893
- if (family === "projects") return {
1894
- filter: q.filters ?? null,
1895
- range: {
1896
- limit: q.limit ?? null,
1897
- offset: q.offset ?? null
2050
+ },
2051
+ project_get: {
2052
+ "method": "/apis/v4-raw/folders/api/v0/folders/folder",
2053
+ "description": "Read one project by its current web folder ID.",
2054
+ "transport": "project_web",
2055
+ "total_method": "",
2056
+ "web_report": "",
2057
+ "mutation": false,
2058
+ "destructive": false,
2059
+ "http_method": "GET",
2060
+ "schema": {
2061
+ "type": "object",
2062
+ "additionalProperties": false,
2063
+ "properties": { "folder_id": {
2064
+ "type": "string",
2065
+ "pattern": "^[0-9]+$",
2066
+ "maxLength": 30,
2067
+ "description": "Current web project folder ID, as a decimal string."
2068
+ } },
2069
+ "required": ["folder_id"]
1898
2070
  }
1899
- };
1900
- if (family === "post" && definition.method.endsWith("/list/all")) return {
1901
- ownership: 1,
1902
- order: {
1903
- field: 3,
1904
- direction: 2
1905
- },
1906
- range: {
1907
- limit: 1e3,
1908
- offset: 0
2071
+ },
2072
+ project_update: {
2073
+ "method": "/apis/v4-raw/folders/api/v0/folders/{folder_id}",
2074
+ "description": "Rename a project or add its first domain. Existing domains cannot be changed.",
2075
+ "transport": "project_web",
2076
+ "total_method": "",
2077
+ "web_report": "",
2078
+ "mutation": true,
2079
+ "destructive": false,
2080
+ "http_method": "PUT",
2081
+ "schema": {
2082
+ "type": "object",
2083
+ "additionalProperties": false,
2084
+ "properties": {
2085
+ "folder_id": {
2086
+ "type": "string",
2087
+ "pattern": "^[0-9]+$",
2088
+ "maxLength": 30,
2089
+ "description": "Current web project folder ID, as a decimal string."
2090
+ },
2091
+ "name": {
2092
+ "type": "string",
2093
+ "minLength": 1,
2094
+ "maxLength": 255,
2095
+ "pattern": "^(?=.*\\S)[^~|`!#%^&*=\\[\\]\\\\\\x27/{}\":<>?]+$",
2096
+ "description": "Project name, up to 255 characters. The web UI restricts punctuation."
2097
+ },
2098
+ "domain": {
2099
+ "type": "string",
2100
+ "minLength": 1,
2101
+ "maxLength": 253,
2102
+ "pattern": "^(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z]{2,63}$",
2103
+ "description": "Domain or subdomain, without protocol or path."
2104
+ },
2105
+ "confirm": {
2106
+ "type": "boolean",
2107
+ "default": false,
2108
+ "description": "Confirm this account mutation."
2109
+ },
2110
+ "dry_run": {
2111
+ "type": "boolean",
2112
+ "default": false,
2113
+ "description": "Print the request without sending it."
2114
+ }
2115
+ },
2116
+ "required": ["folder_id"],
2117
+ "anyOf": [{ "required": ["name"] }, { "required": ["domain"] }]
1909
2118
  }
1910
- };
1911
- if (definition.method.endsWith("selector-list")) return {
1912
- limit: 1e4,
1913
- offset: 0
1914
- };
1915
- return {};
1916
- }
1917
- function magicParameters(definition, q) {
1918
- const method = definition.method;
1919
- const filters = Object.fromEntries([
1920
- "phrase",
1921
- "competition_level",
1922
- "cpc",
1923
- "difficulty",
1924
- "results",
1925
- "volume",
1926
- "words_count"
1927
- ].map((key) => [key, []]));
1928
- Object.assign(filters, {
1929
- serp_features: [{
1930
- inverted: false,
1931
- value: []
1932
- }],
1933
- phrase_include_logic: 0
1934
- }, q.filters ?? null);
1935
- const params = {
1936
- phrase: q.keyword ?? null,
1937
- database: q.database ?? null,
1938
- currency: q.currency ?? null,
1939
- mode: q.mode ?? null,
1940
- questions_only: q.questions_only ?? null,
1941
- topics_enabled: true,
1942
- filter: filters,
1943
- groups: q.groups ?? null,
1944
- order: {
1945
- direction: q.descending ? 1 : 0,
1946
- field: q.sort_field ?? null
1947
- },
1948
- groups_order: {
1949
- direction: 1,
1950
- field: "relevance"
2119
+ },
2120
+ project_delete: {
2121
+ "method": "/apis/v4-raw/folders/api/v0/folders/{folder_id}",
2122
+ "description": "Permanently delete a project and its attached tool data.",
2123
+ "transport": "project_web",
2124
+ "total_method": "",
2125
+ "web_report": "",
2126
+ "mutation": true,
2127
+ "destructive": true,
2128
+ "http_method": "DELETE",
2129
+ "schema": {
2130
+ "type": "object",
2131
+ "additionalProperties": false,
2132
+ "properties": {
2133
+ "folder_id": {
2134
+ "type": "string",
2135
+ "pattern": "^[0-9]+$",
2136
+ "maxLength": 30,
2137
+ "description": "Current web project folder ID, as a decimal string."
2138
+ },
2139
+ "confirm": {
2140
+ "type": "boolean",
2141
+ "default": false,
2142
+ "description": "Confirm this account mutation."
2143
+ },
2144
+ "dry_run": {
2145
+ "type": "boolean",
2146
+ "default": false,
2147
+ "description": "Print the request without sending it."
2148
+ }
2149
+ },
2150
+ "required": ["folder_id"]
1951
2151
  }
1952
- };
1953
- if (method === "ideas.GetKeywords") params.page = {
1954
- number: q.page ?? null,
1955
- size: q.page_size ?? null
1956
- };
1957
- if (method === "ideas.GetGroups") params.groups_page = {
1958
- number: q.page ?? null,
1959
- size: q.page_size ?? null
1960
- };
1961
- return params;
1962
- }
1963
- function keywordParameters(definition, q) {
1964
- const method = definition.method;
1965
- if (!("keyword" in q)) return {};
1966
- const params = {
1967
- phrase: q.keyword ?? null,
1968
- database: q.database ?? null,
1969
- device: 0,
1970
- currency: "USD",
1971
- location: 0,
1972
- date: ""
1973
- };
1974
- if (method.startsWith("ideas.")) Object.assign(params, {
1975
- mode: 0,
1976
- questions_only: q.questions_only ?? null
1977
- });
1978
- return params;
1979
- }
1980
- function domainParameters(definition, q) {
1981
- const method = definition.method;
2152
+ },
2153
+ project_leave: {
2154
+ "method": "/share/json/leave/project-smb",
2155
+ "description": "Leave a shared project.",
2156
+ "transport": "project_web",
2157
+ "total_method": "",
2158
+ "web_report": "",
2159
+ "mutation": true,
2160
+ "destructive": true,
2161
+ "http_method": "POST",
2162
+ "schema": {
2163
+ "type": "object",
2164
+ "additionalProperties": false,
2165
+ "properties": {
2166
+ "folder_id": {
2167
+ "type": "string",
2168
+ "pattern": "^[0-9]+$",
2169
+ "maxLength": 30,
2170
+ "description": "Current web project folder ID, as a decimal string."
2171
+ },
2172
+ "confirm": {
2173
+ "type": "boolean",
2174
+ "default": false,
2175
+ "description": "Confirm this account mutation."
2176
+ },
2177
+ "dry_run": {
2178
+ "type": "boolean",
2179
+ "default": false,
2180
+ "description": "Print the request without sending it."
2181
+ }
2182
+ },
2183
+ "required": ["folder_id"]
2184
+ }
2185
+ },
2186
+ project_limits: {
2187
+ "method": "/apis/v4-raw/folders/api/v0/folders/limits",
2188
+ "description": "Read project creation limits.",
2189
+ "transport": "project_web",
2190
+ "total_method": "",
2191
+ "web_report": "",
2192
+ "mutation": false,
2193
+ "destructive": false,
2194
+ "http_method": "GET",
2195
+ "schema": {
2196
+ "type": "object",
2197
+ "additionalProperties": false,
2198
+ "properties": {},
2199
+ "required": []
2200
+ }
2201
+ },
2202
+ project_tags: {
2203
+ "method": "/apis/v4-raw/folders/api/v0/folders/tags",
2204
+ "description": "Read available project tags.",
2205
+ "transport": "project_web",
2206
+ "total_method": "",
2207
+ "web_report": "",
2208
+ "mutation": false,
2209
+ "destructive": false,
2210
+ "http_method": "GET",
2211
+ "schema": {
2212
+ "type": "object",
2213
+ "additionalProperties": false,
2214
+ "properties": {},
2215
+ "required": []
2216
+ }
2217
+ },
2218
+ project_set_tags: {
2219
+ "method": "/apis/v4-raw/folders/api/v0/folders/tags/{folder_id}",
2220
+ "description": "Replace project tags. An empty array removes all its tags.",
2221
+ "transport": "project_web",
2222
+ "total_method": "",
2223
+ "web_report": "",
2224
+ "mutation": true,
2225
+ "destructive": false,
2226
+ "http_method": "POST",
2227
+ "schema": {
2228
+ "type": "object",
2229
+ "additionalProperties": false,
2230
+ "properties": {
2231
+ "folder_id": {
2232
+ "type": "string",
2233
+ "pattern": "^[0-9]+$",
2234
+ "maxLength": 30,
2235
+ "description": "Current web project folder ID, as a decimal string."
2236
+ },
2237
+ "tags": {
2238
+ "type": "array",
2239
+ "items": {
2240
+ "type": "string",
2241
+ "minLength": 1,
2242
+ "maxLength": 50,
2243
+ "pattern": "^[^~|`!#%^&*=\\[\\]\\\\\\x27/{}\":<>?]+$"
2244
+ },
2245
+ "maxItems": 3,
2246
+ "uniqueItems": true
2247
+ },
2248
+ "confirm": {
2249
+ "type": "boolean",
2250
+ "default": false,
2251
+ "description": "Confirm this account mutation."
2252
+ },
2253
+ "dry_run": {
2254
+ "type": "boolean",
2255
+ "default": false,
2256
+ "description": "Print the request without sending it."
2257
+ }
2258
+ },
2259
+ "required": ["folder_id", "tags"]
2260
+ }
2261
+ },
2262
+ project_check_domain: {
2263
+ "method": "/apis/v4-raw/folders/api/v0/folders/check-domain",
2264
+ "description": "Check website information before creating a project.",
2265
+ "transport": "project_web",
2266
+ "total_method": "",
2267
+ "web_report": "",
2268
+ "mutation": false,
2269
+ "destructive": false,
2270
+ "http_method": "GET",
2271
+ "schema": {
2272
+ "type": "object",
2273
+ "additionalProperties": false,
2274
+ "properties": { "domain": {
2275
+ "type": "string",
2276
+ "minLength": 1,
2277
+ "maxLength": 253,
2278
+ "pattern": "^(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z]{2,63}$",
2279
+ "description": "Domain or subdomain, without protocol or path."
2280
+ } },
2281
+ "required": ["domain"]
2282
+ }
2283
+ },
2284
+ project_pin: {
2285
+ "method": "/apis/v4-raw/crossroad/api/v0/crossroad/set-pinned",
2286
+ "description": "Pin or unpin a project on the dashboard.",
2287
+ "transport": "project_web",
2288
+ "total_method": "",
2289
+ "web_report": "",
2290
+ "mutation": true,
2291
+ "destructive": false,
2292
+ "http_method": "POST",
2293
+ "schema": {
2294
+ "type": "object",
2295
+ "additionalProperties": false,
2296
+ "properties": {
2297
+ "folder_id": {
2298
+ "type": "string",
2299
+ "pattern": "^[0-9]+$",
2300
+ "maxLength": 30,
2301
+ "description": "Current web project folder ID, as a decimal string."
2302
+ },
2303
+ "pinned": { "type": "boolean" },
2304
+ "confirm": {
2305
+ "type": "boolean",
2306
+ "default": false,
2307
+ "description": "Confirm this account mutation."
2308
+ },
2309
+ "dry_run": {
2310
+ "type": "boolean",
2311
+ "default": false,
2312
+ "description": "Print the request without sending it."
2313
+ }
2314
+ },
2315
+ "required": ["folder_id", "pinned"]
2316
+ }
2317
+ },
2318
+ project_toolkits: {
2319
+ "method": "/apis/v4-raw/crossroad/api/v0/crossroad/toolkits",
2320
+ "description": "Read SEO, AI, local, social, advertising and content toolkit status.",
2321
+ "transport": "project_web",
2322
+ "total_method": "",
2323
+ "web_report": "",
2324
+ "mutation": false,
2325
+ "destructive": false,
2326
+ "http_method": "POST",
2327
+ "schema": {
2328
+ "type": "object",
2329
+ "additionalProperties": false,
2330
+ "properties": {
2331
+ "folder_ids": {
2332
+ "type": "array",
2333
+ "items": {
2334
+ "type": "string",
2335
+ "pattern": "^[0-9]+$",
2336
+ "maxLength": 30,
2337
+ "description": "Current web project folder ID, as a decimal string."
2338
+ },
2339
+ "minItems": 1,
2340
+ "maxItems": 100,
2341
+ "uniqueItems": true
2342
+ },
2343
+ "with_promo": {
2344
+ "type": "boolean",
2345
+ "default": false
2346
+ }
2347
+ },
2348
+ "required": ["folder_ids"]
2349
+ }
2350
+ },
2351
+ project_tools: {
2352
+ "method": "/apis/v4-raw/crossroad/api/v0/crossroad/tools",
2353
+ "description": "Read project dashboard metrics. Tool IDs match the web dashboard.",
2354
+ "transport": "project_web",
2355
+ "total_method": "",
2356
+ "web_report": "",
2357
+ "mutation": false,
2358
+ "destructive": false,
2359
+ "http_method": "POST",
2360
+ "schema": {
2361
+ "type": "object",
2362
+ "additionalProperties": false,
2363
+ "properties": {
2364
+ "folder_id": {
2365
+ "type": "string",
2366
+ "pattern": "^[0-9]+$",
2367
+ "maxLength": 30,
2368
+ "description": "Current web project folder ID, as a decimal string."
2369
+ },
2370
+ "tools": {
2371
+ "type": "array",
2372
+ "items": {
2373
+ "type": "integer",
2374
+ "minimum": 3,
2375
+ "maximum": 33
2376
+ },
2377
+ "minItems": 1,
2378
+ "maxItems": 31,
2379
+ "uniqueItems": true
2380
+ }
2381
+ },
2382
+ "required": ["folder_id", "tools"]
2383
+ }
2384
+ },
2385
+ project_enable_seo: {
2386
+ "method": "/projects/api/projects",
2387
+ "description": "Create the SEO project associated with an existing web project. Uses project allowance.",
2388
+ "transport": "project_web",
2389
+ "total_method": "",
2390
+ "web_report": "",
2391
+ "mutation": true,
2392
+ "destructive": false,
2393
+ "http_method": "POST",
2394
+ "schema": {
2395
+ "type": "object",
2396
+ "additionalProperties": false,
2397
+ "properties": {
2398
+ "folder_id": {
2399
+ "type": "string",
2400
+ "pattern": "^[0-9]+$",
2401
+ "maxLength": 30,
2402
+ "description": "Current web project folder ID, as a decimal string."
2403
+ },
2404
+ "confirm": {
2405
+ "type": "boolean",
2406
+ "default": false,
2407
+ "description": "Confirm this account mutation."
2408
+ },
2409
+ "dry_run": {
2410
+ "type": "boolean",
2411
+ "default": false,
2412
+ "description": "Print the request without sending it."
2413
+ }
2414
+ },
2415
+ "required": ["folder_id"]
2416
+ }
2417
+ },
2418
+ project_seo_auto_setup: {
2419
+ "method": "/projects/api/projects/seo_auto_setup",
2420
+ "description": "Start automatic SEO setup, including Site Audit and Position Tracking. Uses account allowances.",
2421
+ "transport": "project_web",
2422
+ "total_method": "",
2423
+ "web_report": "",
2424
+ "mutation": true,
2425
+ "destructive": false,
2426
+ "http_method": "POST",
2427
+ "schema": {
2428
+ "type": "object",
2429
+ "additionalProperties": false,
2430
+ "properties": {
2431
+ "folder_id": {
2432
+ "type": "string",
2433
+ "pattern": "^[0-9]+$",
2434
+ "maxLength": 30,
2435
+ "description": "Current web project folder ID, as a decimal string."
2436
+ },
2437
+ "confirm": {
2438
+ "type": "boolean",
2439
+ "default": false,
2440
+ "description": "Confirm this account mutation."
2441
+ },
2442
+ "dry_run": {
2443
+ "type": "boolean",
2444
+ "default": false,
2445
+ "description": "Print the request without sending it."
2446
+ }
2447
+ },
2448
+ "required": ["folder_id"]
2449
+ }
2450
+ },
2451
+ keyword_list_limits: {
2452
+ "method": "user.GetInfo",
2453
+ "description": "Read Keyword Strategy Builder list and clustering allowances.",
2454
+ "transport": "kwm",
2455
+ "total_method": "",
2456
+ "web_report": "",
2457
+ "mutation": false,
2458
+ "destructive": false,
2459
+ "http_method": "POST",
2460
+ "schema": {
2461
+ "type": "object",
2462
+ "additionalProperties": false,
2463
+ "properties": {},
2464
+ "required": []
2465
+ }
2466
+ },
2467
+ keyword_lists: {
2468
+ "method": "baskets.BasketsGetAll",
2469
+ "description": "Read regular and structured keyword lists with pagination and ownership filters.",
2470
+ "transport": "kwm",
2471
+ "total_method": "",
2472
+ "web_report": "",
2473
+ "mutation": false,
2474
+ "destructive": false,
2475
+ "http_method": "POST",
2476
+ "schema": {
2477
+ "type": "object",
2478
+ "additionalProperties": false,
2479
+ "properties": {
2480
+ "page": {
2481
+ "type": "integer",
2482
+ "minimum": 1,
2483
+ "default": 1
2484
+ },
2485
+ "page_size": {
2486
+ "type": "integer",
2487
+ "minimum": 1,
2488
+ "maximum": 1e3,
2489
+ "default": 100
2490
+ },
2491
+ "sort_field": {
2492
+ "type": "string",
2493
+ "minLength": 1,
2494
+ "default": "updated_at"
2495
+ },
2496
+ "descending": {
2497
+ "type": "boolean",
2498
+ "default": true
2499
+ },
2500
+ "name_filter": {
2501
+ "type": "string",
2502
+ "default": ""
2503
+ },
2504
+ "ownership": {
2505
+ "type": "integer",
2506
+ "minimum": 1,
2507
+ "maximum": 7,
2508
+ "default": 7,
2509
+ "description": "Web ownership bitmask. 7 includes owned and shared lists."
2510
+ }
2511
+ },
2512
+ "required": []
2513
+ }
2514
+ },
2515
+ keyword_list_create: {
2516
+ "method": "baskets.BasketCreate",
2517
+ "description": "Create an empty regular keyword list. Does not cluster or generate a strategy.",
2518
+ "transport": "kwm",
2519
+ "total_method": "",
2520
+ "web_report": "",
2521
+ "mutation": true,
2522
+ "destructive": false,
2523
+ "http_method": "POST",
2524
+ "schema": {
2525
+ "type": "object",
2526
+ "additionalProperties": false,
2527
+ "properties": {
2528
+ "name": {
2529
+ "type": "string",
2530
+ "minLength": 1,
2531
+ "maxLength": 255,
2532
+ "pattern": "\\S"
2533
+ },
2534
+ "confirm": {
2535
+ "type": "boolean",
2536
+ "default": false,
2537
+ "description": "Confirm this account mutation."
2538
+ },
2539
+ "dry_run": {
2540
+ "type": "boolean",
2541
+ "default": false,
2542
+ "description": "Preview without authentication or network access."
2543
+ }
2544
+ },
2545
+ "required": ["name"]
2546
+ }
2547
+ },
2548
+ keyword_list_get: {
2549
+ "method": "baskets.BasketsGetByShareID",
2550
+ "description": "Read one keyword list and its permissions.",
2551
+ "transport": "kwm",
2552
+ "total_method": "",
2553
+ "web_report": "",
2554
+ "mutation": false,
2555
+ "destructive": false,
2556
+ "http_method": "POST",
2557
+ "schema": {
2558
+ "type": "object",
2559
+ "additionalProperties": false,
2560
+ "properties": {
2561
+ "basket_id": {
2562
+ "type": "integer",
2563
+ "minimum": 1,
2564
+ "maximum": 9007199254740991,
2565
+ "description": "BasketID from keyword-lists."
2566
+ },
2567
+ "owner_id": {
2568
+ "type": "integer",
2569
+ "minimum": 1,
2570
+ "maximum": 9007199254740991,
2571
+ "description": "Owner.ID from keyword-lists, including shared lists."
2572
+ }
2573
+ },
2574
+ "required": ["basket_id", "owner_id"]
2575
+ }
2576
+ },
2577
+ keyword_list_rename: {
2578
+ "method": "baskets.BasketRename",
2579
+ "description": "Rename a keyword list.",
2580
+ "transport": "kwm",
2581
+ "total_method": "",
2582
+ "web_report": "",
2583
+ "mutation": true,
2584
+ "destructive": false,
2585
+ "http_method": "POST",
2586
+ "schema": {
2587
+ "type": "object",
2588
+ "additionalProperties": false,
2589
+ "properties": {
2590
+ "basket_id": {
2591
+ "type": "integer",
2592
+ "minimum": 1,
2593
+ "maximum": 9007199254740991,
2594
+ "description": "BasketID from keyword-lists."
2595
+ },
2596
+ "owner_id": {
2597
+ "type": "integer",
2598
+ "minimum": 1,
2599
+ "maximum": 9007199254740991,
2600
+ "description": "Owner.ID from keyword-lists, including shared lists."
2601
+ },
2602
+ "name": {
2603
+ "type": "string",
2604
+ "minLength": 1,
2605
+ "maxLength": 255,
2606
+ "pattern": "\\S"
2607
+ },
2608
+ "confirm": {
2609
+ "type": "boolean",
2610
+ "default": false,
2611
+ "description": "Confirm this account mutation."
2612
+ },
2613
+ "dry_run": {
2614
+ "type": "boolean",
2615
+ "default": false,
2616
+ "description": "Preview without authentication or network access."
2617
+ }
2618
+ },
2619
+ "required": [
2620
+ "basket_id",
2621
+ "owner_id",
2622
+ "name"
2623
+ ]
2624
+ }
2625
+ },
2626
+ keyword_list_delete: {
2627
+ "method": "baskets.BasketDelete",
2628
+ "description": "Permanently delete one of your keyword lists.",
2629
+ "transport": "kwm",
2630
+ "total_method": "",
2631
+ "web_report": "",
2632
+ "mutation": true,
2633
+ "destructive": true,
2634
+ "http_method": "POST",
2635
+ "schema": {
2636
+ "type": "object",
2637
+ "additionalProperties": false,
2638
+ "properties": {
2639
+ "basket_id": {
2640
+ "type": "integer",
2641
+ "minimum": 1,
2642
+ "maximum": 9007199254740991,
2643
+ "description": "BasketID from keyword-lists."
2644
+ },
2645
+ "confirm": {
2646
+ "type": "boolean",
2647
+ "default": false,
2648
+ "description": "Confirm this account mutation."
2649
+ },
2650
+ "dry_run": {
2651
+ "type": "boolean",
2652
+ "default": false,
2653
+ "description": "Preview without authentication or network access."
2654
+ }
2655
+ },
2656
+ "required": ["basket_id"]
2657
+ }
2658
+ },
2659
+ keyword_list_keywords: {
2660
+ "method": "baskets.KeywordsGetByFilter",
2661
+ "description": "Read filtered, paginated keyword-list metrics.",
2662
+ "transport": "kwm",
2663
+ "total_method": "",
2664
+ "web_report": "",
2665
+ "mutation": false,
2666
+ "destructive": false,
2667
+ "http_method": "POST",
2668
+ "schema": {
2669
+ "type": "object",
2670
+ "additionalProperties": false,
2671
+ "properties": {
2672
+ "basket_id": {
2673
+ "type": "integer",
2674
+ "minimum": 1,
2675
+ "maximum": 9007199254740991,
2676
+ "description": "BasketID from keyword-lists."
2677
+ },
2678
+ "owner_id": {
2679
+ "type": "integer",
2680
+ "minimum": 1,
2681
+ "maximum": 9007199254740991,
2682
+ "description": "Owner.ID from keyword-lists, including shared lists."
2683
+ },
2684
+ "page": {
2685
+ "type": "integer",
2686
+ "minimum": 1,
2687
+ "default": 1
2688
+ },
2689
+ "page_size": {
2690
+ "type": "integer",
2691
+ "minimum": 1,
2692
+ "maximum": 1e3,
2693
+ "default": 100
2694
+ },
2695
+ "sort_field": {
2696
+ "type": "string",
2697
+ "minLength": 1,
2698
+ "default": "phrase"
2699
+ },
2700
+ "descending": {
2701
+ "type": "boolean",
2702
+ "default": true
2703
+ },
2704
+ "filters": {
2705
+ "type": "object",
2706
+ "description": "Keyword Strategy Builder Filter object. Unspecified fields default to empty arrays.",
2707
+ "properties": {
2708
+ "ClusterIDs": { "type": "array" },
2709
+ "Databases": { "type": "array" },
2710
+ "Phrase": { "type": "array" },
2711
+ "CompetitionLevel": { "type": "array" },
2712
+ "Cpc": { "type": "array" },
2713
+ "Difficulty": { "type": "array" },
2714
+ "SERPFeatures": { "type": "array" },
2715
+ "Volume": { "type": "array" },
2716
+ "ClickPotential": { "type": "array" },
2717
+ "Tags": { "type": "array" },
2718
+ "Intents": { "type": "array" }
2719
+ },
2720
+ "additionalProperties": false,
2721
+ "default": {}
2722
+ }
2723
+ },
2724
+ "required": ["basket_id", "owner_id"]
2725
+ }
2726
+ },
2727
+ keyword_list_summary: {
2728
+ "method": "baskets.KeywordsGetSummary",
2729
+ "description": "Read keyword totals, volume and difficulty for the selected filters.",
2730
+ "transport": "kwm",
2731
+ "total_method": "",
2732
+ "web_report": "",
2733
+ "mutation": false,
2734
+ "destructive": false,
2735
+ "http_method": "POST",
2736
+ "schema": {
2737
+ "type": "object",
2738
+ "additionalProperties": false,
2739
+ "properties": {
2740
+ "basket_id": {
2741
+ "type": "integer",
2742
+ "minimum": 1,
2743
+ "maximum": 9007199254740991,
2744
+ "description": "BasketID from keyword-lists."
2745
+ },
2746
+ "owner_id": {
2747
+ "type": "integer",
2748
+ "minimum": 1,
2749
+ "maximum": 9007199254740991,
2750
+ "description": "Owner.ID from keyword-lists, including shared lists."
2751
+ },
2752
+ "filters": {
2753
+ "type": "object",
2754
+ "description": "Keyword Strategy Builder Filter object. Unspecified fields default to empty arrays.",
2755
+ "properties": {
2756
+ "ClusterIDs": { "type": "array" },
2757
+ "Databases": { "type": "array" },
2758
+ "Phrase": { "type": "array" },
2759
+ "CompetitionLevel": { "type": "array" },
2760
+ "Cpc": { "type": "array" },
2761
+ "Difficulty": { "type": "array" },
2762
+ "SERPFeatures": { "type": "array" },
2763
+ "Volume": { "type": "array" },
2764
+ "ClickPotential": { "type": "array" },
2765
+ "Tags": { "type": "array" },
2766
+ "Intents": { "type": "array" }
2767
+ },
2768
+ "additionalProperties": false,
2769
+ "default": {}
2770
+ }
2771
+ },
2772
+ "required": ["basket_id", "owner_id"]
2773
+ }
2774
+ },
2775
+ keyword_list_import: {
2776
+ "method": "baskets.KeywordsImport",
2777
+ "description": "Import phrases into a regular keyword list. Account keyword limits apply.",
2778
+ "transport": "kwm",
2779
+ "total_method": "",
2780
+ "web_report": "",
2781
+ "mutation": true,
2782
+ "destructive": false,
2783
+ "http_method": "POST",
2784
+ "schema": {
2785
+ "type": "object",
2786
+ "additionalProperties": false,
2787
+ "properties": {
2788
+ "basket_id": {
2789
+ "type": "integer",
2790
+ "minimum": 1,
2791
+ "maximum": 9007199254740991,
2792
+ "description": "BasketID from keyword-lists."
2793
+ },
2794
+ "owner_id": {
2795
+ "type": "integer",
2796
+ "minimum": 1,
2797
+ "maximum": 9007199254740991,
2798
+ "description": "Owner.ID from keyword-lists, including shared lists."
2799
+ },
2800
+ "keywords": {
2801
+ "type": "array",
2802
+ "items": {
2803
+ "type": "string",
2804
+ "minLength": 1,
2805
+ "pattern": "\\S"
2806
+ },
2807
+ "minItems": 1,
2808
+ "uniqueItems": true
2809
+ },
2810
+ "database": {
2811
+ "type": "string",
2812
+ "pattern": "^[a-z]{2}(?:-[a-z]{2})?$",
2813
+ "default": "us"
2814
+ },
2815
+ "tags": {
2816
+ "type": "array",
2817
+ "items": {
2818
+ "type": "string",
2819
+ "minLength": 1,
2820
+ "pattern": "\\S"
2821
+ },
2822
+ "uniqueItems": true,
2823
+ "default": []
2824
+ },
2825
+ "confirm": {
2826
+ "type": "boolean",
2827
+ "default": false,
2828
+ "description": "Confirm this account mutation."
2829
+ },
2830
+ "dry_run": {
2831
+ "type": "boolean",
2832
+ "default": false,
2833
+ "description": "Preview without authentication or network access."
2834
+ }
2835
+ },
2836
+ "required": [
2837
+ "basket_id",
2838
+ "owner_id",
2839
+ "keywords"
2840
+ ]
2841
+ }
2842
+ },
2843
+ keyword_list_delete_keywords: {
2844
+ "method": "baskets.KeywordsDeleteByIDs",
2845
+ "description": "Delete selected phrases from a keyword list. Returns an undo ID.",
2846
+ "transport": "kwm",
2847
+ "total_method": "",
2848
+ "web_report": "",
2849
+ "mutation": true,
2850
+ "destructive": true,
2851
+ "http_method": "POST",
2852
+ "schema": {
2853
+ "type": "object",
2854
+ "additionalProperties": false,
2855
+ "properties": {
2856
+ "basket_id": {
2857
+ "type": "integer",
2858
+ "minimum": 1,
2859
+ "maximum": 9007199254740991,
2860
+ "description": "BasketID from keyword-lists."
2861
+ },
2862
+ "owner_id": {
2863
+ "type": "integer",
2864
+ "minimum": 1,
2865
+ "maximum": 9007199254740991,
2866
+ "description": "Owner.ID from keyword-lists, including shared lists."
2867
+ },
2868
+ "keywords": {
2869
+ "type": "array",
2870
+ "items": {
2871
+ "type": "string",
2872
+ "minLength": 1,
2873
+ "pattern": "\\S"
2874
+ },
2875
+ "minItems": 1,
2876
+ "uniqueItems": true
2877
+ },
2878
+ "database": {
2879
+ "type": "string",
2880
+ "pattern": "^[a-z]{2}(?:-[a-z]{2})?$",
2881
+ "default": "us"
2882
+ },
2883
+ "confirm": {
2884
+ "type": "boolean",
2885
+ "default": false,
2886
+ "description": "Confirm this account mutation."
2887
+ },
2888
+ "dry_run": {
2889
+ "type": "boolean",
2890
+ "default": false,
2891
+ "description": "Preview without authentication or network access."
2892
+ }
2893
+ },
2894
+ "required": [
2895
+ "basket_id",
2896
+ "owner_id",
2897
+ "keywords"
2898
+ ]
2899
+ }
2900
+ },
2901
+ keyword_list_undo_delete: {
2902
+ "method": "baskets.KeywordsDeleteUndo",
2903
+ "description": "Restore a keyword deletion using its returned UndoID.",
2904
+ "transport": "kwm",
2905
+ "total_method": "",
2906
+ "web_report": "",
2907
+ "mutation": true,
2908
+ "destructive": false,
2909
+ "http_method": "POST",
2910
+ "schema": {
2911
+ "type": "object",
2912
+ "additionalProperties": false,
2913
+ "properties": {
2914
+ "undo_id": {
2915
+ "type": "string",
2916
+ "minLength": 1
2917
+ },
2918
+ "confirm": {
2919
+ "type": "boolean",
2920
+ "default": false,
2921
+ "description": "Confirm this account mutation."
2922
+ },
2923
+ "dry_run": {
2924
+ "type": "boolean",
2925
+ "default": false,
2926
+ "description": "Preview without authentication or network access."
2927
+ }
2928
+ },
2929
+ "required": ["undo_id"]
2930
+ }
2931
+ },
2932
+ keyword_list_update_metrics: {
2933
+ "method": "baskets.KeywordsRequestUpdateByIDs",
2934
+ "description": "Request fresh metrics for selected phrases. Consumes the update allowance.",
2935
+ "transport": "kwm",
2936
+ "total_method": "",
2937
+ "web_report": "",
2938
+ "mutation": true,
2939
+ "destructive": false,
2940
+ "http_method": "POST",
2941
+ "schema": {
2942
+ "type": "object",
2943
+ "additionalProperties": false,
2944
+ "properties": {
2945
+ "basket_id": {
2946
+ "type": "integer",
2947
+ "minimum": 1,
2948
+ "maximum": 9007199254740991,
2949
+ "description": "BasketID from keyword-lists."
2950
+ },
2951
+ "owner_id": {
2952
+ "type": "integer",
2953
+ "minimum": 1,
2954
+ "maximum": 9007199254740991,
2955
+ "description": "Owner.ID from keyword-lists, including shared lists."
2956
+ },
2957
+ "keywords": {
2958
+ "type": "array",
2959
+ "items": {
2960
+ "type": "string",
2961
+ "minLength": 1,
2962
+ "pattern": "\\S"
2963
+ },
2964
+ "minItems": 1,
2965
+ "uniqueItems": true
2966
+ },
2967
+ "database": {
2968
+ "type": "string",
2969
+ "pattern": "^[a-z]{2}(?:-[a-z]{2})?$",
2970
+ "default": "us"
2971
+ },
2972
+ "confirm": {
2973
+ "type": "boolean",
2974
+ "default": false,
2975
+ "description": "Confirm this account mutation."
2976
+ },
2977
+ "dry_run": {
2978
+ "type": "boolean",
2979
+ "default": false,
2980
+ "description": "Preview without authentication or network access."
2981
+ }
2982
+ },
2983
+ "required": [
2984
+ "basket_id",
2985
+ "owner_id",
2986
+ "keywords"
2987
+ ]
2988
+ }
2989
+ },
2990
+ keyword_list_tags: {
2991
+ "method": "baskets.GetBasketTags",
2992
+ "description": "Read keyword tags and their usage in a list.",
2993
+ "transport": "kwm",
2994
+ "total_method": "",
2995
+ "web_report": "",
2996
+ "mutation": false,
2997
+ "destructive": false,
2998
+ "http_method": "POST",
2999
+ "schema": {
3000
+ "type": "object",
3001
+ "additionalProperties": false,
3002
+ "properties": {
3003
+ "basket_id": {
3004
+ "type": "integer",
3005
+ "minimum": 1,
3006
+ "maximum": 9007199254740991,
3007
+ "description": "BasketID from keyword-lists."
3008
+ },
3009
+ "owner_id": {
3010
+ "type": "integer",
3011
+ "minimum": 1,
3012
+ "maximum": 9007199254740991,
3013
+ "description": "Owner.ID from keyword-lists, including shared lists."
3014
+ }
3015
+ },
3016
+ "required": ["basket_id", "owner_id"]
3017
+ }
3018
+ },
3019
+ keyword_list_add_tags: {
3020
+ "method": "baskets.KeywordsAddTags",
3021
+ "description": "Add tags to selected phrases.",
3022
+ "transport": "kwm",
3023
+ "total_method": "",
3024
+ "web_report": "",
3025
+ "mutation": true,
3026
+ "destructive": false,
3027
+ "http_method": "POST",
3028
+ "schema": {
3029
+ "type": "object",
3030
+ "additionalProperties": false,
3031
+ "properties": {
3032
+ "basket_id": {
3033
+ "type": "integer",
3034
+ "minimum": 1,
3035
+ "maximum": 9007199254740991,
3036
+ "description": "BasketID from keyword-lists."
3037
+ },
3038
+ "owner_id": {
3039
+ "type": "integer",
3040
+ "minimum": 1,
3041
+ "maximum": 9007199254740991,
3042
+ "description": "Owner.ID from keyword-lists, including shared lists."
3043
+ },
3044
+ "keywords": {
3045
+ "type": "array",
3046
+ "items": {
3047
+ "type": "string",
3048
+ "minLength": 1,
3049
+ "pattern": "\\S"
3050
+ },
3051
+ "minItems": 1,
3052
+ "uniqueItems": true
3053
+ },
3054
+ "database": {
3055
+ "type": "string",
3056
+ "pattern": "^[a-z]{2}(?:-[a-z]{2})?$",
3057
+ "default": "us"
3058
+ },
3059
+ "tags": {
3060
+ "type": "array",
3061
+ "items": {
3062
+ "type": "string",
3063
+ "minLength": 1,
3064
+ "pattern": "\\S"
3065
+ },
3066
+ "uniqueItems": true,
3067
+ "default": [],
3068
+ "minItems": 1
3069
+ },
3070
+ "confirm": {
3071
+ "type": "boolean",
3072
+ "default": false,
3073
+ "description": "Confirm this account mutation."
3074
+ },
3075
+ "dry_run": {
3076
+ "type": "boolean",
3077
+ "default": false,
3078
+ "description": "Preview without authentication or network access."
3079
+ }
3080
+ },
3081
+ "required": [
3082
+ "basket_id",
3083
+ "owner_id",
3084
+ "keywords",
3085
+ "tags"
3086
+ ]
3087
+ }
3088
+ },
3089
+ keyword_list_remove_tags: {
3090
+ "method": "baskets.KeywordsDeleteTags",
3091
+ "description": "Remove tags from selected phrases.",
3092
+ "transport": "kwm",
3093
+ "total_method": "",
3094
+ "web_report": "",
3095
+ "mutation": true,
3096
+ "destructive": true,
3097
+ "http_method": "POST",
3098
+ "schema": {
3099
+ "type": "object",
3100
+ "additionalProperties": false,
3101
+ "properties": {
3102
+ "basket_id": {
3103
+ "type": "integer",
3104
+ "minimum": 1,
3105
+ "maximum": 9007199254740991,
3106
+ "description": "BasketID from keyword-lists."
3107
+ },
3108
+ "owner_id": {
3109
+ "type": "integer",
3110
+ "minimum": 1,
3111
+ "maximum": 9007199254740991,
3112
+ "description": "Owner.ID from keyword-lists, including shared lists."
3113
+ },
3114
+ "keywords": {
3115
+ "type": "array",
3116
+ "items": {
3117
+ "type": "string",
3118
+ "minLength": 1,
3119
+ "pattern": "\\S"
3120
+ },
3121
+ "minItems": 1,
3122
+ "uniqueItems": true
3123
+ },
3124
+ "database": {
3125
+ "type": "string",
3126
+ "pattern": "^[a-z]{2}(?:-[a-z]{2})?$",
3127
+ "default": "us"
3128
+ },
3129
+ "tags": {
3130
+ "type": "array",
3131
+ "items": {
3132
+ "type": "string",
3133
+ "minLength": 1,
3134
+ "pattern": "\\S"
3135
+ },
3136
+ "uniqueItems": true,
3137
+ "default": [],
3138
+ "minItems": 1
3139
+ },
3140
+ "confirm": {
3141
+ "type": "boolean",
3142
+ "default": false,
3143
+ "description": "Confirm this account mutation."
3144
+ },
3145
+ "dry_run": {
3146
+ "type": "boolean",
3147
+ "default": false,
3148
+ "description": "Preview without authentication or network access."
3149
+ }
3150
+ },
3151
+ "required": [
3152
+ "basket_id",
3153
+ "owner_id",
3154
+ "keywords",
3155
+ "tags"
3156
+ ]
3157
+ }
3158
+ },
3159
+ keyword_list_cluster: {
3160
+ "method": "baskets.RunClusterization",
3161
+ "description": "Start clustering a keyword list. Consumes the clustering allowance.",
3162
+ "transport": "kwm",
3163
+ "total_method": "",
3164
+ "web_report": "",
3165
+ "mutation": true,
3166
+ "destructive": false,
3167
+ "http_method": "POST",
3168
+ "schema": {
3169
+ "type": "object",
3170
+ "additionalProperties": false,
3171
+ "properties": {
3172
+ "basket_id": {
3173
+ "type": "integer",
3174
+ "minimum": 1,
3175
+ "maximum": 9007199254740991,
3176
+ "description": "BasketID from keyword-lists."
3177
+ },
3178
+ "owner_id": {
3179
+ "type": "integer",
3180
+ "minimum": 1,
3181
+ "maximum": 9007199254740991,
3182
+ "description": "Owner.ID from keyword-lists, including shared lists."
3183
+ },
3184
+ "confirm": {
3185
+ "type": "boolean",
3186
+ "default": false,
3187
+ "description": "Confirm this account mutation."
3188
+ },
3189
+ "dry_run": {
3190
+ "type": "boolean",
3191
+ "default": false,
3192
+ "description": "Preview without authentication or network access."
3193
+ }
3194
+ },
3195
+ "required": ["basket_id", "owner_id"]
3196
+ }
3197
+ },
3198
+ keyword_list_cluster_forecast: {
3199
+ "method": "baskets.BasketGetClusterizationForecast",
3200
+ "description": "Read the clustering forecast for a keyword list.",
3201
+ "transport": "kwm",
3202
+ "total_method": "",
3203
+ "web_report": "",
3204
+ "mutation": false,
3205
+ "destructive": false,
3206
+ "http_method": "POST",
3207
+ "schema": {
3208
+ "type": "object",
3209
+ "additionalProperties": false,
3210
+ "properties": {
3211
+ "basket_id": {
3212
+ "type": "integer",
3213
+ "minimum": 1,
3214
+ "maximum": 9007199254740991,
3215
+ "description": "BasketID from keyword-lists."
3216
+ },
3217
+ "owner_id": {
3218
+ "type": "integer",
3219
+ "minimum": 1,
3220
+ "maximum": 9007199254740991,
3221
+ "description": "Owner.ID from keyword-lists, including shared lists."
3222
+ }
3223
+ },
3224
+ "required": ["basket_id", "owner_id"]
3225
+ }
3226
+ },
3227
+ keyword_list_cluster_status: {
3228
+ "method": "baskets.BasketGetClusterizationStatuses",
3229
+ "description": "Read the current clustering status for a keyword list.",
3230
+ "transport": "kwm",
3231
+ "total_method": "",
3232
+ "web_report": "",
3233
+ "mutation": false,
3234
+ "destructive": false,
3235
+ "http_method": "POST",
3236
+ "schema": {
3237
+ "type": "object",
3238
+ "additionalProperties": false,
3239
+ "properties": {
3240
+ "basket_id": {
3241
+ "type": "integer",
3242
+ "minimum": 1,
3243
+ "maximum": 9007199254740991,
3244
+ "description": "BasketID from keyword-lists."
3245
+ },
3246
+ "owner_id": {
3247
+ "type": "integer",
3248
+ "minimum": 1,
3249
+ "maximum": 9007199254740991,
3250
+ "description": "Owner.ID from keyword-lists, including shared lists."
3251
+ }
3252
+ },
3253
+ "required": ["basket_id", "owner_id"]
3254
+ }
3255
+ },
3256
+ keyword_strategy_create: {
3257
+ "method": "baskets.BasketCreate",
3258
+ "description": "Generate a structured keyword strategy from a domain or seed phrases. Consumes the clustering allowance.",
3259
+ "transport": "kwm",
3260
+ "total_method": "",
3261
+ "web_report": "",
3262
+ "mutation": true,
3263
+ "destructive": false,
3264
+ "http_method": "POST",
3265
+ "schema": {
3266
+ "type": "object",
3267
+ "additionalProperties": false,
3268
+ "properties": {
3269
+ "name": {
3270
+ "type": "string",
3271
+ "minLength": 1,
3272
+ "maxLength": 255,
3273
+ "pattern": "\\S"
3274
+ },
3275
+ "domain": {
3276
+ "type": "string",
3277
+ "minLength": 1,
3278
+ "maxLength": 253,
3279
+ "pattern": "^(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z]{2,63}$",
3280
+ "description": "Domain or subdomain, without protocol or path."
3281
+ },
3282
+ "database": {
3283
+ "type": "string",
3284
+ "pattern": "^[a-z]{2}(?:-[a-z]{2})?$",
3285
+ "default": "us"
3286
+ },
3287
+ "seed_keywords": {
3288
+ "type": "array",
3289
+ "items": {
3290
+ "type": "string",
3291
+ "minLength": 1,
3292
+ "pattern": "\\S"
3293
+ },
3294
+ "default": [],
3295
+ "uniqueItems": true
3296
+ },
3297
+ "competitors": {
3298
+ "type": "array",
3299
+ "items": {
3300
+ "type": "string",
3301
+ "minLength": 1,
3302
+ "maxLength": 253,
3303
+ "pattern": "^(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.)+[A-Za-z]{2,63}$",
3304
+ "description": "Domain or subdomain, without protocol or path."
3305
+ },
3306
+ "default": [],
3307
+ "uniqueItems": true
3308
+ },
3309
+ "confirm": {
3310
+ "type": "boolean",
3311
+ "default": false,
3312
+ "description": "Confirm this account mutation."
3313
+ },
3314
+ "dry_run": {
3315
+ "type": "boolean",
3316
+ "default": false,
3317
+ "description": "Preview without authentication or network access."
3318
+ }
3319
+ },
3320
+ "required": ["name"],
3321
+ "anyOf": [{ "required": ["domain"] }, {
3322
+ "required": ["seed_keywords"],
3323
+ "properties": { "seed_keywords": { "minItems": 1 } }
3324
+ }]
3325
+ }
3326
+ }
3327
+ };
3328
+
3329
+ //#endregion
3330
+ //#region src/report-parameters.ts
3331
+ const backlinkSorts = new Map([
3332
+ ["backlinks", "page_ascore"],
3333
+ ["backlinks_refdomains", "backlinksnum"],
3334
+ ["backlinks_anchors", "backlinksnum"],
3335
+ ["backlinks_pages", "domainsnum"],
3336
+ ["backlinks_outgoing_domains", "links_num"]
3337
+ ]);
3338
+ const version = version$1;
3339
+ const reports = report_catalog_default;
3340
+ /** Fixed request shapes observed in semrush-web-mcp. No arbitrary RPC or URL input. */
3341
+ function reportParameters(definition, q) {
3342
+ const family = definition.transport;
3343
+ if (family === "kwm") return keywordListParameters(definition, q);
3344
+ if (family === "project_web") return projectParameters(definition, q);
3345
+ if (family === "magic") return magicParameters(definition, q);
3346
+ if (family === "keyword") return keywordParameters(definition, q);
3347
+ if (family === "direct") return "database" in q ? {
3348
+ database: q.database ?? null,
3349
+ global: q.global_data ?? null,
3350
+ dateFormat: "date"
3351
+ } : {};
3352
+ if (family === "domain") return domainParameters(definition, q);
3353
+ if (family === "backlink_gap") return backlinkComparisonParameters(definition, q);
3354
+ if (family.startsWith("backlink")) return backlinkParameters(definition, q);
3355
+ if (family === "gap") return gapParameters(definition, q);
3356
+ if (family === "projects") return {
3357
+ filter: q.filters ?? null,
3358
+ range: {
3359
+ limit: q.limit ?? null,
3360
+ offset: q.offset ?? null
3361
+ }
3362
+ };
3363
+ if (family === "post" && definition.method.endsWith("/list/all")) return {
3364
+ ownership: 1,
3365
+ order: {
3366
+ field: 3,
3367
+ direction: 2
3368
+ },
3369
+ range: {
3370
+ limit: 1e3,
3371
+ offset: 0
3372
+ }
3373
+ };
3374
+ if (definition.method.endsWith("selector-list")) return {
3375
+ limit: 1e4,
3376
+ offset: 0
3377
+ };
3378
+ return {};
3379
+ }
3380
+ function magicParameters(definition, q) {
3381
+ const method = definition.method;
3382
+ const filters = Object.fromEntries([
3383
+ "phrase",
3384
+ "competition_level",
3385
+ "cpc",
3386
+ "difficulty",
3387
+ "results",
3388
+ "volume",
3389
+ "words_count"
3390
+ ].map((key) => [key, []]));
3391
+ Object.assign(filters, {
3392
+ serp_features: [{
3393
+ inverted: false,
3394
+ value: []
3395
+ }],
3396
+ phrase_include_logic: 0
3397
+ }, q.filters ?? null);
3398
+ const params = {
3399
+ phrase: q.keyword ?? null,
3400
+ database: q.database ?? null,
3401
+ currency: q.currency ?? null,
3402
+ mode: q.mode ?? null,
3403
+ questions_only: q.questions_only ?? null,
3404
+ topics_enabled: true,
3405
+ filter: filters,
3406
+ groups: q.groups ?? null,
3407
+ order: {
3408
+ direction: q.descending ? 1 : 0,
3409
+ field: q.sort_field ?? null
3410
+ },
3411
+ groups_order: {
3412
+ direction: 1,
3413
+ field: "relevance"
3414
+ }
3415
+ };
3416
+ if (method === "ideas.GetKeywords") params.page = {
3417
+ number: q.page ?? null,
3418
+ size: q.page_size ?? null
3419
+ };
3420
+ if (method === "ideas.GetGroups") params.groups_page = {
3421
+ number: q.page ?? null,
3422
+ size: q.page_size ?? null
3423
+ };
3424
+ return params;
3425
+ }
3426
+ function keywordParameters(definition, q) {
3427
+ const method = definition.method;
3428
+ if (!("keyword" in q)) return {};
3429
+ const params = {
3430
+ phrase: q.keyword ?? null,
3431
+ database: q.database ?? null,
3432
+ device: 0,
3433
+ currency: "USD",
3434
+ location: 0,
3435
+ date: ""
3436
+ };
3437
+ if (method.startsWith("ideas.")) Object.assign(params, {
3438
+ mode: 0,
3439
+ questions_only: q.questions_only ?? null
3440
+ });
3441
+ return params;
3442
+ }
3443
+ function domainParameters(definition, q) {
3444
+ const method = definition.method;
1982
3445
  if (!("domain" in q)) return { database: q.database ?? null };
1983
3446
  const params = {
1984
3447
  searchItem: q.domain ?? null,
@@ -2108,6 +3571,153 @@ function gapParameters(definition, q) {
2108
3571
  });
2109
3572
  return params;
2110
3573
  }
3574
+ /** Current project-selector and Crossroad web contracts. Control flags never go on wire. */
3575
+ function projectParameters(definition, q) {
3576
+ const path = definition.method;
3577
+ if (path === "/apis/v4-raw/folders/api/v0/folders" || definition.http_method === "PUT") {
3578
+ const properties = [];
3579
+ if (q.name !== void 0) properties.push({ name: { value: q.name } });
3580
+ if (q.domain !== void 0) properties.push({ domain: { value: q.domain } });
3581
+ return { properties };
3582
+ }
3583
+ if (path.endsWith("/leave/project-smb")) return { object_ids: [q.folder_id ?? null] };
3584
+ if (path.includes("/tags/")) return { tags: Array.isArray(q.tags) ? q.tags.map((name) => ({ name })) : [] };
3585
+ if (path.endsWith("/set-pinned")) return {
3586
+ id: q.folder_id ?? null,
3587
+ is_pinned: q.pinned ?? null
3588
+ };
3589
+ if (path.endsWith("/toolkits")) return {
3590
+ folders: q.folder_ids ?? [],
3591
+ withPromo: q.with_promo ?? false
3592
+ };
3593
+ if (path.endsWith("/tools")) return { items: Array.isArray(q.tools) ? q.tools.map((tool) => ({
3594
+ folder_id: q.folder_id ?? null,
3595
+ tool
3596
+ })) : [] };
3597
+ if (definition.http_method === "DELETE") return {};
3598
+ return Object.fromEntries(Object.entries(q).filter(([key]) => key !== "confirm" && key !== "dry_run"));
3599
+ }
3600
+ /** Fixed public request plans. RPC credentials enter only inside the browser layer. */
3601
+ function webRequest(definition, query) {
3602
+ if (definition.transport === "kwm") return {
3603
+ method: "POST",
3604
+ path: "/kwm/rpc",
3605
+ body: rpcBody(definition.method, reportParameters(definition, query))
3606
+ };
3607
+ return {
3608
+ method: definition.http_method,
3609
+ path: definition.method.replace("{folder_id}", String(query.folder_id)),
3610
+ body: reportParameters(definition, query)
3611
+ };
3612
+ }
3613
+ function previewMutation(name, definition, query) {
3614
+ return definition.mutation && query.dry_run === true ? {
3615
+ dry_run: true,
3616
+ report: name,
3617
+ request: webRequest(definition, query)
3618
+ } : void 0;
3619
+ }
3620
+ /** One JSON-RPC envelope for execution and credential-free previews. */
3621
+ function rpcBody(method, params) {
3622
+ return {
3623
+ id: 1,
3624
+ jsonrpc: "2.0",
3625
+ method,
3626
+ params
3627
+ };
3628
+ }
3629
+ /** Keyword Strategy Builder's casing differs from the keyword-research API. */
3630
+ function keywordListParameters(definition, q) {
3631
+ const method = definition.method;
3632
+ if (method === "user.GetInfo") return {};
3633
+ if (method === "baskets.BasketsGetAll") return {
3634
+ Order: {
3635
+ Direction: q.descending ? 1 : 0,
3636
+ Field: q.sort_field ?? null
3637
+ },
3638
+ Page: {
3639
+ Number: q.page ?? null,
3640
+ Size: q.page_size ?? null
3641
+ },
3642
+ Filter: {
3643
+ Name: q.name_filter ?? "",
3644
+ OwningType: q.ownership ?? 7
3645
+ }
3646
+ };
3647
+ if (method === "baskets.BasketCreate") return {
3648
+ Name: q.name ?? null,
3649
+ Clusterization: "seed_keywords" in q ? {
3650
+ Databases: [q.database ?? "us"],
3651
+ Domain: q.domain ?? "",
3652
+ Competitors: q.competitors ?? [],
3653
+ SeedPhrases: q.seed_keywords ?? []
3654
+ } : null
3655
+ };
3656
+ if (method === "baskets.BasketDelete") return { BasketIDs: [q.basket_id ?? null] };
3657
+ if (method === "baskets.KeywordsDeleteUndo") return { UndoID: q.undo_id ?? null };
3658
+ const shared = {
3659
+ BasketID: q.basket_id ?? null,
3660
+ OwnerID: q.owner_id ?? null
3661
+ };
3662
+ if (method === "baskets.BasketGetClusterizationStatuses") return { BasketIDs: [shared] };
3663
+ if (method === "baskets.BasketRename") return {
3664
+ ...shared,
3665
+ Name: q.name ?? null
3666
+ };
3667
+ if ("keywords" in q) {
3668
+ const phrases = Array.isArray(q.keywords) ? q.keywords : [];
3669
+ if (method === "baskets.KeywordsImport") return {
3670
+ ...shared,
3671
+ Keywords: phrases.map((Phrase) => ({
3672
+ Phrase,
3673
+ Database: q.database ?? "us",
3674
+ Tags: q.tags ?? []
3675
+ }))
3676
+ };
3677
+ const params = {
3678
+ ...shared,
3679
+ KeywordIDs: phrases.map((Phrase) => ({
3680
+ Phrase,
3681
+ Database: q.database ?? "us"
3682
+ }))
3683
+ };
3684
+ if ("tags" in q) params.Tags = q.tags ?? [];
3685
+ return params;
3686
+ }
3687
+ if ("filters" in q) {
3688
+ const filter = Object.fromEntries([
3689
+ "ClusterIDs",
3690
+ "Databases",
3691
+ "Phrase",
3692
+ "CompetitionLevel",
3693
+ "Cpc",
3694
+ "Difficulty",
3695
+ "SERPFeatures",
3696
+ "Volume",
3697
+ "ClickPotential",
3698
+ "Tags",
3699
+ "Intents"
3700
+ ].map((key) => [key, []]));
3701
+ Object.assign(filter, q.filters);
3702
+ if (method === "baskets.KeywordsGetSummary") return {
3703
+ ...shared,
3704
+ Filter: filter
3705
+ };
3706
+ return {
3707
+ ...shared,
3708
+ Filter: filter,
3709
+ Order: {
3710
+ Direction: q.descending ? 1 : 0,
3711
+ Field: q.sort_field ?? null
3712
+ },
3713
+ Page: {
3714
+ Number: q.page ?? null,
3715
+ Size: q.page_size ?? null
3716
+ }
3717
+ };
3718
+ }
3719
+ return shared;
3720
+ }
2111
3721
 
2112
3722
  //#endregion
2113
3723
  //#region src/errors.ts
@@ -2120,5 +3730,5 @@ var ReportError = class extends Schema.TaggedError()("ReportError", { message: S
2120
3730
  var UsageError = class extends Schema.TaggedError()("UsageError", { message: Schema.String }) {};
2121
3731
 
2122
3732
  //#endregion
2123
- export { reports as a, reportParameters as i, SessionError as n, version as o, UsageError as r, ReportError as t };
2124
- //# sourceMappingURL=errors-BhvanypE.js.map
3733
+ export { reportParameters as a, version as c, previewMutation as i, webRequest as l, SessionError as n, reports as o, UsageError as r, rpcBody as s, ReportError as t };
3734
+ //# sourceMappingURL=errors-CU9T4acd.js.map