@haakco/custd-sdk 0.0.0-stage → 3.71.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.
Files changed (196) hide show
  1. package/README.md +958 -2
  2. package/dist/admin-accounting-evidence.d.ts +48 -0
  3. package/dist/admin-accounting-evidence.js +24 -0
  4. package/dist/admin-app-releases.d.ts +116 -0
  5. package/dist/admin-app-releases.js +8 -0
  6. package/dist/admin-apps.d.ts +120 -0
  7. package/dist/admin-apps.js +47 -0
  8. package/dist/admin-auth-project-domain.d.ts +125 -0
  9. package/dist/admin-auth-project-domain.js +37 -0
  10. package/dist/admin-auth-projects.d.ts +989 -0
  11. package/dist/admin-auth-projects.js +527 -0
  12. package/dist/admin-campaign-email.d.ts +120 -0
  13. package/dist/admin-campaign-email.js +64 -0
  14. package/dist/admin-client-setup.d.ts +122 -0
  15. package/dist/admin-client-setup.js +408 -0
  16. package/dist/admin-data-labels.d.ts +124 -0
  17. package/dist/admin-data-labels.js +51 -0
  18. package/dist/admin-data-scopes.d.ts +93 -0
  19. package/dist/admin-data-scopes.js +154 -0
  20. package/dist/admin-email-relay.d.ts +66 -0
  21. package/dist/admin-email-relay.js +25 -0
  22. package/dist/admin-environment-policy.d.ts +32 -0
  23. package/dist/admin-environment-policy.js +26 -0
  24. package/dist/admin-error-issues.d.ts +91 -0
  25. package/dist/admin-error-issues.js +52 -0
  26. package/dist/admin-event-types.d.ts +57 -0
  27. package/dist/admin-event-types.js +28 -0
  28. package/dist/admin-impersonation.d.ts +48 -0
  29. package/dist/admin-impersonation.js +27 -0
  30. package/dist/admin-ingest-claims.d.ts +35 -0
  31. package/dist/admin-ingest-claims.js +26 -0
  32. package/dist/admin-managed-audit.d.ts +13 -0
  33. package/dist/admin-managed-audit.js +13 -0
  34. package/dist/admin-measurement-projects.d.ts +166 -0
  35. package/dist/admin-measurement-projects.js +120 -0
  36. package/dist/admin-notification-destinations.d.ts +31 -0
  37. package/dist/admin-notification-destinations.js +19 -0
  38. package/dist/admin-notification-webhooks.d.ts +64 -0
  39. package/dist/admin-notification-webhooks.js +42 -0
  40. package/dist/admin-oauth-client-admissions.d.ts +65 -0
  41. package/dist/admin-oauth-client-admissions.js +46 -0
  42. package/dist/admin-offboarding.d.ts +123 -0
  43. package/dist/admin-offboarding.js +129 -0
  44. package/dist/admin-predictions.d.ts +266 -0
  45. package/dist/admin-predictions.js +93 -0
  46. package/dist/admin-privacy-erasures.d.ts +74 -0
  47. package/dist/admin-privacy-erasures.js +73 -0
  48. package/dist/admin-retention.d.ts +99 -0
  49. package/dist/admin-retention.js +60 -0
  50. package/dist/admin-rls.d.ts +94 -0
  51. package/dist/admin-rls.js +33 -0
  52. package/dist/admin-sdk-usage.d.ts +41 -0
  53. package/dist/admin-sdk-usage.js +23 -0
  54. package/dist/admin-site-ai.d.ts +72 -0
  55. package/dist/admin-site-ai.js +1 -0
  56. package/dist/admin-site-analytics.d.ts +52 -0
  57. package/dist/admin-site-analytics.js +14 -0
  58. package/dist/admin-site-audit-pages.d.ts +76 -0
  59. package/dist/admin-site-audit-pages.js +27 -0
  60. package/dist/admin-site-campaign-links.d.ts +40 -0
  61. package/dist/admin-site-campaign-links.js +9 -0
  62. package/dist/admin-site-domains.d.ts +733 -0
  63. package/dist/admin-site-domains.js +768 -0
  64. package/dist/admin-site-export.d.ts +76 -0
  65. package/dist/admin-site-export.js +15 -0
  66. package/dist/admin-site-insights-tasks.d.ts +44 -0
  67. package/dist/admin-site-insights-tasks.js +28 -0
  68. package/dist/admin-site-insights.d.ts +527 -0
  69. package/dist/admin-site-insights.js +61 -0
  70. package/dist/admin-site-links.d.ts +87 -0
  71. package/dist/admin-site-links.js +16 -0
  72. package/dist/admin-site-monitors.d.ts +110 -0
  73. package/dist/admin-site-monitors.js +25 -0
  74. package/dist/admin-site-next-actions.d.ts +93 -0
  75. package/dist/admin-site-next-actions.js +36 -0
  76. package/dist/admin-site-page-queries.d.ts +63 -0
  77. package/dist/admin-site-page-queries.js +20 -0
  78. package/dist/admin-site-rankings.d.ts +98 -0
  79. package/dist/admin-site-rankings.js +46 -0
  80. package/dist/admin-site-regional-trends.d.ts +30 -0
  81. package/dist/admin-site-regional-trends.js +1 -0
  82. package/dist/admin-site-saved-reports.d.ts +45 -0
  83. package/dist/admin-site-saved-reports.js +13 -0
  84. package/dist/admin-site-search-pool.d.ts +77 -0
  85. package/dist/admin-site-search-pool.js +41 -0
  86. package/dist/admin-site-search-value.d.ts +97 -0
  87. package/dist/admin-site-search-value.js +29 -0
  88. package/dist/admin-site-status-page.d.ts +57 -0
  89. package/dist/admin-site-status-page.js +10 -0
  90. package/dist/admin-site-traffic.d.ts +145 -0
  91. package/dist/admin-site-traffic.js +32 -0
  92. package/dist/admin-site-web-data.d.ts +258 -0
  93. package/dist/admin-site-web-data.js +60 -0
  94. package/dist/admin-subject-exports.d.ts +79 -0
  95. package/dist/admin-subject-exports.js +44 -0
  96. package/dist/admin-support-access.d.ts +32 -0
  97. package/dist/admin-support-access.js +21 -0
  98. package/dist/admin-system.d.ts +283 -0
  99. package/dist/admin-system.js +65 -0
  100. package/dist/admin-tenant-storage.d.ts +35 -0
  101. package/dist/admin-tenant-storage.js +24 -0
  102. package/dist/admin-timeplans.d.ts +512 -0
  103. package/dist/admin-timeplans.js +200 -0
  104. package/dist/admin-uncertainty-models.d.ts +42 -0
  105. package/dist/admin-uncertainty-models.js +53 -0
  106. package/dist/admin-usage.d.ts +124 -0
  107. package/dist/admin-usage.js +169 -0
  108. package/dist/admin-users.d.ts +124 -0
  109. package/dist/admin-users.js +82 -0
  110. package/dist/admin-workflow-timings.d.ts +367 -0
  111. package/dist/admin-workflow-timings.js +117 -0
  112. package/dist/analytics-events.d.ts +167 -0
  113. package/dist/analytics-events.js +197 -0
  114. package/dist/analytics-reads.d.ts +81 -0
  115. package/dist/analytics-reads.js +5 -0
  116. package/dist/app-account.d.ts +84 -0
  117. package/dist/app-account.js +177 -0
  118. package/dist/app-alerts.d.ts +120 -0
  119. package/dist/app-alerts.js +44 -0
  120. package/dist/app-items.d.ts +786 -0
  121. package/dist/app-items.js +524 -0
  122. package/dist/app-live.d.ts +84 -0
  123. package/dist/app-live.js +228 -0
  124. package/dist/app-meetings.d.ts +95 -0
  125. package/dist/app-meetings.js +26 -0
  126. package/dist/app-models.d.ts +271 -0
  127. package/dist/app-models.js +83 -0
  128. package/dist/app-push.d.ts +64 -0
  129. package/dist/app-push.js +178 -0
  130. package/dist/backend-lifecycle.d.ts +85 -0
  131. package/dist/backend-lifecycle.js +212 -0
  132. package/dist/browser-manifest.json +7 -0
  133. package/dist/browser-script-BWnwDjAC.js +711 -0
  134. package/dist/browser-script.d.ts +1 -0
  135. package/dist/browser-script.js +5 -0
  136. package/dist/browser-sign-in.d.ts +153 -0
  137. package/dist/browser-sign-in.js +410 -0
  138. package/dist/browser-tracker.d.ts +142 -0
  139. package/dist/browser-tracker.js +775 -0
  140. package/dist/browser-web-vitals.d.ts +22 -0
  141. package/dist/browser-web-vitals.js +116 -0
  142. package/dist/browser.d.ts +10 -0
  143. package/dist/browser.js +10 -0
  144. package/dist/download-stream.d.ts +16 -0
  145. package/dist/download-stream.js +55 -0
  146. package/dist/error-capture.d.ts +62 -0
  147. package/dist/error-capture.js +168 -0
  148. package/dist/hosted-app.d.ts +115 -0
  149. package/dist/hosted-app.js +275 -0
  150. package/dist/index.d.ts +2324 -0
  151. package/dist/index.js +2226 -0
  152. package/dist/ingest-operations.d.ts +483 -0
  153. package/dist/ingest-operations.js +154 -0
  154. package/dist/measurement.d.ts +164 -0
  155. package/dist/measurement.js +104 -0
  156. package/dist/mobile-adapter.d.ts +25 -0
  157. package/dist/mobile-adapter.js +57 -0
  158. package/dist/mobile-context.d.ts +32 -0
  159. package/dist/mobile-context.js +156 -0
  160. package/dist/mobile-queue.d.ts +22 -0
  161. package/dist/mobile-queue.js +73 -0
  162. package/dist/oauth.d.ts +1 -0
  163. package/dist/oauth.js +8 -0
  164. package/dist/parsers.d.ts +149 -0
  165. package/dist/parsers.js +115 -0
  166. package/dist/public-reads.d.ts +79 -0
  167. package/dist/public-reads.js +57 -0
  168. package/dist/reporting-catalogue.d.ts +264 -0
  169. package/dist/reporting-catalogue.js +5 -0
  170. package/dist/reporting-state.d.ts +46 -0
  171. package/dist/reporting-state.js +76 -0
  172. package/dist/response-lists.d.ts +16 -0
  173. package/dist/response-lists.generated.d.ts +7 -0
  174. package/dist/response-lists.generated.js +1927 -0
  175. package/dist/response-lists.js +70 -0
  176. package/dist/response-validation.d.ts +30 -0
  177. package/dist/response-validation.js +94 -0
  178. package/dist/runtime-readiness.d.ts +30 -0
  179. package/dist/runtime-readiness.js +150 -0
  180. package/dist/schema-registry.d.ts +45 -0
  181. package/dist/schema-registry.js +9 -0
  182. package/dist/secure-url.d.ts +4 -0
  183. package/dist/secure-url.js +23 -0
  184. package/dist/site-ai-owner.d.ts +34 -0
  185. package/dist/site-ai-owner.js +99 -0
  186. package/dist/site-monitor-reports.d.ts +15 -0
  187. package/dist/site-monitor-reports.js +87 -0
  188. package/dist/testing/fake-custd.d.ts +150 -0
  189. package/dist/testing/fake-custd.js +842 -0
  190. package/dist/testing/fake-results.d.ts +30 -0
  191. package/dist/testing/fake-results.js +293 -0
  192. package/dist/testing.d.ts +2 -0
  193. package/dist/testing.js +3 -0
  194. package/dist/version.d.ts +10 -0
  195. package/dist/version.js +10 -0
  196. package/package.json +57 -4
@@ -0,0 +1,768 @@
1
+ // SiteDomainAdminClient claims, verifies, audits and checks the domains a Site
2
+ // serves, and reads their findings, outages, alert address and search numbers.
3
+ // The routes live on the top-level /api/v1/site-domains surface, not under
4
+ // /api/v1/admin. A system administrator names the tenant with `companySlug`;
5
+ // a site-bound credential (site_domains.manage) reaches its own Site only.
6
+ /** A 409 on requestAudit: the tenant has not proven control of the domain yet. */
7
+ export const SITE_DOMAIN_NOT_VERIFIED_CODE = "site_domain_not_verified";
8
+ /** A 409 on connectSearch: this Custd deployment has no account or key for the provider. */
9
+ export const SITE_SEARCH_NOT_CONFIGURED_CODE = "site_search_not_configured";
10
+ /** A 404 on disconnectSearch: the domain is not connected to that provider. */
11
+ export const SITE_SEARCH_CONNECTION_NOT_FOUND_CODE = "site_search_connection_not_found";
12
+ /** A 409 on retrySearchImport: only a failing connection retries now; reconnect a revoked one. */
13
+ export const SITE_SEARCH_RETRY_NOT_FAILING_CODE = "site_search_retry_not_failing";
14
+ /**
15
+ * The stable rule IDs a SiteFinding carries in `rule`, from Custd's siteaudit
16
+ * rule catalogue. Key a client-side fix or display on these, never on the title.
17
+ * New rules can appear in findings before an SDK release names them.
18
+ */
19
+ export const SiteRule = {
20
+ PageStatus: "crawl.page-status",
21
+ RedirectChain: "crawl.redirect-chain",
22
+ Soft404: "crawl.soft-404",
23
+ HTTPSRedirect: "host.https-redirect",
24
+ CanonicalHost: "host.canonical-host",
25
+ RobotsMissing: "robots.missing",
26
+ RobotsInvalid: "robots.invalid",
27
+ RobotsNoSitemap: "robots.no-sitemap",
28
+ SitemapMissing: "sitemap.missing",
29
+ SitemapInvalid: "sitemap.invalid",
30
+ SitemapURLStatus: "sitemap.url-not-ok",
31
+ SitemapNoindex: "sitemap.noindex-url",
32
+ SitemapLastmod: "sitemap.lastmod-missing",
33
+ CanonicalMissing: "canonical.missing",
34
+ CanonicalInvalid: "canonical.invalid",
35
+ CanonicalNotOK: "canonical.not-ok",
36
+ TitleMissing: "title.missing",
37
+ TitleLength: "title.length",
38
+ TitleDuplicate: "title.duplicate",
39
+ DescMissing: "description.missing",
40
+ DescLength: "description.length",
41
+ DescDuplicate: "description.duplicate",
42
+ HeadingH1: "heading.h1",
43
+ LangMissing: "html.lang-missing",
44
+ HTMLTooLarge: "html.too-large",
45
+ OpenGraphMissing: "og.missing",
46
+ OpenGraphImageMissing: "og.image-missing",
47
+ OpenGraphImageUnreachable: "og.image-unreachable",
48
+ TwitterCardMissing: "twitter.card-missing",
49
+ ImageAltMissing: "image.alt-missing",
50
+ ImageTooLarge: "image.too-large",
51
+ ImageLegacyFormat: "image.legacy-format",
52
+ ImageDimensions: "image.missing-dimensions",
53
+ ImageNotLazy: "image.not-lazy",
54
+ NoCompression: "http.no-compression",
55
+ StaticCache: "cache.static-assets",
56
+ JSRequired: "ai.js-required",
57
+ AnswerBotBlocked: "ai.answer-bot-blocked",
58
+ TrainingBlocked: "ai.training-bot-blocked",
59
+ BotRefused: "ai.bot-refused",
60
+ JSONLDMissing: "jsonld.missing",
61
+ JSONLDInvalid: "jsonld.invalid",
62
+ JSONLDNoEntity: "jsonld.no-entity",
63
+ LLMSMissing: "llms.missing",
64
+ LLMSInvalid: "llms.invalid",
65
+ RedirectLoop: "crawl.redirect-loop",
66
+ OrphanPage: "crawl.orphan-page",
67
+ DeepPage: "crawl.deep-page",
68
+ NoInternalLinks: "crawl.no-internal-links",
69
+ NoindexPage: "crawl.noindex-page",
70
+ HomeNoindex: "crawl.home-noindex",
71
+ NofollowPage: "robots.nofollow",
72
+ CanonicalElsewhere: "canonical.points-elsewhere",
73
+ CanonicalConflict: "canonical.conflict",
74
+ HeadingSkip: "heading.order-skip",
75
+ ThinContent: "content.thin",
76
+ DuplicateContent: "content.duplicate",
77
+ NearDuplicate: "content.near-duplicate",
78
+ HreflangInvalidCode: "hreflang.invalid-code",
79
+ HreflangMissingSelf: "hreflang.missing-self-reference",
80
+ HreflangMissingReturn: "hreflang.missing-return-link",
81
+ HreflangMissingXDefault: "hreflang.missing-x-default",
82
+ HreflangTargetNotIndexable: "hreflang.target-not-indexable",
83
+ SlowResponse: "http.slow-response",
84
+ UptimeDown: "uptime.down",
85
+ UptimeSlow: "uptime.slow",
86
+ TLSInvalid: "tls.invalid",
87
+ TLSExpiring: "tls.expiring",
88
+ TLSExpiringSoon: "tls.expiring-soon",
89
+ RegistrationExpiring: "registration.expiring",
90
+ LighthouseDesktopDrop: "lighthouse.desktop-score-drop",
91
+ LighthouseMobileDrop: "lighthouse.mobile-score-drop",
92
+ SearchLowCTR: "search.low-ctr",
93
+ SearchPositionDrop: "search.position-drop",
94
+ BrokenFragment: "crawl.broken-fragment",
95
+ SitemapBlockedURL: "sitemap.blocked-url",
96
+ LogsCrawlerNotFound: "logs.crawler-not-found",
97
+ };
98
+ export const SITE_FINDING_DISMISSAL_SCOPES = {
99
+ rule: "rule",
100
+ url: "url",
101
+ };
102
+ export const SITE_BROWSER_COLLECTOR_MODES = {
103
+ enabled: "enabled",
104
+ disabled: "disabled",
105
+ };
106
+ const siteDomainsPath = "/site-domains";
107
+ const siteAISettingsPath = `${siteDomainsPath}/ai-settings`;
108
+ const searchPoolPath = `${siteDomainsPath}/search-pool`;
109
+ const keywordListsPath = `${siteDomainsPath}/keyword-lists`;
110
+ export class SiteDomainAdminClient {
111
+ constructor(request) {
112
+ this.request = request;
113
+ }
114
+ /** Reads the domain's network checks and their latest results. */
115
+ listProbes(domainUuid, options) {
116
+ return this.send("GET", `${domainPath(domainUuid)}/probes`, {}, undefined, options);
117
+ }
118
+ /** Replaces the domain's network checks. Pass an empty array to disable them. */
119
+ setProbes(domainUuid, probes, options) {
120
+ return this.send("PUT", `${domainPath(domainUuid)}/probes`, {}, { probes }, options);
121
+ }
122
+ /** Claims a host for a Site and returns the verification instructions. */
123
+ create(body, options) {
124
+ return this.send("POST", siteDomainsPath, {}, body, options);
125
+ }
126
+ /** Lists one Site's domains. A site-bound credential may omit siteUuid for its own Site. */
127
+ list(siteUuid, options) {
128
+ return this.send("GET", siteDomainsPath, { siteUuid }, undefined, options);
129
+ }
130
+ get(domainUuid, options) {
131
+ return this.send("GET", domainPath(domainUuid), {}, undefined, options);
132
+ }
133
+ /**
134
+ * Checks the DNS record or well-known file now. An unproven domain comes back
135
+ * with ownership.verified false and the reason in ownership.lastCheckFailure.
136
+ */
137
+ verify(domainUuid, options) {
138
+ return this.send("POST", `${domainPath(domainUuid)}/verify`, {}, undefined, options);
139
+ }
140
+ /**
141
+ * Attests that this credential has proven the tenant controls the domain,
142
+ * which verifies it (verifiedBy "attested") and its subdomains. Only a
143
+ * site-bound credential holding site_domains.attest may attest its own Site's domains.
144
+ */
145
+ attest(domainUuid, options) {
146
+ return this.send("POST", `${domainPath(domainUuid)}/attestation`, {}, undefined, options);
147
+ }
148
+ /** Withdraws this credential's attestation; the domain stays verified only by its own proof or a verified parent. */
149
+ unattest(domainUuid, options) {
150
+ return this.send("DELETE", `${domainPath(domainUuid)}/attestation`, {}, undefined, options);
151
+ }
152
+ /** Queues an audit for the scheduler's next tick. An unverified domain is refused with SITE_DOMAIN_NOT_VERIFIED_CODE. */
153
+ requestAudit(domainUuid, options) {
154
+ return this.send("POST", `${domainPath(domainUuid)}/audit`, {}, undefined, options);
155
+ }
156
+ /** Lists a domain's findings, most severe first. An omitted state lets the server default to open. */
157
+ listFindings(domainUuid, state, options) {
158
+ return this.send("GET", `${domainPath(domainUuid)}/findings`, { state }, undefined, options);
159
+ }
160
+ /** Removes a domain and its findings. */
161
+ delete(domainUuid, options) {
162
+ return this.send("DELETE", domainPath(domainUuid), {}, undefined, options);
163
+ }
164
+ /** Chooses how a domain is checked. It works before verification, so a domain can be paused before its first check. */
165
+ setCheckMode(domainUuid, mode, options) {
166
+ return this.send("PUT", `${domainPath(domainUuid)}/checks`, {}, { mode }, options);
167
+ }
168
+ /** Lists a domain's recent outages, newest first (at most twenty). */
169
+ listIncidents(domainUuid, options) {
170
+ return this.send("GET", `${domainPath(domainUuid)}/incidents`, {}, undefined, options);
171
+ }
172
+ /** Reads a Site's alert address. A site-bound credential may omit siteUuid. */
173
+ getAlertDestination(siteUuid, options) {
174
+ return this.send("GET", `${siteDomainsPath}/alert-destination`, { siteUuid }, undefined, options);
175
+ }
176
+ /** Emails a Site's alerts to emailRecipient, or back to the tenant's destinations when it is empty. */
177
+ setAlertDestination(body, options) {
178
+ return this.send("PUT", `${siteDomainsPath}/alert-destination`, { siteUuid: body.siteUuid }, { emailRecipient: body.emailRecipient }, options);
179
+ }
180
+ /** Reads which search providers this Custd deployment can import from. */
181
+ getSearchAccount(options) {
182
+ return this.send("GET", `${siteDomainsPath}/search-account`, {}, undefined, options);
183
+ }
184
+ /** Reads the tenant's AI policy and current provider terms version. */
185
+ getAISettings(options) {
186
+ return this.send("GET", siteAISettingsPath, {}, undefined, options);
187
+ }
188
+ /** Replaces the tenant's AI mode and cap. The API key is write-only. */
189
+ setAISettings(body, options) {
190
+ return this.send("PUT", siteAISettingsPath, {}, body, options);
191
+ }
192
+ /** Records explicit acceptance of the supplied terms version or revokes consent. */
193
+ setAIConsent(body, options) {
194
+ return this.send("PUT", `${siteAISettingsPath}/consent`, {}, body, options);
195
+ }
196
+ /** Creates a one-time code the tenant owner redeems by form POST to manage AI settings. */
197
+ createAIOwnerHandoff(body, options) {
198
+ return this.send("POST", `${siteDomainsPath}/ai-owner-handoffs`, {}, body, options);
199
+ }
200
+ /** Reads the tenant's current UTC month's AI usage. */
201
+ getAIUsage(options) {
202
+ return this.send("GET", `${siteDomainsPath}/ai-usage`, {}, undefined, options);
203
+ }
204
+ /** Reads whether the tenant takes part in the shared search pool, and the pool's rules. */
205
+ getSearchPool(options) {
206
+ return this.send("GET", searchPoolPath, {}, undefined, options);
207
+ }
208
+ /** Joins (true) or leaves (false) the shared search pool for the whole tenant. */
209
+ /**
210
+ * Joins (with the terms version the caller accepted) or leaves the shared search pool.
211
+ * Joining without a termsVersion is refused before any request; leaving sends only joined.
212
+ */
213
+ setSearchPool(joined, termsVersion, options) {
214
+ if (!joined)
215
+ return this.send("PUT", searchPoolPath, {}, { joined }, options);
216
+ if (typeof termsVersion !== "string" || termsVersion.trim() === "") {
217
+ return Promise.reject(new Error("custd: joining the shared search pool needs the accepted termsVersion"));
218
+ }
219
+ return this.send("PUT", searchPoolPath, {}, { joined, termsVersion }, options);
220
+ }
221
+ /**
222
+ * Reads pooled queries matching `search` (at most 100 characters), `limit` 1..200; omitted, 50.
223
+ * Before joining it is refused with SITE_SEARCH_POOL_NOT_JOINED_CODE.
224
+ */
225
+ listSearchPoolQueries(search, limit, options) {
226
+ const query = { limit: limit?.toString(), search };
227
+ return this.send("GET", `${searchPoolPath}/queries`, query, undefined, options);
228
+ }
229
+ /** Reads a domain's search numbers over the last `days` days (1..90); omitted, the server uses 28. */
230
+ getSearchPerformance(domainUuid, days, options) {
231
+ return this.send("GET", `${domainPath(domainUuid)}/search`, { days: days?.toString() }, undefined, options);
232
+ }
233
+ /** Connects a domain to a provider, or replaces its property or key. Refused with SITE_SEARCH_NOT_CONFIGURED_CODE when the deployment lacks the provider. */
234
+ connectSearch(domainUuid, provider, body, options) {
235
+ return this.send("PUT", searchConnectionPath(domainUuid, provider), {}, body, options);
236
+ }
237
+ /** Removes a provider connection and the numbers imported through it. */
238
+ disconnectSearch(domainUuid, provider, options) {
239
+ return this.send("DELETE", searchConnectionPath(domainUuid, provider), {}, undefined, options);
240
+ }
241
+ /** Reads what the latest audit or recheck read from one page of the domain. */
242
+ /** Retries a failing search import now; anything else is refused with SITE_SEARCH_RETRY_NOT_FAILING_CODE. */
243
+ retrySearchImport(domainUuid, provider, options) {
244
+ return this.send("POST", `${searchConnectionPath(domainUuid, provider)}/retry`, {}, undefined, options);
245
+ }
246
+ /** Reads the searches one page shows for, with title options and pages that could link to it. */
247
+ getPageSearchQueries(domainUuid, url, options) {
248
+ return this.send("GET", `${domainPath(domainUuid)}/page-search-queries`, { url }, undefined, options);
249
+ }
250
+ /** Reads the domain's GA4 landing pages, key events and channels; empty until connected and imported. */
251
+ getAnalytics(domainUuid, options) {
252
+ return this.send("GET", analyticsPath(domainUuid), {}, undefined, options);
253
+ }
254
+ /** Connects the domain to a GA4 property; a bad ID is refused with SITE_ANALYTICS_PROPERTY_INVALID_CODE. */
255
+ connectAnalytics(domainUuid, body, options) {
256
+ const request = { propertyId: body.propertyId };
257
+ return this.send("PUT", `${analyticsPath(domainUuid)}/ga4`, {}, request, options);
258
+ }
259
+ /** Disconnects GA4; an unconnected domain is refused with SITE_ANALYTICS_CONNECTION_NOT_FOUND_CODE. */
260
+ disconnectAnalytics(domainUuid, options) {
261
+ return this.send("DELETE", `${analyticsPath(domainUuid)}/ga4`, {}, undefined, options);
262
+ }
263
+ /** Exports everything Site Insights holds for the domain and its Site, except the daily search metrics. */
264
+ getExport(domainUuid, options) {
265
+ return this.send("GET", exportPath(domainUuid), {}, undefined, options);
266
+ }
267
+ /** Pages through the domain's daily search metrics; the export's search.metricRows is the total. */
268
+ listExportSearchMetrics(domainUuid, query = {}, options) {
269
+ const values = { offset: query.offset?.toString(), limit: query.limit?.toString() };
270
+ return this.send("GET", `${exportPath(domainUuid)}/search-metrics`, values, undefined, options);
271
+ }
272
+ /** Reads what the last audit or recheck saw on a page; an unread page is refused with SITE_PAGE_NOT_READ_CODE. */
273
+ getPageFacts(domainUuid, url, options) {
274
+ return this.send("GET", `${domainPath(domainUuid)}/page-facts`, { url }, undefined, options);
275
+ }
276
+ /**
277
+ * Queues one page of a verified domain for recheck (202). A page already queued comes back as it is;
278
+ * past the hourly allowance the server refuses with SITE_PAGE_RECHECK_LIMIT_CODE, and a page of
279
+ * another host with SITE_PAGE_NOT_ON_DOMAIN_CODE.
280
+ */
281
+ requestPageRecheck(domainUuid, url, options) {
282
+ return this.send("POST", `${domainPath(domainUuid)}/page-rechecks`, {}, { url }, options);
283
+ }
284
+ getPageRecheck(domainUuid, recheckUuid, options) {
285
+ const path = `${domainPath(domainUuid)}/page-rechecks/${encodeURIComponent(recheckUuid)}`;
286
+ return this.send("GET", path, {}, undefined, options);
287
+ }
288
+ /** Reads up to SITE_PAGE_RECHECK_READ_LIMIT of the domain's rechecks at once; unknown ids are left out. */
289
+ listPageRechecks(domainUuid, recheckUuids, options) {
290
+ return this.send("GET", `${domainPath(domainUuid)}/page-rechecks`, { ids: recheckUuids.join(",") }, undefined, options);
291
+ }
292
+ /** Runs the one-page checks on draft HTML, and the draft tools it asks for; nothing is fetched or stored. */
293
+ async checkPage(domainUuid, body, options) {
294
+ const request = { url: body.url, html: body.html };
295
+ if (body.previousUrl)
296
+ request.previousUrl = body.previousUrl;
297
+ if (body.phrase)
298
+ request.phrase = body.phrase;
299
+ if (body.scope)
300
+ request.scope = body.scope;
301
+ return this.send("POST", `${domainPath(domainUuid)}/page-check`, {}, request, options);
302
+ }
303
+ /** Measures how much wording two drafts share, as the near-duplicate rule does; nothing is stored. */
304
+ async compareWording(domainUuid, body, options) {
305
+ const request = { first: body.first, second: body.second };
306
+ const path = `${domainPath(domainUuid)}/wording-compare`;
307
+ return this.send("POST", path, {}, request, options);
308
+ }
309
+ /** Compares two stored page observations on a verified domain without fetching either URL. */
310
+ async comparePageWording(domainUuid, { firstUrl, secondUrl }, options) {
311
+ const path = `${domainPath(domainUuid)}/page-wording`;
312
+ return this.send("GET", path, { firstUrl, secondUrl }, undefined, options);
313
+ }
314
+ /** Tests a URL against a pasted robots.txt, or the domain's live file when robotsTxt is omitted. */
315
+ testRobots(domainUuid, body, options) {
316
+ const request = { url: body.url, userAgent: body.userAgent };
317
+ if (body.robotsTxt !== undefined)
318
+ request.robotsTxt = body.robotsTxt;
319
+ return this.send("POST", `${domainPath(domainUuid)}/robots-test`, {}, request, options);
320
+ }
321
+ /** Pages through one dimension of the domain's imported search rows; `unavailable` names providers without it. */
322
+ listSearchRows(domainUuid, query = {}, options) {
323
+ const values = {
324
+ dimension: query.dimension,
325
+ provider: query.provider,
326
+ days: query.days?.toString(),
327
+ offset: query.offset?.toString(),
328
+ limit: query.limit?.toString(),
329
+ };
330
+ return this.send("GET", `${domainPath(domainUuid)}/search/rows`, values, undefined, options);
331
+ }
332
+ /** Lists the domain's latest URL inspections and the tenant's daily use. */
333
+ listSearchInspections(domainUuid, options) {
334
+ return this.send("GET", `${domainPath(domainUuid)}/search/inspections`, {}, undefined, options);
335
+ }
336
+ /**
337
+ * Queues a Search Console URL Inspection (202). Refusals carry SITE_SEARCH_INSPECTION_URL_INVALID_CODE,
338
+ * SITE_SEARCH_INSPECTION_NOT_CONNECTED_CODE or SITE_SEARCH_INSPECTION_LIMIT_CODE.
339
+ */
340
+ requestSearchInspection(domainUuid, url, options) {
341
+ return this.send("POST", `${domainPath(domainUuid)}/search/inspections`, {}, { url }, options);
342
+ }
343
+ /** Reads a Site's brands, competitors and markets. A site-bound credential may omit siteUuid. */
344
+ getProjectContext(siteUuid, options) {
345
+ return this.send("GET", `${siteDomainsPath}/project-context`, { siteUuid }, undefined, options);
346
+ }
347
+ /** Replaces a Site's project context; an omitted list is sent empty and clears it. */
348
+ setProjectContext(body, options) {
349
+ const request = {
350
+ brandNames: body.brandNames ?? [],
351
+ competitorDomains: body.competitorDomains ?? [],
352
+ markets: body.markets ?? [],
353
+ hackerNewsEnabled: body.hackerNewsEnabled,
354
+ };
355
+ return this.send("PUT", `${siteDomainsPath}/project-context`, { siteUuid: body.siteUuid }, request, options);
356
+ }
357
+ /** Reads public trends matching a Site's audience and saved terms. A site token may omit siteUuid. */
358
+ getRegionalTrends(siteUuid, options) {
359
+ return this.send("GET", `${siteDomainsPath}/regional-trends`, { siteUuid }, undefined, options);
360
+ }
361
+ /** Reads the domain's status and its most important next actions, most important first. */
362
+ getNextActions(domainUuid, options) {
363
+ return this.send("GET", `${domainPath(domainUuid)}/next-actions`, {}, undefined, options);
364
+ }
365
+ /** Reads every domain's status, open findings and first action, worst first (only its own Site's for a site-bound credential). */
366
+ getPortfolioSummary(options) {
367
+ return this.send("GET", `${siteDomainsPath}/portfolio-summary`, {}, undefined, options);
368
+ }
369
+ /** Reads the client report without private verification or connection details, in options.template over options.days. */
370
+ getReport(domainUuid, options) {
371
+ const { template, days, ...requestOptions } = options ?? {};
372
+ const query = { template, days: days?.toString() };
373
+ return this.send("GET", `${domainPath(domainUuid)}/report`, query, undefined, requestOptions);
374
+ }
375
+ /** Reads uptime windows, ninety daily bars and hourly response times over `responseDays` (1..90). */
376
+ getUptimeHistory(domainUuid, responseDays, options) {
377
+ const query = { responseDays: responseDays?.toString() };
378
+ return this.send("GET", `${domainPath(domainUuid)}/uptime-history`, query, undefined, options);
379
+ }
380
+ /**
381
+ * Reads scheduled desktop and mobile lab runs over `days` (1..30); omitted, the server uses seven.
382
+ * options.url reads one extra page's runs instead of the home page's.
383
+ */
384
+ getLighthouseHistory(domainUuid, days, options) {
385
+ const { url, ...requestOptions } = options ?? {};
386
+ const query = { days: days?.toString(), url };
387
+ return this.send("GET", `${domainPath(domainUuid)}/lighthouse`, query, undefined, requestOptions);
388
+ }
389
+ /** Reads the extra pages Lighthouse measures beside the home page. */
390
+ getLighthousePages(domainUuid, options) {
391
+ return this.send("GET", `${domainPath(domainUuid)}/lighthouse/pages`, {}, undefined, options);
392
+ }
393
+ /** Replaces the extra pages (at most five); an empty list clears them. Refused with SITE_LIGHTHOUSE_PAGE_NOT_EXTRA_CODE. */
394
+ setLighthousePages(domainUuid, urls, options) {
395
+ return this.send("PUT", `${domainPath(domainUuid)}/lighthouse/pages`, {}, { urls: [...urls] }, options);
396
+ }
397
+ /** Pages through the URLs the latest audit crawled; the server defaults limit to 50 (at most 200). */
398
+ listAuditPages(domainUuid, offset, limit, options) {
399
+ const query = { offset: offset?.toString(), limit: limit?.toString() };
400
+ return this.send("GET", `${domainPath(domainUuid)}/audit-pages`, query, undefined, options);
401
+ }
402
+ /** Reads the findings the latest audit opened, reopened and fixed. */
403
+ getAuditDelta(domainUuid, options) {
404
+ return this.send("GET", `${domainPath(domainUuid)}/audit-delta`, {}, undefined, options);
405
+ }
406
+ /** Lists the domain's saved reports, newest content first. */
407
+ listSavedReports(domainUuid, options) {
408
+ return this.send("GET", savedReportsPath(domainUuid), {}, undefined, options);
409
+ }
410
+ /** Generates and saves a report. Refused with SAVED_SITE_REPORT_NAME_TAKEN_CODE or SAVED_SITE_REPORT_LIMIT_CODE. */
411
+ saveReport(domainUuid, body, options) {
412
+ return this.send("POST", savedReportsPath(domainUuid), {}, savedReportBody(body), options);
413
+ }
414
+ getSavedReport(domainUuid, reportUuid, options) {
415
+ return this.send("GET", savedReportPath(domainUuid, reportUuid), {}, undefined, options);
416
+ }
417
+ /** Renames or regenerates a saved report; its shares open the new content. */
418
+ replaceSavedReport(domainUuid, reportUuid, body, options) {
419
+ return this.send("PUT", savedReportPath(domainUuid, reportUuid), {}, savedReportBody(body), options);
420
+ }
421
+ /** Deletes a saved report. */
422
+ deleteSavedReport(domainUuid, reportUuid, options) {
423
+ return this.send("DELETE", savedReportPath(domainUuid, reportUuid), {}, undefined, options);
424
+ }
425
+ /** Lists the domain's active campaign links, newest first, and archived ones too with includeArchived. */
426
+ listCampaignLinks(domainUuid, includeArchived = false, options) {
427
+ const query = { archived: includeArchived ? "true" : undefined };
428
+ return this.send("GET", campaignLinksPath(domainUuid), query, undefined, options);
429
+ }
430
+ /**
431
+ * Saves a tagged page link (201). Refused with SITE_CAMPAIGN_LINK_TAKEN_CODE or
432
+ * SITE_CAMPAIGN_LINK_LIMIT_CODE, and a page of another host with SITE_PAGE_NOT_ON_DOMAIN_CODE.
433
+ */
434
+ createCampaignLink(domainUuid, body, options) {
435
+ const request = {
436
+ url: body.url,
437
+ source: body.source,
438
+ medium: body.medium,
439
+ campaign: body.campaign,
440
+ };
441
+ if (body.term)
442
+ request.term = body.term;
443
+ if (body.content)
444
+ request.content = body.content;
445
+ return this.send("POST", campaignLinksPath(domainUuid), {}, request, options);
446
+ }
447
+ /** Archives a link: it stays listed with archived links and its tagged URL is free again. */
448
+ archiveCampaignLink(domainUuid, linkUuid, options) {
449
+ const path = `${campaignLinksPath(domainUuid)}/${encodeURIComponent(linkUuid)}/archive`;
450
+ return this.send("POST", path, {}, undefined, options);
451
+ }
452
+ /** Reads the Site's saved status-page draft and current publication, if any. */
453
+ getStatusPageSettings(domainUuid, options) {
454
+ return this.send("GET", statusPagePath(domainUuid), {}, undefined, options);
455
+ }
456
+ /** Shows the selected components as customers would see them, without publishing. */
457
+ previewStatusPage(domainUuid, draft, options) {
458
+ return this.send("POST", `${statusPagePath(domainUuid)}/preview`, {}, draft, options);
459
+ }
460
+ /** Publishes the selected components; build the customer link with siteStatusPagePublicUrl. */
461
+ publishStatusPage(domainUuid, draft, options) {
462
+ return this.send("PUT", statusPagePath(domainUuid), {}, draft, options);
463
+ }
464
+ /** Removes public access and keeps the draft. */
465
+ unpublishStatusPage(domainUuid, options) {
466
+ return this.send("DELETE", statusPagePath(domainUuid), {}, undefined, options);
467
+ }
468
+ /** Publishes a reviewed message and notifies confirmed subscribers; requestUuid makes a retry safe. */
469
+ postStatusPageUpdate(domainUuid, request, options) {
470
+ return this.send("POST", `${statusPagePath(domainUuid)}/updates`, {}, request, options);
471
+ }
472
+ /** Lists live report shares. Tokens are returned only on creation. */
473
+ listReportShares(domainUuid, options) {
474
+ return this.send("GET", `${domainPath(domainUuid)}/report-shares`, {}, undefined, options);
475
+ }
476
+ /** Creates a public report share. Copy the token once; creation is never retried automatically. */
477
+ createReportShare(domainUuid, body = {}, options) {
478
+ const request = { expiresInDays: body.expiresInDays ?? 30 };
479
+ if (body.reportUuid)
480
+ request.reportUuid = body.reportUuid;
481
+ return this.send("POST", `${domainPath(domainUuid)}/report-shares`, {}, request, options);
482
+ }
483
+ /** Revokes a share; later public reads fail. */
484
+ revokeReportShare(domainUuid, shareUuid, options) {
485
+ const path = `${domainPath(domainUuid)}/report-shares/${encodeURIComponent(shareUuid)}`;
486
+ return this.send("DELETE", path, {}, undefined, options);
487
+ }
488
+ /** Reads the domain's IndexNow setup, today's use and its recent submissions. */
489
+ getIndexNow(domainUuid, options) {
490
+ return this.send("GET", indexNowPath(domainUuid), {}, undefined, options);
491
+ }
492
+ /** Enables IndexNow and returns the key to host at keyLocation. An unverified domain is refused with SITE_INDEXNOW_DOMAIN_UNVERIFIED_CODE. */
493
+ enableIndexNow(domainUuid, options) {
494
+ return this.send("PUT", indexNowPath(domainUuid), {}, undefined, options);
495
+ }
496
+ /** Disables IndexNow for the domain. */
497
+ disableIndexNow(domainUuid, options) {
498
+ return this.send("DELETE", indexNowPath(domainUuid), {}, undefined, options);
499
+ }
500
+ /** Checks the hosted key file now. A failed check is not an error: it comes back in lastCheckFailure. */
501
+ verifyIndexNowKey(domainUuid, options) {
502
+ return this.send("POST", `${indexNowPath(domainUuid)}/verify`, {}, undefined, options);
503
+ }
504
+ /**
505
+ * Queues URLs for IndexNow (202). Refusals carry SITE_INDEXNOW_NOT_ENABLED_CODE,
506
+ * SITE_INDEXNOW_KEY_UNVERIFIED_CODE, SITE_INDEXNOW_URLS_INVALID_CODE or SITE_INDEXNOW_LIMIT_CODE.
507
+ */
508
+ submitIndexNow(domainUuid, body, options) {
509
+ return this.send("POST", `${indexNowPath(domainUuid)}/submissions`, {}, { urls: body.urls }, options);
510
+ }
511
+ /** Reads the Site's own and competitor domains and their inventory state. */
512
+ getWebDomains(siteUuid, options) {
513
+ return this.send("GET", `${siteDomainsPath}/web-domains`, { siteUuid }, undefined, options);
514
+ }
515
+ /** Pages through one inventoried domain's URLs; pass the previous page's `next` as `after`. */
516
+ listWebPages(domain, query = {}, options) {
517
+ const values = { siteUuid: query.siteUuid, domain, after: query.after, limit: query.limit?.toString() };
518
+ return this.send("GET", `${siteDomainsPath}/web-pages`, values, undefined, options);
519
+ }
520
+ /** Reads the domains linking to one of the Site's web domains, per source, with its authority and lost links. */
521
+ getReferringDomains(domain, siteUuid, options) {
522
+ return this.send("GET", `${siteDomainsPath}/referring-domains`, { domain, siteUuid }, undefined, options);
523
+ }
524
+ /** Reads monthly Wikipedia interest in the Site's brands and seed term. */
525
+ getTopicTrends(siteUuid, options) {
526
+ return this.send("GET", `${siteDomainsPath}/topic-trends`, { siteUuid }, undefined, options);
527
+ }
528
+ /** Reads the topics competitors cover and the Site does not, optionally around a seed term. */
529
+ getContentGap(siteUuid, seed, options) {
530
+ return this.send("GET", `${siteDomainsPath}/content-gap`, { siteUuid, seed }, undefined, options);
531
+ }
532
+ listKeywordLists(siteUuid, options) {
533
+ return this.send("GET", keywordListsPath, { siteUuid }, undefined, options);
534
+ }
535
+ /** Creates or replaces the named list. A new list past the limit is refused with SITE_KEYWORD_LIST_LIMIT_CODE. */
536
+ saveKeywordList(body, siteUuid, options) {
537
+ const request = { name: body.name, keywords: [...body.keywords] };
538
+ if (body.seedTerm)
539
+ request.seedTerm = body.seedTerm;
540
+ if (body.marketSampleEnabled !== undefined)
541
+ request.marketSampleEnabled = body.marketSampleEnabled;
542
+ return this.send("PUT", keywordListsPath, { siteUuid }, request, options);
543
+ }
544
+ /** Deletes the named list. An unknown name is refused with SITE_KEYWORD_LIST_NOT_FOUND_CODE. */
545
+ deleteKeywordList(name, siteUuid, options) {
546
+ return this.send("DELETE", keywordListsPath, { siteUuid, name }, undefined, options);
547
+ }
548
+ /** Groups the named list's keywords by shared stem with the Site's own search numbers. */
549
+ getKeywordClusters(name, siteUuid, options) {
550
+ return this.send("GET", `${siteDomainsPath}/keyword-clusters`, { siteUuid, name }, undefined, options);
551
+ }
552
+ /** Compares search for a finding's page over `days` (7..90) before and after it was fixed; omitted, 28. */
553
+ getFindingSearchImpact(domainUuid, findingUuid, days, options) {
554
+ const path = `${domainPath(domainUuid)}/findings/${encodeURIComponent(findingUuid)}/search-impact`;
555
+ return this.send("GET", path, { days: days?.toString() }, undefined, options);
556
+ }
557
+ /** Reads search landing pages with the goal events (1..5 event types) credited to them over `days` (1..90). */
558
+ getSearchValue(domainUuid, goals, days, options) {
559
+ const query = { goal: [...goals], days: days?.toString() };
560
+ return this.send("GET", `${domainPath(domainUuid)}/search-value`, query, undefined, options);
561
+ }
562
+ /** Reads the domain's access-log traffic over UTC days `from`..`to` (YYYY-MM-DD); omitted, the server picks them. */
563
+ getTraffic(domainUuid, from, to, options) {
564
+ return this.send("GET", `${domainPath(domainUuid)}/traffic`, { from, to }, undefined, options);
565
+ }
566
+ /** Reads AI crawler requests and AI-assistant referrals over UTC days `from`..`to`. */
567
+ getAIVisibility(domainUuid, from, to, options) {
568
+ return this.send("GET", `${domainPath(domainUuid)}/ai-visibility`, { from, to }, undefined, options);
569
+ }
570
+ /**
571
+ * Has the access-log task read one UTC hour again (202). System administrators only; the route is
572
+ * platform-wide. A bad hour is refused with ACCESS_LOG_HOUR_INVALID_CODE.
573
+ */
574
+ replayAccessLogHour(hourStart, options) {
575
+ const body = { hourStart: typeof hourStart === "string" ? hourStart : utcSeconds(hourStart) };
576
+ return this.send("POST", "/admin/access-log-hours/replay", {}, body, options);
577
+ }
578
+ /** Reads tracked keywords and each day's rank over `days` (1..90); omitted, the server uses 28. */
579
+ getRankings(domainUuid, days, options) {
580
+ return this.send("GET", `${domainPath(domainUuid)}/rankings`, { days: days?.toString() }, undefined, options);
581
+ }
582
+ /**
583
+ * Starts tracking a keyword (201). Refusals carry SITE_TRACKED_KEYWORD_INVALID_CODE,
584
+ * SITE_TRACKED_KEYWORD_LIMIT_CODE or SITE_TRACKED_KEYWORD_DUPLICATE_CODE.
585
+ */
586
+ trackKeyword(domainUuid, body, options) {
587
+ const request = { keyword: body.keyword };
588
+ if (body.country)
589
+ request.country = body.country;
590
+ if (body.device)
591
+ request.device = body.device;
592
+ if (body.notifyPosition !== undefined)
593
+ request.notifyPosition = body.notifyPosition;
594
+ return this.send("POST", rankingKeywordsPath(domainUuid), {}, request, options);
595
+ }
596
+ /** Pauses or resumes a keyword and, when notifyPosition is set, changes its alert position. */
597
+ updateTrackedKeyword(domainUuid, keywordUuid, body, options) {
598
+ const request = { paused: body.paused };
599
+ if (body.notifyPosition)
600
+ request.notifyPosition = body.notifyPosition;
601
+ return this.send("PUT", rankingKeywordPath(domainUuid, keywordUuid), {}, request, options);
602
+ }
603
+ /** Stops tracking a keyword and removes its observations. */
604
+ untrackKeyword(domainUuid, keywordUuid, options) {
605
+ return this.send("DELETE", rankingKeywordPath(domainUuid, keywordUuid), {}, undefined, options);
606
+ }
607
+ /** Approves a domain as a HaakCo system administrator, which verifies it (verifiedBy "operator"). */
608
+ approve(domainUuid, options) {
609
+ return this.send("POST", `${domainPath(domainUuid)}/approval`, {}, undefined, options);
610
+ }
611
+ /** Withdraws a system administrator's approval; the domain stays verified only by its own proof. */
612
+ withdrawApproval(domainUuid, options) {
613
+ return this.send("DELETE", `${domainPath(domainUuid)}/approval`, {}, undefined, options);
614
+ }
615
+ /** Queues a public uptime check for a verified domain with active checks and returns the domain. */
616
+ requestUptimeCheck(domainUuid, options) {
617
+ return this.send("POST", `${domainPath(domainUuid)}/uptime-check`, {}, undefined, options);
618
+ }
619
+ /** Records that a person has seen the open incident without resolving it. */
620
+ acknowledgeIncident(domainUuid, incidentUuid, options) {
621
+ const path = `${domainPath(domainUuid)}/incidents/${encodeURIComponent(incidentUuid)}/acknowledgment`;
622
+ return this.send("POST", path, {}, undefined, options);
623
+ }
624
+ /** Lists the domain's current rule- and URL-scoped finding dismissals. */
625
+ async listFindingDismissals(domainUuid, options) {
626
+ const list = await this.send("GET", findingDismissalsPath(domainUuid), {}, undefined, options);
627
+ return { ...list, dismissals: list.dismissals ?? [] };
628
+ }
629
+ /** Hides a currently observed finding at the requested scope. */
630
+ dismissFinding(domainUuid, body, options) {
631
+ return this.send("POST", findingDismissalsPath(domainUuid), {}, body, options);
632
+ }
633
+ /** Removes a dismissal so a still-observed finding returns to active reporting. */
634
+ restoreFinding(domainUuid, dismissalUuid, options) {
635
+ const path = `${findingDismissalsPath(domainUuid)}/${encodeURIComponent(dismissalUuid)}`;
636
+ return this.send("DELETE", path, {}, undefined, options);
637
+ }
638
+ /** Lists the domain's scheduled-job heartbeat monitors, without their tokens. */
639
+ async listHeartbeats(domainUuid, options) {
640
+ const list = await this.send("GET", heartbeatsPath(domainUuid), {}, undefined, options);
641
+ return { ...list, monitors: list.monitors ?? [] };
642
+ }
643
+ /** Creates a heartbeat monitor and returns its one-time write credential. */
644
+ createHeartbeat(domainUuid, body, options) {
645
+ return this.send("POST", heartbeatsPath(domainUuid), {}, body, options);
646
+ }
647
+ /** Revokes the heartbeat's write token and returns its replacement. */
648
+ rotateHeartbeat(domainUuid, monitorUuid, options) {
649
+ const path = `${heartbeatsPath(domainUuid)}/${encodeURIComponent(monitorUuid)}/credential`;
650
+ return this.send("POST", path, {}, undefined, options);
651
+ }
652
+ /** Removes the heartbeat monitor and revokes its write token. */
653
+ deleteHeartbeat(domainUuid, monitorUuid, options) {
654
+ return this.send("DELETE", `${heartbeatsPath(domainUuid)}/${encodeURIComponent(monitorUuid)}`, {}, undefined, options);
655
+ }
656
+ /** Lists the domain's current and historical maintenance windows. */
657
+ async listMaintenance(domainUuid, options) {
658
+ const list = await this.send("GET", maintenancePath(domainUuid), {}, undefined, options);
659
+ return { ...list, windows: list.windows ?? [] };
660
+ }
661
+ /** Schedules a one-off maintenance window on a verified domain. */
662
+ scheduleMaintenance(domainUuid, body, options) {
663
+ return this.send("POST", maintenancePath(domainUuid), {}, body, options);
664
+ }
665
+ /** Cancels a scheduled or active window and returns its historical record. */
666
+ cancelMaintenance(domainUuid, windowUuid, options) {
667
+ const path = `${maintenancePath(domainUuid)}/${encodeURIComponent(windowUuid)}`;
668
+ return this.send("DELETE", path, {}, undefined, options);
669
+ }
670
+ /** Reads the domain's private uptime monitor and its latest result. */
671
+ getPrivateUptime(domainUuid, options) {
672
+ return this.send("GET", privateUptimePath(domainUuid), {}, undefined, options);
673
+ }
674
+ /** Creates a private uptime monitor and returns its one-time write credential. */
675
+ createPrivateUptime(domainUuid, networkLabel, options) {
676
+ return this.send("POST", privateUptimePath(domainUuid), {}, { networkLabel }, options);
677
+ }
678
+ /** Queues a check for the private probe. */
679
+ requestPrivateUptime(domainUuid, options) {
680
+ return this.send("POST", `${privateUptimePath(domainUuid)}/check`, {}, undefined, options);
681
+ }
682
+ /** Revokes the private probe's write token and returns its replacement. */
683
+ rotatePrivateUptime(domainUuid, monitorUuid, options) {
684
+ const path = `${privateUptimePath(domainUuid)}/${encodeURIComponent(monitorUuid)}/credential`;
685
+ return this.send("POST", path, {}, undefined, options);
686
+ }
687
+ /** Removes the private uptime monitor and revokes its write token. */
688
+ deletePrivateUptime(domainUuid, monitorUuid, options) {
689
+ const path = `${privateUptimePath(domainUuid)}/${encodeURIComponent(monitorUuid)}`;
690
+ return this.send("DELETE", path, {}, undefined, options);
691
+ }
692
+ /** Enables or disables the browser collector of a domain the Site credential owns. Repeating an enable returns the same key. */
693
+ setBrowserCollector(domainUuid, body, options) {
694
+ return this.send("PUT", `${domainPath(domainUuid)}/browser-collector`, {}, body, options);
695
+ }
696
+ send(method, path, query, body, options) {
697
+ const { companySlug, ...requestOptions } = options ?? {};
698
+ const params = new URLSearchParams();
699
+ for (const [key, value] of Object.entries({ ...query, companySlug })) {
700
+ if (Array.isArray(value)) {
701
+ for (const item of value)
702
+ params.append(key, item);
703
+ }
704
+ else if (value) {
705
+ params.set(key, value);
706
+ }
707
+ }
708
+ const search = params.toString();
709
+ return this.request(method, search ? `${path}?${search}` : path, body, requestOptions);
710
+ }
711
+ }
712
+ function domainPath(domainUuid) {
713
+ return `${siteDomainsPath}/${encodeURIComponent(domainUuid)}`;
714
+ }
715
+ function findingDismissalsPath(domainUuid) {
716
+ return `${domainPath(domainUuid)}/finding-dismissals`;
717
+ }
718
+ function heartbeatsPath(domainUuid) {
719
+ return `${domainPath(domainUuid)}/heartbeats`;
720
+ }
721
+ function maintenancePath(domainUuid) {
722
+ return `${domainPath(domainUuid)}/maintenance`;
723
+ }
724
+ function privateUptimePath(domainUuid) {
725
+ return `${domainPath(domainUuid)}/private-uptime`;
726
+ }
727
+ function savedReportsPath(domainUuid) {
728
+ return `${domainPath(domainUuid)}/saved-reports`;
729
+ }
730
+ function savedReportPath(domainUuid, reportUuid) {
731
+ return `${savedReportsPath(domainUuid)}/${encodeURIComponent(reportUuid)}`;
732
+ }
733
+ function savedReportBody(body) {
734
+ const request = { name: body.name };
735
+ if (body.template)
736
+ request.template = body.template;
737
+ if (body.days !== undefined)
738
+ request.days = body.days;
739
+ return request;
740
+ }
741
+ function campaignLinksPath(domainUuid) {
742
+ return `${domainPath(domainUuid)}/campaign-links`;
743
+ }
744
+ function statusPagePath(domainUuid) {
745
+ return `${domainPath(domainUuid)}/status-page`;
746
+ }
747
+ function rankingKeywordsPath(domainUuid) {
748
+ return `${domainPath(domainUuid)}/rankings/keywords`;
749
+ }
750
+ function rankingKeywordPath(domainUuid, keywordUuid) {
751
+ return `${rankingKeywordsPath(domainUuid)}/${encodeURIComponent(keywordUuid)}`;
752
+ }
753
+ /** RFC 3339 UTC to the second, as the server documents hour starts. */
754
+ function utcSeconds(value) {
755
+ return value.toISOString().replace(/\.\d{3}Z$/, "Z");
756
+ }
757
+ function analyticsPath(domainUuid) {
758
+ return `${domainPath(domainUuid)}/analytics`;
759
+ }
760
+ function exportPath(domainUuid) {
761
+ return `${domainPath(domainUuid)}/export`;
762
+ }
763
+ function indexNowPath(domainUuid) {
764
+ return `${domainPath(domainUuid)}/indexnow`;
765
+ }
766
+ function searchConnectionPath(domainUuid, provider) {
767
+ return `${domainPath(domainUuid)}/search/${encodeURIComponent(provider)}`;
768
+ }