@whereamimentioned/api-client 0.0.0-stage → 0.1.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.
- package/dist/index.d.ts +1374 -0
- package/dist/index.js +1105 -0
- package/package.json +50 -3
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1374 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The const tuples that appear on the wire of the public API (08-PUBLIC-API section 4), each a
|
|
5
|
+
* `const` tuple so one value serves Zod `z.enum(...)`, the TypeScript union and, in the app, the
|
|
6
|
+
* Drizzle `pgEnum(...)` of the same column.
|
|
7
|
+
*
|
|
8
|
+
* This file is the single source of truth for these fifteen. The app's `src/types/enums.ts`
|
|
9
|
+
* re-exports them from here BY IDENTITY (never a copy), so the database enum, the API contract
|
|
10
|
+
* and every client agree by construction. The direction matters: the package must build on its
|
|
11
|
+
* own in the public mirror (10-CLI section 10.2), which carries `packages/**` and nothing of
|
|
12
|
+
* `src/`, so nothing in this package may import from the app. App-only enums (subscription
|
|
13
|
+
* statuses, credit reasons, alert channels) stay in the app.
|
|
14
|
+
*/
|
|
15
|
+
declare const ORG_TYPES: readonly ["agency", "brand"];
|
|
16
|
+
type OrgType = (typeof ORG_TYPES)[number];
|
|
17
|
+
declare const ORG_ROLES: readonly ["owner", "admin", "member", "viewer"];
|
|
18
|
+
type OrgRole = (typeof ORG_ROLES)[number];
|
|
19
|
+
declare const TIERS: readonly ["free", "single", "pro", "agency", "enterprise"];
|
|
20
|
+
type Tier = (typeof TIERS)[number];
|
|
21
|
+
declare const INTENT_STAGES: readonly ["awareness", "research", "comparison", "purchase", "branded"];
|
|
22
|
+
type IntentStage = (typeof INTENT_STAGES)[number];
|
|
23
|
+
declare const PROMPT_TYPES: readonly ["category", "competitor_comparison", "use_case", "persona_need", "branded"];
|
|
24
|
+
type PromptType = (typeof PROMPT_TYPES)[number];
|
|
25
|
+
declare const PROMPT_SOURCES: readonly ["generated", "template", "custom"];
|
|
26
|
+
type PromptSource = (typeof PROMPT_SOURCES)[number];
|
|
27
|
+
declare const SENTIMENTS: readonly ["positive", "neutral", "negative", "not_present"];
|
|
28
|
+
type Sentiment = (typeof SENTIMENTS)[number];
|
|
29
|
+
declare const SCAN_STATUSES: readonly ["queued", "running", "done", "failed"];
|
|
30
|
+
type ScanStatus$1 = (typeof SCAN_STATUSES)[number];
|
|
31
|
+
declare const SCAN_MODES: readonly ["grounded", "raw", "both"];
|
|
32
|
+
type ScanMode = (typeof SCAN_MODES)[number];
|
|
33
|
+
declare const CITATION_BUCKETS: readonly ["owned", "competitor", "third_party"];
|
|
34
|
+
type CitationBucket = (typeof CITATION_BUCKETS)[number];
|
|
35
|
+
declare const RECOMMENDATION_STATUSES: readonly ["open", "done", "dismissed"];
|
|
36
|
+
type RecommendationStatus = (typeof RECOMMENDATION_STATUSES)[number];
|
|
37
|
+
declare const RECOMMENDATION_TYPES: readonly ["losing_prompt", "power_source", "low_prominence", "reputation_risk", "citation_gap", "ai_readiness"];
|
|
38
|
+
type RecommendationType = (typeof RECOMMENDATION_TYPES)[number];
|
|
39
|
+
declare const REPORT_FORMATS: readonly ["pdf", "csv", "json"];
|
|
40
|
+
type ReportFormat = (typeof REPORT_FORMATS)[number];
|
|
41
|
+
/** API key scopes (08 section 2.5). A scope RESTRICTS the minting member, it never grants. */
|
|
42
|
+
declare const API_SCOPES: readonly ["workspaces:read", "workspaces:write", "scans:read", "scans:write", "reports:read", "prompts:read", "prompts:write", "competitors:read", "competitors:write", "orgs:write"];
|
|
43
|
+
type ApiScope = (typeof API_SCOPES)[number];
|
|
44
|
+
/** The default set offered as "Read only" in the dashboard. */
|
|
45
|
+
declare const READ_ONLY_SCOPES: readonly ["workspaces:read", "scans:read", "reports:read", "prompts:read", "competitors:read"];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The canonical response schema of a visibility report (08 section 4.8). Served VERBATIM by
|
|
49
|
+
* GET /api/v1/scans/{scanId}/report?format=json, built by the app's `buildReportData`
|
|
50
|
+
* (src/reports/report-data.ts, which imports this type and so cannot drift from it), mirrored
|
|
51
|
+
* field for field by the `reportData` zod schema in contract.ts (a type-level assertion there
|
|
52
|
+
* fails typecheck on drift), and never re-shaped by the MCP server or the CLI.
|
|
53
|
+
*
|
|
54
|
+
* It lives in the package rather than the app because the package must build on its own in the
|
|
55
|
+
* public mirror (10-CLI section 10.2), where `src/` does not exist.
|
|
56
|
+
*/
|
|
57
|
+
interface ReportData {
|
|
58
|
+
/** The scan this report describes (08 section 4.8). buildReportData already receives it as arg 1. */
|
|
59
|
+
scanId: string;
|
|
60
|
+
brandName: string;
|
|
61
|
+
workspaceName: string;
|
|
62
|
+
scanDate: string;
|
|
63
|
+
score: number;
|
|
64
|
+
presenceRate: number;
|
|
65
|
+
presenceCiLow: number;
|
|
66
|
+
presenceCiHigh: number;
|
|
67
|
+
sov: number;
|
|
68
|
+
sentimentScore: number | null;
|
|
69
|
+
brandCitationShare: number;
|
|
70
|
+
perModel: Array<{
|
|
71
|
+
model: string;
|
|
72
|
+
score: number;
|
|
73
|
+
}>;
|
|
74
|
+
/** Top REPORT_COMPETITORS_MAX (20) by mentions; the cap is applied by the app. */
|
|
75
|
+
competitors: Array<{
|
|
76
|
+
name: string;
|
|
77
|
+
mentions: number;
|
|
78
|
+
sov: number;
|
|
79
|
+
isTarget: boolean;
|
|
80
|
+
}>;
|
|
81
|
+
/** Top REPORT_CITATIONS_MAX (25) by count. `bucket` is exactly CITATION_BUCKETS, never a wider string. */
|
|
82
|
+
citations: Array<{
|
|
83
|
+
domain: string;
|
|
84
|
+
count: number;
|
|
85
|
+
share: number;
|
|
86
|
+
bucket: CitationBucket;
|
|
87
|
+
}>;
|
|
88
|
+
/** Top REPORT_RECOMMENDATIONS_MAX (10) by priority. */
|
|
89
|
+
recommendations: Array<{
|
|
90
|
+
title: string;
|
|
91
|
+
body: string;
|
|
92
|
+
priority: number;
|
|
93
|
+
}>;
|
|
94
|
+
methodologyVersion: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The wire contract of the whereamimentioned public API (08-PUBLIC-API section 4) and of the
|
|
99
|
+
* no-account site tools (09-MCP-SERVER section 6.1, served at POST /api/site/*).
|
|
100
|
+
*
|
|
101
|
+
* Single source of truth, shared by the REST routes, the MCP tools and the CLI (10-CLI section 12).
|
|
102
|
+
* Rules:
|
|
103
|
+
* - The const tuples live in ./enums.ts, and the app's src/types/enums.ts re-exports them from
|
|
104
|
+
* there by identity. Never retype them, and never import them from the app: this package must
|
|
105
|
+
* build alone in the public mirror (10-CLI section 10.2), which has no src/.
|
|
106
|
+
* - `ReportData` is declared in ./report-data.ts and never redeclared: the app's buildReportData
|
|
107
|
+
* imports it, and the `reportData` schema below is pinned to it by a type-level assertion, so
|
|
108
|
+
* any drift between the two fails `pnpm typecheck` instead of a customer's CI.
|
|
109
|
+
* - Every object schema that is a REQUEST body is `.strict()`, per 08 section 4.8.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
/** `api_keys.kind` (08 section 2.3). A server-side property of the row, never encoded in the token. */
|
|
113
|
+
declare const API_KEY_KINDS: readonly ["org", "user"];
|
|
114
|
+
type ApiKeyKind = (typeof API_KEY_KINDS)[number];
|
|
115
|
+
/** The environment a key was minted against (08 section 2.1): `wam_live_` or `wam_test_`. */
|
|
116
|
+
declare const API_KEY_ENVS: readonly ["live", "test"];
|
|
117
|
+
type ApiKeyEnv = (typeof API_KEY_ENVS)[number];
|
|
118
|
+
/** The API surface version carried in `X-Wam-Api-Version` (08 section 4.3). One integer, not semver. */
|
|
119
|
+
declare const API_VERSION: 1;
|
|
120
|
+
declare const API_VERSION_HEADER = "X-Wam-Api-Version";
|
|
121
|
+
/**
|
|
122
|
+
* `true` on the 200 an idempotent replay returns (08 section 7.1 step 4, section 7.3 step 1). The
|
|
123
|
+
* replay body carries no flag of its own: the status and this header are the signal.
|
|
124
|
+
*/
|
|
125
|
+
declare const IDEMPOTENT_REPLAY_HEADER = "X-Idempotent-Replay";
|
|
126
|
+
declare const API_ERROR_CODES: readonly ["bad_request", "unauthorized", "insufficient_role", "insufficient_scope", "feature_not_available", "not_found", "conflict", "scan_already_running", "validation_failed", "insufficient_credits", "rate_limited", "internal_error"];
|
|
127
|
+
type ApiErrorCode = (typeof API_ERROR_CODES)[number];
|
|
128
|
+
/** `req_` plus a 26-character Crockford base32 ULID (08 section 4.2). */
|
|
129
|
+
declare const requestId: z.ZodString;
|
|
130
|
+
declare const apiErrorBody: z.ZodObject<{
|
|
131
|
+
error: z.ZodObject<{
|
|
132
|
+
code: z.ZodEnum<{
|
|
133
|
+
bad_request: "bad_request";
|
|
134
|
+
unauthorized: "unauthorized";
|
|
135
|
+
insufficient_role: "insufficient_role";
|
|
136
|
+
insufficient_scope: "insufficient_scope";
|
|
137
|
+
feature_not_available: "feature_not_available";
|
|
138
|
+
not_found: "not_found";
|
|
139
|
+
conflict: "conflict";
|
|
140
|
+
scan_already_running: "scan_already_running";
|
|
141
|
+
validation_failed: "validation_failed";
|
|
142
|
+
insufficient_credits: "insufficient_credits";
|
|
143
|
+
rate_limited: "rate_limited";
|
|
144
|
+
internal_error: "internal_error";
|
|
145
|
+
}>;
|
|
146
|
+
message: z.ZodString;
|
|
147
|
+
requestId: z.ZodString;
|
|
148
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
type ApiErrorBody = z.infer<typeof apiErrorBody>;
|
|
152
|
+
/** `details` of the 402 on scan creation (08 sections 4.8 and 6.4). */
|
|
153
|
+
declare const insufficientCreditsDetails: z.ZodObject<{
|
|
154
|
+
required: z.ZodNumber;
|
|
155
|
+
available: z.ZodNumber;
|
|
156
|
+
billingUrl: z.ZodString;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
type InsufficientCreditsDetails = z.infer<typeof insufficientCreditsDetails>;
|
|
159
|
+
/** `details` of every 429 (08 section 5.4). */
|
|
160
|
+
declare const rateLimitedDetails: z.ZodObject<{
|
|
161
|
+
retryAfterSeconds: z.ZodNumber;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
type RateLimitedDetails = z.infer<typeof rateLimitedDetails>;
|
|
164
|
+
/** `details` of the 409 `scan_already_running` (08 section 7.2). An adoption signal: poll `scanId`. */
|
|
165
|
+
declare const scanAlreadyRunningDetails: z.ZodObject<{
|
|
166
|
+
scanId: z.ZodString;
|
|
167
|
+
pollUrl: z.ZodString;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
type ScanAlreadyRunningDetails = z.infer<typeof scanAlreadyRunningDetails>;
|
|
170
|
+
/**
|
|
171
|
+
* `details` of a 409 `conflict`, one arm per cause (08 sections 4.8, 6.5, 7.1 and 7.3):
|
|
172
|
+
* - `originalScanId`: the same `Idempotency-Key` replayed with different scan terms;
|
|
173
|
+
* - `originalOrgId`: the same `Idempotency-Key` replayed with a different org `name` or `type`.
|
|
174
|
+
* 10-CLI section 3.1 branches on its presence (exit 9) against the ceiling (exit 10);
|
|
175
|
+
* - `limit`, `current`, `tier`, `billingUrl`: the plan's workspace cap;
|
|
176
|
+
* - `fields`: the priced terms of a scan quote that moved since it was minted.
|
|
177
|
+
*/
|
|
178
|
+
declare const conflictDetails: z.ZodObject<{
|
|
179
|
+
originalScanId: z.ZodOptional<z.ZodString>;
|
|
180
|
+
originalOrgId: z.ZodOptional<z.ZodString>;
|
|
181
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
182
|
+
current: z.ZodOptional<z.ZodNumber>;
|
|
183
|
+
tier: z.ZodOptional<z.ZodEnum<{
|
|
184
|
+
agency: "agency";
|
|
185
|
+
free: "free";
|
|
186
|
+
single: "single";
|
|
187
|
+
pro: "pro";
|
|
188
|
+
enterprise: "enterprise";
|
|
189
|
+
}>>;
|
|
190
|
+
billingUrl: z.ZodOptional<z.ZodString>;
|
|
191
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
type ConflictDetails = z.infer<typeof conflictDetails>;
|
|
194
|
+
/**
|
|
195
|
+
* `details` of a 403 `feature_not_available` (08 sections 4.8 and 6.2): `billingUrl` when a human
|
|
196
|
+
* with no paid org creates an organization, `limit` and `current` at the prompt cap,
|
|
197
|
+
* `allowedFormats` on a report format the tier does not export.
|
|
198
|
+
*/
|
|
199
|
+
declare const featureNotAvailableDetails: z.ZodObject<{
|
|
200
|
+
billingUrl: z.ZodOptional<z.ZodString>;
|
|
201
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
current: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
allowedFormats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
204
|
+
pdf: "pdf";
|
|
205
|
+
csv: "csv";
|
|
206
|
+
json: "json";
|
|
207
|
+
}>>>;
|
|
208
|
+
}, z.core.$strip>;
|
|
209
|
+
type FeatureNotAvailableDetails = z.infer<typeof featureNotAvailableDetails>;
|
|
210
|
+
/**
|
|
211
|
+
* `details` of a 422 `validation_failed` (08 sections 3.4 rule 2 and 4.3): `hint` names
|
|
212
|
+
* `GET /api/v1/organizations` when a user key named no org; `issues` carries the Zod issues of a
|
|
213
|
+
* body, query or cursor that failed its schema.
|
|
214
|
+
*/
|
|
215
|
+
declare const validationFailedDetails: z.ZodObject<{
|
|
216
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
217
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
218
|
+
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
219
|
+
message: z.ZodString;
|
|
220
|
+
}, z.core.$strip>>>;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
type ValidationFailedDetails = z.infer<typeof validationFailedDetails>;
|
|
223
|
+
/** `details` of the 404 on GET /api/v1/scans/{scanId}/report while the scan is not `done` (08 section 4.8). */
|
|
224
|
+
declare const reportNotFoundDetails: z.ZodObject<{
|
|
225
|
+
status: z.ZodEnum<{
|
|
226
|
+
queued: "queued";
|
|
227
|
+
running: "running";
|
|
228
|
+
done: "done";
|
|
229
|
+
failed: "failed";
|
|
230
|
+
}>;
|
|
231
|
+
}, z.core.$strip>;
|
|
232
|
+
type ReportNotFoundDetails = z.infer<typeof reportNotFoundDetails>;
|
|
233
|
+
/**
|
|
234
|
+
* The `details` schema per error code, for the codes 08 defines one for. `not_found` is deliberately
|
|
235
|
+
* absent: a plain 404 carries no details, and only the report route's (`reportNotFoundDetails`) does.
|
|
236
|
+
*/
|
|
237
|
+
declare const API_ERROR_DETAILS: {
|
|
238
|
+
readonly insufficient_credits: z.ZodObject<{
|
|
239
|
+
required: z.ZodNumber;
|
|
240
|
+
available: z.ZodNumber;
|
|
241
|
+
billingUrl: z.ZodString;
|
|
242
|
+
}, z.core.$strip>;
|
|
243
|
+
readonly rate_limited: z.ZodObject<{
|
|
244
|
+
retryAfterSeconds: z.ZodNumber;
|
|
245
|
+
}, z.core.$strip>;
|
|
246
|
+
readonly scan_already_running: z.ZodObject<{
|
|
247
|
+
scanId: z.ZodString;
|
|
248
|
+
pollUrl: z.ZodString;
|
|
249
|
+
}, z.core.$strip>;
|
|
250
|
+
readonly conflict: z.ZodObject<{
|
|
251
|
+
originalScanId: z.ZodOptional<z.ZodString>;
|
|
252
|
+
originalOrgId: z.ZodOptional<z.ZodString>;
|
|
253
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
254
|
+
current: z.ZodOptional<z.ZodNumber>;
|
|
255
|
+
tier: z.ZodOptional<z.ZodEnum<{
|
|
256
|
+
agency: "agency";
|
|
257
|
+
free: "free";
|
|
258
|
+
single: "single";
|
|
259
|
+
pro: "pro";
|
|
260
|
+
enterprise: "enterprise";
|
|
261
|
+
}>>;
|
|
262
|
+
billingUrl: z.ZodOptional<z.ZodString>;
|
|
263
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
264
|
+
}, z.core.$strip>;
|
|
265
|
+
readonly feature_not_available: z.ZodObject<{
|
|
266
|
+
billingUrl: z.ZodOptional<z.ZodString>;
|
|
267
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
268
|
+
current: z.ZodOptional<z.ZodNumber>;
|
|
269
|
+
allowedFormats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
270
|
+
pdf: "pdf";
|
|
271
|
+
csv: "csv";
|
|
272
|
+
json: "json";
|
|
273
|
+
}>>>;
|
|
274
|
+
}, z.core.$strip>;
|
|
275
|
+
readonly validation_failed: z.ZodObject<{
|
|
276
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
277
|
+
issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
278
|
+
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
279
|
+
message: z.ZodString;
|
|
280
|
+
}, z.core.$strip>>>;
|
|
281
|
+
}, z.core.$strip>;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Narrow an envelope's `details` by its `code`. Undefined when the payload does not match the shape
|
|
285
|
+
* 08 defines for that code: a client branches on what the API defines, never on a locally guessed
|
|
286
|
+
* shape (10-CLI section 12.2 rule 2).
|
|
287
|
+
*/
|
|
288
|
+
declare function parseErrorDetails<C extends keyof typeof API_ERROR_DETAILS>(code: C, details: unknown): z.infer<(typeof API_ERROR_DETAILS)[C]> | undefined;
|
|
289
|
+
declare const pagination: z.ZodObject<{
|
|
290
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
291
|
+
hasMore: z.ZodBoolean;
|
|
292
|
+
limit: z.ZodNumber;
|
|
293
|
+
}, z.core.$strip>;
|
|
294
|
+
type Pagination = z.infer<typeof pagination>;
|
|
295
|
+
/** The `{ data, pagination }` envelope every list endpoint returns. */
|
|
296
|
+
declare function page<T extends z.ZodTypeAny>(item: T): z.ZodObject<{
|
|
297
|
+
data: z.ZodArray<T>;
|
|
298
|
+
pagination: z.ZodObject<{
|
|
299
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
300
|
+
hasMore: z.ZodBoolean;
|
|
301
|
+
limit: z.ZodNumber;
|
|
302
|
+
}, z.core.$strip>;
|
|
303
|
+
}, z.core.$strip>;
|
|
304
|
+
type Page<T> = {
|
|
305
|
+
data: T[];
|
|
306
|
+
pagination: Pagination;
|
|
307
|
+
};
|
|
308
|
+
/** Client-side query for a paginated list. The 1..100 bound is fixed on every endpoint. */
|
|
309
|
+
declare const pageQuery: z.ZodObject<{
|
|
310
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
311
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
312
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
313
|
+
}, z.core.$strict>;
|
|
314
|
+
type PageQuery = z.infer<typeof pageQuery>;
|
|
315
|
+
declare const scanListQuery: z.ZodObject<{
|
|
316
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
317
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
318
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
319
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
320
|
+
queued: "queued";
|
|
321
|
+
running: "running";
|
|
322
|
+
done: "done";
|
|
323
|
+
failed: "failed";
|
|
324
|
+
}>>;
|
|
325
|
+
from: z.ZodOptional<z.ZodString>;
|
|
326
|
+
to: z.ZodOptional<z.ZodString>;
|
|
327
|
+
}, z.core.$strict>;
|
|
328
|
+
type ScanListQuery = z.infer<typeof scanListQuery>;
|
|
329
|
+
declare const promptListQuery: z.ZodObject<{
|
|
330
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
331
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
332
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
333
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
334
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
335
|
+
generated: "generated";
|
|
336
|
+
template: "template";
|
|
337
|
+
custom: "custom";
|
|
338
|
+
}>>;
|
|
339
|
+
stage: z.ZodOptional<z.ZodEnum<{
|
|
340
|
+
awareness: "awareness";
|
|
341
|
+
research: "research";
|
|
342
|
+
comparison: "comparison";
|
|
343
|
+
purchase: "purchase";
|
|
344
|
+
branded: "branded";
|
|
345
|
+
}>>;
|
|
346
|
+
}, z.core.$strict>;
|
|
347
|
+
type PromptListQuery = z.infer<typeof promptListQuery>;
|
|
348
|
+
/** The three filters of GET /api/v1/scans/{scanId}/answers, applied server side in SQL. */
|
|
349
|
+
declare const answerListQuery: z.ZodObject<{
|
|
350
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
351
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
352
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
353
|
+
modelId: z.ZodOptional<z.ZodString>;
|
|
354
|
+
mentioned: z.ZodOptional<z.ZodBoolean>;
|
|
355
|
+
lowConfidence: z.ZodOptional<z.ZodBoolean>;
|
|
356
|
+
}, z.core.$strict>;
|
|
357
|
+
type AnswerListQuery = z.infer<typeof answerListQuery>;
|
|
358
|
+
declare const recommendationListQuery: z.ZodObject<{
|
|
359
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
360
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
361
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
362
|
+
scanId: z.ZodOptional<z.ZodString>;
|
|
363
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
364
|
+
done: "done";
|
|
365
|
+
open: "open";
|
|
366
|
+
dismissed: "dismissed";
|
|
367
|
+
}>>;
|
|
368
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
369
|
+
losing_prompt: "losing_prompt";
|
|
370
|
+
power_source: "power_source";
|
|
371
|
+
low_prominence: "low_prominence";
|
|
372
|
+
reputation_risk: "reputation_risk";
|
|
373
|
+
citation_gap: "citation_gap";
|
|
374
|
+
ai_readiness: "ai_readiness";
|
|
375
|
+
}>>;
|
|
376
|
+
}, z.core.$strict>;
|
|
377
|
+
type RecommendationListQuery = z.infer<typeof recommendationListQuery>;
|
|
378
|
+
declare const citationListQuery: z.ZodObject<{
|
|
379
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
380
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
381
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
382
|
+
scanId: z.ZodOptional<z.ZodString>;
|
|
383
|
+
bucket: z.ZodOptional<z.ZodEnum<{
|
|
384
|
+
owned: "owned";
|
|
385
|
+
competitor: "competitor";
|
|
386
|
+
third_party: "third_party";
|
|
387
|
+
}>>;
|
|
388
|
+
}, z.core.$strict>;
|
|
389
|
+
type CitationListQuery = z.infer<typeof citationListQuery>;
|
|
390
|
+
declare const meResponse: z.ZodObject<{
|
|
391
|
+
key: z.ZodObject<{
|
|
392
|
+
id: z.ZodString;
|
|
393
|
+
name: z.ZodString;
|
|
394
|
+
prefix: z.ZodString;
|
|
395
|
+
last4: z.ZodString;
|
|
396
|
+
kind: z.ZodEnum<{
|
|
397
|
+
org: "org";
|
|
398
|
+
user: "user";
|
|
399
|
+
}>;
|
|
400
|
+
env: z.ZodEnum<{
|
|
401
|
+
live: "live";
|
|
402
|
+
test: "test";
|
|
403
|
+
}>;
|
|
404
|
+
scopes: z.ZodArray<z.ZodEnum<{
|
|
405
|
+
"workspaces:read": "workspaces:read";
|
|
406
|
+
"workspaces:write": "workspaces:write";
|
|
407
|
+
"scans:read": "scans:read";
|
|
408
|
+
"scans:write": "scans:write";
|
|
409
|
+
"reports:read": "reports:read";
|
|
410
|
+
"prompts:read": "prompts:read";
|
|
411
|
+
"prompts:write": "prompts:write";
|
|
412
|
+
"competitors:read": "competitors:read";
|
|
413
|
+
"competitors:write": "competitors:write";
|
|
414
|
+
"orgs:write": "orgs:write";
|
|
415
|
+
}>>;
|
|
416
|
+
roleCeiling: z.ZodEnum<{
|
|
417
|
+
owner: "owner";
|
|
418
|
+
admin: "admin";
|
|
419
|
+
member: "member";
|
|
420
|
+
viewer: "viewer";
|
|
421
|
+
}>;
|
|
422
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
423
|
+
}, z.core.$strip>;
|
|
424
|
+
org: z.ZodObject<{
|
|
425
|
+
id: z.ZodString;
|
|
426
|
+
slug: z.ZodString;
|
|
427
|
+
name: z.ZodString;
|
|
428
|
+
type: z.ZodEnum<{
|
|
429
|
+
agency: "agency";
|
|
430
|
+
brand: "brand";
|
|
431
|
+
}>;
|
|
432
|
+
}, z.core.$strip>;
|
|
433
|
+
actor: z.ZodObject<{
|
|
434
|
+
userId: z.ZodString;
|
|
435
|
+
role: z.ZodEnum<{
|
|
436
|
+
owner: "owner";
|
|
437
|
+
admin: "admin";
|
|
438
|
+
member: "member";
|
|
439
|
+
viewer: "viewer";
|
|
440
|
+
}>;
|
|
441
|
+
effectiveRole: z.ZodEnum<{
|
|
442
|
+
owner: "owner";
|
|
443
|
+
admin: "admin";
|
|
444
|
+
member: "member";
|
|
445
|
+
viewer: "viewer";
|
|
446
|
+
}>;
|
|
447
|
+
}, z.core.$strip>;
|
|
448
|
+
plan: z.ZodObject<{
|
|
449
|
+
tier: z.ZodEnum<{
|
|
450
|
+
agency: "agency";
|
|
451
|
+
free: "free";
|
|
452
|
+
single: "single";
|
|
453
|
+
pro: "pro";
|
|
454
|
+
enterprise: "enterprise";
|
|
455
|
+
}>;
|
|
456
|
+
label: z.ZodString;
|
|
457
|
+
mcp: z.ZodBoolean;
|
|
458
|
+
exportFormats: z.ZodArray<z.ZodEnum<{
|
|
459
|
+
pdf: "pdf";
|
|
460
|
+
csv: "csv";
|
|
461
|
+
json: "json";
|
|
462
|
+
}>>;
|
|
463
|
+
promptsPerWorkspace: z.ZodNumber;
|
|
464
|
+
maxScanPrompts: z.ZodNumber;
|
|
465
|
+
}, z.core.$strip>;
|
|
466
|
+
credits: z.ZodObject<{
|
|
467
|
+
balance: z.ZodNumber;
|
|
468
|
+
unit: z.ZodString;
|
|
469
|
+
}, z.core.$strip>;
|
|
470
|
+
}, z.core.$strip>;
|
|
471
|
+
type Me = z.infer<typeof meResponse>;
|
|
472
|
+
declare const organizationSummary: z.ZodObject<{
|
|
473
|
+
id: z.ZodString;
|
|
474
|
+
slug: z.ZodString;
|
|
475
|
+
name: z.ZodString;
|
|
476
|
+
tier: z.ZodEnum<{
|
|
477
|
+
agency: "agency";
|
|
478
|
+
free: "free";
|
|
479
|
+
single: "single";
|
|
480
|
+
pro: "pro";
|
|
481
|
+
enterprise: "enterprise";
|
|
482
|
+
}>;
|
|
483
|
+
effectiveRole: z.ZodEnum<{
|
|
484
|
+
owner: "owner";
|
|
485
|
+
admin: "admin";
|
|
486
|
+
member: "member";
|
|
487
|
+
viewer: "viewer";
|
|
488
|
+
}>;
|
|
489
|
+
workspaceCount: z.ZodNumber;
|
|
490
|
+
}, z.core.$strip>;
|
|
491
|
+
type OrganizationSummary = z.infer<typeof organizationSummary>;
|
|
492
|
+
declare const createOrganizationBody: z.ZodObject<{
|
|
493
|
+
name: z.ZodString;
|
|
494
|
+
type: z.ZodEnum<{
|
|
495
|
+
agency: "agency";
|
|
496
|
+
brand: "brand";
|
|
497
|
+
}>;
|
|
498
|
+
}, z.core.$strict>;
|
|
499
|
+
type CreateOrganizationBody = z.infer<typeof createOrganizationBody>;
|
|
500
|
+
declare const createOrganizationResult: z.ZodObject<{
|
|
501
|
+
id: z.ZodString;
|
|
502
|
+
slug: z.ZodString;
|
|
503
|
+
name: z.ZodString;
|
|
504
|
+
type: z.ZodEnum<{
|
|
505
|
+
agency: "agency";
|
|
506
|
+
brand: "brand";
|
|
507
|
+
}>;
|
|
508
|
+
tier: z.ZodEnum<{
|
|
509
|
+
agency: "agency";
|
|
510
|
+
free: "free";
|
|
511
|
+
single: "single";
|
|
512
|
+
pro: "pro";
|
|
513
|
+
enterprise: "enterprise";
|
|
514
|
+
}>;
|
|
515
|
+
usable: z.ZodBoolean;
|
|
516
|
+
subscribeUrl: z.ZodString;
|
|
517
|
+
message: z.ZodOptional<z.ZodString>;
|
|
518
|
+
}, z.core.$strip>;
|
|
519
|
+
type CreateOrganizationResult = z.infer<typeof createOrganizationResult>;
|
|
520
|
+
declare const latestScanRef: z.ZodObject<{
|
|
521
|
+
id: z.ZodString;
|
|
522
|
+
status: z.ZodEnum<{
|
|
523
|
+
queued: "queued";
|
|
524
|
+
running: "running";
|
|
525
|
+
done: "done";
|
|
526
|
+
failed: "failed";
|
|
527
|
+
}>;
|
|
528
|
+
finishedAt: z.ZodNullable<z.ZodString>;
|
|
529
|
+
score: z.ZodNullable<z.ZodNumber>;
|
|
530
|
+
}, z.core.$strip>;
|
|
531
|
+
type LatestScanRef = z.infer<typeof latestScanRef>;
|
|
532
|
+
/** Exactly WORKSPACE_FIELDS (08 section 4.7), in that order. */
|
|
533
|
+
declare const workspaceSummary: z.ZodObject<{
|
|
534
|
+
id: z.ZodString;
|
|
535
|
+
slug: z.ZodString;
|
|
536
|
+
name: z.ZodString;
|
|
537
|
+
brandName: z.ZodNullable<z.ZodString>;
|
|
538
|
+
defaultRegion: z.ZodString;
|
|
539
|
+
defaultLanguage: z.ZodString;
|
|
540
|
+
usesOwnKey: z.ZodBoolean;
|
|
541
|
+
promptCount: z.ZodNumber;
|
|
542
|
+
enabledPromptCount: z.ZodNumber;
|
|
543
|
+
latestScan: z.ZodNullable<z.ZodObject<{
|
|
544
|
+
id: z.ZodString;
|
|
545
|
+
status: z.ZodEnum<{
|
|
546
|
+
queued: "queued";
|
|
547
|
+
running: "running";
|
|
548
|
+
done: "done";
|
|
549
|
+
failed: "failed";
|
|
550
|
+
}>;
|
|
551
|
+
finishedAt: z.ZodNullable<z.ZodString>;
|
|
552
|
+
score: z.ZodNullable<z.ZodNumber>;
|
|
553
|
+
}, z.core.$strip>>;
|
|
554
|
+
activeScanId: z.ZodNullable<z.ZodString>;
|
|
555
|
+
createdAt: z.ZodString;
|
|
556
|
+
updatedAt: z.ZodString;
|
|
557
|
+
}, z.core.$strip>;
|
|
558
|
+
type WorkspaceSummary = z.infer<typeof workspaceSummary>;
|
|
559
|
+
/** Exactly WORKSPACE_DETAIL_FIELDS: the list entry plus `competitorCount`. */
|
|
560
|
+
declare const workspaceDetail: z.ZodObject<{
|
|
561
|
+
id: z.ZodString;
|
|
562
|
+
slug: z.ZodString;
|
|
563
|
+
name: z.ZodString;
|
|
564
|
+
brandName: z.ZodNullable<z.ZodString>;
|
|
565
|
+
defaultRegion: z.ZodString;
|
|
566
|
+
defaultLanguage: z.ZodString;
|
|
567
|
+
usesOwnKey: z.ZodBoolean;
|
|
568
|
+
promptCount: z.ZodNumber;
|
|
569
|
+
enabledPromptCount: z.ZodNumber;
|
|
570
|
+
latestScan: z.ZodNullable<z.ZodObject<{
|
|
571
|
+
id: z.ZodString;
|
|
572
|
+
status: z.ZodEnum<{
|
|
573
|
+
queued: "queued";
|
|
574
|
+
running: "running";
|
|
575
|
+
done: "done";
|
|
576
|
+
failed: "failed";
|
|
577
|
+
}>;
|
|
578
|
+
finishedAt: z.ZodNullable<z.ZodString>;
|
|
579
|
+
score: z.ZodNullable<z.ZodNumber>;
|
|
580
|
+
}, z.core.$strip>>;
|
|
581
|
+
activeScanId: z.ZodNullable<z.ZodString>;
|
|
582
|
+
createdAt: z.ZodString;
|
|
583
|
+
updatedAt: z.ZodString;
|
|
584
|
+
competitorCount: z.ZodNumber;
|
|
585
|
+
}, z.core.$strip>;
|
|
586
|
+
type WorkspaceDetail = z.infer<typeof workspaceDetail>;
|
|
587
|
+
/**
|
|
588
|
+
* Only `name`. The org is never read from the body (08 section 3.5(a)): it travels as
|
|
589
|
+
* `X-Wam-Org`, and `.strict()` makes an `orgSlug` field a 422.
|
|
590
|
+
*/
|
|
591
|
+
declare const createWorkspaceBody: z.ZodObject<{
|
|
592
|
+
name: z.ZodString;
|
|
593
|
+
}, z.core.$strict>;
|
|
594
|
+
type CreateWorkspaceBody = z.infer<typeof createWorkspaceBody>;
|
|
595
|
+
declare const competitor: z.ZodObject<{
|
|
596
|
+
id: z.ZodString;
|
|
597
|
+
name: z.ZodString;
|
|
598
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
599
|
+
aliases: z.ZodArray<z.ZodString>;
|
|
600
|
+
createdAt: z.ZodString;
|
|
601
|
+
}, z.core.$strip>;
|
|
602
|
+
type Competitor = z.infer<typeof competitor>;
|
|
603
|
+
declare const createCompetitorBody: z.ZodObject<{
|
|
604
|
+
name: z.ZodString;
|
|
605
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
606
|
+
aliases: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
607
|
+
}, z.core.$strict>;
|
|
608
|
+
type CreateCompetitorBody = z.input<typeof createCompetitorBody>;
|
|
609
|
+
declare const prompt: z.ZodObject<{
|
|
610
|
+
id: z.ZodString;
|
|
611
|
+
text: z.ZodString;
|
|
612
|
+
intentStage: z.ZodEnum<{
|
|
613
|
+
awareness: "awareness";
|
|
614
|
+
research: "research";
|
|
615
|
+
comparison: "comparison";
|
|
616
|
+
purchase: "purchase";
|
|
617
|
+
branded: "branded";
|
|
618
|
+
}>;
|
|
619
|
+
persona: z.ZodString;
|
|
620
|
+
type: z.ZodEnum<{
|
|
621
|
+
branded: "branded";
|
|
622
|
+
category: "category";
|
|
623
|
+
competitor_comparison: "competitor_comparison";
|
|
624
|
+
use_case: "use_case";
|
|
625
|
+
persona_need: "persona_need";
|
|
626
|
+
}>;
|
|
627
|
+
topic: z.ZodNullable<z.ZodString>;
|
|
628
|
+
isBranded: z.ZodBoolean;
|
|
629
|
+
tags: z.ZodArray<z.ZodString>;
|
|
630
|
+
source: z.ZodEnum<{
|
|
631
|
+
generated: "generated";
|
|
632
|
+
template: "template";
|
|
633
|
+
custom: "custom";
|
|
634
|
+
}>;
|
|
635
|
+
enabled: z.ZodBoolean;
|
|
636
|
+
createdAt: z.ZodString;
|
|
637
|
+
}, z.core.$strip>;
|
|
638
|
+
type Prompt = z.infer<typeof prompt>;
|
|
639
|
+
/** The only list envelope with extra keys: the cap is meaningless without the list beside it. */
|
|
640
|
+
declare const promptListResponse: z.ZodObject<{
|
|
641
|
+
data: z.ZodArray<z.ZodObject<{
|
|
642
|
+
id: z.ZodString;
|
|
643
|
+
text: z.ZodString;
|
|
644
|
+
intentStage: z.ZodEnum<{
|
|
645
|
+
awareness: "awareness";
|
|
646
|
+
research: "research";
|
|
647
|
+
comparison: "comparison";
|
|
648
|
+
purchase: "purchase";
|
|
649
|
+
branded: "branded";
|
|
650
|
+
}>;
|
|
651
|
+
persona: z.ZodString;
|
|
652
|
+
type: z.ZodEnum<{
|
|
653
|
+
branded: "branded";
|
|
654
|
+
category: "category";
|
|
655
|
+
competitor_comparison: "competitor_comparison";
|
|
656
|
+
use_case: "use_case";
|
|
657
|
+
persona_need: "persona_need";
|
|
658
|
+
}>;
|
|
659
|
+
topic: z.ZodNullable<z.ZodString>;
|
|
660
|
+
isBranded: z.ZodBoolean;
|
|
661
|
+
tags: z.ZodArray<z.ZodString>;
|
|
662
|
+
source: z.ZodEnum<{
|
|
663
|
+
generated: "generated";
|
|
664
|
+
template: "template";
|
|
665
|
+
custom: "custom";
|
|
666
|
+
}>;
|
|
667
|
+
enabled: z.ZodBoolean;
|
|
668
|
+
createdAt: z.ZodString;
|
|
669
|
+
}, z.core.$strip>>;
|
|
670
|
+
pagination: z.ZodObject<{
|
|
671
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
672
|
+
hasMore: z.ZodBoolean;
|
|
673
|
+
limit: z.ZodNumber;
|
|
674
|
+
}, z.core.$strip>;
|
|
675
|
+
promptsPerWorkspace: z.ZodNumber;
|
|
676
|
+
maxScanPrompts: z.ZodNumber;
|
|
677
|
+
}, z.core.$strip>;
|
|
678
|
+
type PromptListResponse = z.infer<typeof promptListResponse>;
|
|
679
|
+
declare const createPromptBody: z.ZodObject<{
|
|
680
|
+
text: z.ZodString;
|
|
681
|
+
intentStage: z.ZodDefault<z.ZodEnum<{
|
|
682
|
+
awareness: "awareness";
|
|
683
|
+
research: "research";
|
|
684
|
+
comparison: "comparison";
|
|
685
|
+
purchase: "purchase";
|
|
686
|
+
branded: "branded";
|
|
687
|
+
}>>;
|
|
688
|
+
persona: z.ZodOptional<z.ZodString>;
|
|
689
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
690
|
+
}, z.core.$strict>;
|
|
691
|
+
type CreatePromptBody = z.input<typeof createPromptBody>;
|
|
692
|
+
declare const patchPromptBody: z.ZodObject<{
|
|
693
|
+
enabled: z.ZodBoolean;
|
|
694
|
+
}, z.core.$strict>;
|
|
695
|
+
type PatchPromptBody = z.infer<typeof patchPromptBody>;
|
|
696
|
+
declare const deletePromptResult: z.ZodObject<{
|
|
697
|
+
deleted: z.ZodLiteral<true>;
|
|
698
|
+
id: z.ZodString;
|
|
699
|
+
}, z.core.$strip>;
|
|
700
|
+
type DeletePromptResult = z.infer<typeof deletePromptResult>;
|
|
701
|
+
declare const scanSummary: z.ZodObject<{
|
|
702
|
+
id: z.ZodString;
|
|
703
|
+
status: z.ZodEnum<{
|
|
704
|
+
queued: "queued";
|
|
705
|
+
running: "running";
|
|
706
|
+
done: "done";
|
|
707
|
+
failed: "failed";
|
|
708
|
+
}>;
|
|
709
|
+
mode: z.ZodEnum<{
|
|
710
|
+
grounded: "grounded";
|
|
711
|
+
raw: "raw";
|
|
712
|
+
both: "both";
|
|
713
|
+
}>;
|
|
714
|
+
repetitions: z.ZodNumber;
|
|
715
|
+
modelCount: z.ZodNumber;
|
|
716
|
+
promptCount: z.ZodNumber;
|
|
717
|
+
creditsSpent: z.ZodNullable<z.ZodNumber>;
|
|
718
|
+
score: z.ZodNullable<z.ZodNumber>;
|
|
719
|
+
createdAt: z.ZodString;
|
|
720
|
+
startedAt: z.ZodNullable<z.ZodString>;
|
|
721
|
+
finishedAt: z.ZodNullable<z.ZodString>;
|
|
722
|
+
error: z.ZodNullable<z.ZodString>;
|
|
723
|
+
}, z.core.$strip>;
|
|
724
|
+
type ScanSummary = z.infer<typeof scanSummary>;
|
|
725
|
+
declare const scanProgress: z.ZodObject<{
|
|
726
|
+
done: z.ZodNumber;
|
|
727
|
+
total: z.ZodNumber;
|
|
728
|
+
totalIsFinal: z.ZodBoolean;
|
|
729
|
+
}, z.core.$strip>;
|
|
730
|
+
type ScanProgress = z.infer<typeof scanProgress>;
|
|
731
|
+
declare const scanStatus: z.ZodObject<{
|
|
732
|
+
id: z.ZodString;
|
|
733
|
+
workspaceSlug: z.ZodString;
|
|
734
|
+
status: z.ZodEnum<{
|
|
735
|
+
queued: "queued";
|
|
736
|
+
running: "running";
|
|
737
|
+
done: "done";
|
|
738
|
+
failed: "failed";
|
|
739
|
+
}>;
|
|
740
|
+
mode: z.ZodEnum<{
|
|
741
|
+
grounded: "grounded";
|
|
742
|
+
raw: "raw";
|
|
743
|
+
both: "both";
|
|
744
|
+
}>;
|
|
745
|
+
repetitions: z.ZodNumber;
|
|
746
|
+
progress: z.ZodObject<{
|
|
747
|
+
done: z.ZodNumber;
|
|
748
|
+
total: z.ZodNumber;
|
|
749
|
+
totalIsFinal: z.ZodBoolean;
|
|
750
|
+
}, z.core.$strip>;
|
|
751
|
+
creditsReserved: z.ZodNumber;
|
|
752
|
+
creditsSpent: z.ZodNullable<z.ZodNumber>;
|
|
753
|
+
score: z.ZodNullable<z.ZodNumber>;
|
|
754
|
+
createdAt: z.ZodString;
|
|
755
|
+
startedAt: z.ZodNullable<z.ZodString>;
|
|
756
|
+
finishedAt: z.ZodNullable<z.ZodString>;
|
|
757
|
+
error: z.ZodNullable<z.ZodString>;
|
|
758
|
+
}, z.core.$strip>;
|
|
759
|
+
type ScanStatus = z.infer<typeof scanStatus>;
|
|
760
|
+
declare const scanModelRef: z.ZodObject<{
|
|
761
|
+
id: z.ZodString;
|
|
762
|
+
displayName: z.ZodString;
|
|
763
|
+
}, z.core.$strip>;
|
|
764
|
+
type ScanModelRef = z.infer<typeof scanModelRef>;
|
|
765
|
+
/** POST /api/v1/workspaces/{ws}/scans/estimate: free, charges nothing, touches no ledger. */
|
|
766
|
+
declare const scanEstimate: z.ZodObject<{
|
|
767
|
+
credits: z.ZodNumber;
|
|
768
|
+
prompts: z.ZodNumber;
|
|
769
|
+
models: z.ZodArray<z.ZodObject<{
|
|
770
|
+
id: z.ZodString;
|
|
771
|
+
displayName: z.ZodString;
|
|
772
|
+
}, z.core.$strip>>;
|
|
773
|
+
repetitions: z.ZodNumber;
|
|
774
|
+
mode: z.ZodEnum<{
|
|
775
|
+
grounded: "grounded";
|
|
776
|
+
raw: "raw";
|
|
777
|
+
both: "both";
|
|
778
|
+
}>;
|
|
779
|
+
balance: z.ZodNumber;
|
|
780
|
+
sufficient: z.ZodBoolean;
|
|
781
|
+
usesOwnKey: z.ZodBoolean;
|
|
782
|
+
quote: z.ZodObject<{
|
|
783
|
+
token: z.ZodString;
|
|
784
|
+
expiresAt: z.ZodString;
|
|
785
|
+
}, z.core.$strip>;
|
|
786
|
+
}, z.core.$strip>;
|
|
787
|
+
type ScanEstimate = z.infer<typeof scanEstimate>;
|
|
788
|
+
/** Body of the estimate call: reserved for future options. */
|
|
789
|
+
declare const estimateScanBody: z.ZodObject<{}, z.core.$strict>;
|
|
790
|
+
type EstimateScanBody = z.infer<typeof estimateScanBody>;
|
|
791
|
+
/** `mode` and `repetitions` are deliberately NOT accepted (08 section 6.3): `.strict()` 422s them. */
|
|
792
|
+
declare const createScanBody: z.ZodObject<{
|
|
793
|
+
quote: z.ZodOptional<z.ZodString>;
|
|
794
|
+
}, z.core.$strict>;
|
|
795
|
+
type CreateScanBody = z.infer<typeof createScanBody>;
|
|
796
|
+
declare const createScanResult: z.ZodObject<{
|
|
797
|
+
id: z.ZodString;
|
|
798
|
+
status: z.ZodEnum<{
|
|
799
|
+
queued: "queued";
|
|
800
|
+
running: "running";
|
|
801
|
+
done: "done";
|
|
802
|
+
failed: "failed";
|
|
803
|
+
}>;
|
|
804
|
+
credits: z.ZodNumber;
|
|
805
|
+
prompts: z.ZodNumber;
|
|
806
|
+
models: z.ZodNumber;
|
|
807
|
+
balanceAfter: z.ZodNumber;
|
|
808
|
+
pollUrl: z.ZodString;
|
|
809
|
+
}, z.core.$strip>;
|
|
810
|
+
type CreateScanResult = z.infer<typeof createScanResult>;
|
|
811
|
+
/** `Idempotency-Key` header value: 1..128 chars of [A-Za-z0-9_.:-] (08 section 7.1). */
|
|
812
|
+
declare const idempotencyKey: z.ZodString;
|
|
813
|
+
/** 1200 characters and 25 citations are the numbers everywhere. They are not tuning knobs. */
|
|
814
|
+
declare const ANSWER_TEXT_MAX_CHARS = 1200;
|
|
815
|
+
declare const ANSWER_CITATIONS_MAX = 25;
|
|
816
|
+
declare const answerCitation: z.ZodObject<{
|
|
817
|
+
url: z.ZodString;
|
|
818
|
+
domain: z.ZodString;
|
|
819
|
+
}, z.core.$strip>;
|
|
820
|
+
type AnswerCitation = z.infer<typeof answerCitation>;
|
|
821
|
+
declare const brandPresent: z.ZodObject<{
|
|
822
|
+
name: z.ZodString;
|
|
823
|
+
is_target: z.ZodBoolean;
|
|
824
|
+
rank: z.ZodNullable<z.ZodNumber>;
|
|
825
|
+
}, z.core.$strip>;
|
|
826
|
+
type BrandPresent = z.infer<typeof brandPresent>;
|
|
827
|
+
declare const scanAnswer: z.ZodObject<{
|
|
828
|
+
answerId: z.ZodString;
|
|
829
|
+
promptId: z.ZodString;
|
|
830
|
+
promptText: z.ZodString;
|
|
831
|
+
intentStage: z.ZodEnum<{
|
|
832
|
+
awareness: "awareness";
|
|
833
|
+
research: "research";
|
|
834
|
+
comparison: "comparison";
|
|
835
|
+
purchase: "purchase";
|
|
836
|
+
branded: "branded";
|
|
837
|
+
}>;
|
|
838
|
+
modelId: z.ZodString;
|
|
839
|
+
modelName: z.ZodString;
|
|
840
|
+
grounded: z.ZodBoolean;
|
|
841
|
+
brandMentioned: z.ZodBoolean;
|
|
842
|
+
brandPosition: z.ZodNullable<z.ZodNumber>;
|
|
843
|
+
sentiment: z.ZodEnum<{
|
|
844
|
+
positive: "positive";
|
|
845
|
+
neutral: "neutral";
|
|
846
|
+
negative: "negative";
|
|
847
|
+
not_present: "not_present";
|
|
848
|
+
}>;
|
|
849
|
+
brandsPresent: z.ZodArray<z.ZodObject<{
|
|
850
|
+
name: z.ZodString;
|
|
851
|
+
is_target: z.ZodBoolean;
|
|
852
|
+
rank: z.ZodNullable<z.ZodNumber>;
|
|
853
|
+
}, z.core.$strip>>;
|
|
854
|
+
citations: z.ZodArray<z.ZodObject<{
|
|
855
|
+
url: z.ZodString;
|
|
856
|
+
domain: z.ZodString;
|
|
857
|
+
}, z.core.$strip>>;
|
|
858
|
+
confidence: z.ZodNumber;
|
|
859
|
+
lowConfidence: z.ZodBoolean;
|
|
860
|
+
answerText: z.ZodString;
|
|
861
|
+
answerTextTruncated: z.ZodBoolean;
|
|
862
|
+
}, z.core.$strip>;
|
|
863
|
+
type ScanAnswer = z.infer<typeof scanAnswer>;
|
|
864
|
+
declare const recommendation: z.ZodObject<{
|
|
865
|
+
id: z.ZodString;
|
|
866
|
+
type: z.ZodEnum<{
|
|
867
|
+
losing_prompt: "losing_prompt";
|
|
868
|
+
power_source: "power_source";
|
|
869
|
+
low_prominence: "low_prominence";
|
|
870
|
+
reputation_risk: "reputation_risk";
|
|
871
|
+
citation_gap: "citation_gap";
|
|
872
|
+
ai_readiness: "ai_readiness";
|
|
873
|
+
}>;
|
|
874
|
+
title: z.ZodString;
|
|
875
|
+
body: z.ZodString;
|
|
876
|
+
impact: z.ZodNumber;
|
|
877
|
+
effort: z.ZodNumber;
|
|
878
|
+
priority: z.ZodNumber;
|
|
879
|
+
status: z.ZodEnum<{
|
|
880
|
+
done: "done";
|
|
881
|
+
open: "open";
|
|
882
|
+
dismissed: "dismissed";
|
|
883
|
+
}>;
|
|
884
|
+
scanId: z.ZodNullable<z.ZodString>;
|
|
885
|
+
createdAt: z.ZodString;
|
|
886
|
+
}, z.core.$strip>;
|
|
887
|
+
type Recommendation = z.infer<typeof recommendation>;
|
|
888
|
+
declare const citation: z.ZodObject<{
|
|
889
|
+
domain: z.ZodString;
|
|
890
|
+
count: z.ZodNumber;
|
|
891
|
+
share: z.ZodNumber;
|
|
892
|
+
bucket: z.ZodEnum<{
|
|
893
|
+
owned: "owned";
|
|
894
|
+
competitor: "competitor";
|
|
895
|
+
third_party: "third_party";
|
|
896
|
+
}>;
|
|
897
|
+
}, z.core.$strip>;
|
|
898
|
+
type Citation = z.infer<typeof citation>;
|
|
899
|
+
declare const credits: z.ZodObject<{
|
|
900
|
+
balance: z.ZodNumber;
|
|
901
|
+
tier: z.ZodEnum<{
|
|
902
|
+
agency: "agency";
|
|
903
|
+
free: "free";
|
|
904
|
+
single: "single";
|
|
905
|
+
pro: "pro";
|
|
906
|
+
enterprise: "enterprise";
|
|
907
|
+
}>;
|
|
908
|
+
monthlyCredits: z.ZodNumber;
|
|
909
|
+
unit: z.ZodString;
|
|
910
|
+
estimatedScansRemaining: z.ZodNumber;
|
|
911
|
+
}, z.core.$strip>;
|
|
912
|
+
type Credits = z.infer<typeof credits>;
|
|
913
|
+
/** `all` is the literal string "cli" or nothing. The server 422s on any other value. */
|
|
914
|
+
declare const revokeSelfQuery: z.ZodObject<{
|
|
915
|
+
all: z.ZodOptional<z.ZodLiteral<"cli">>;
|
|
916
|
+
}, z.core.$strict>;
|
|
917
|
+
declare const revokeSelfResult: z.ZodObject<{
|
|
918
|
+
revoked: z.ZodNumber;
|
|
919
|
+
self: z.ZodLiteral<true>;
|
|
920
|
+
scope: z.ZodOptional<z.ZodLiteral<"cli">>;
|
|
921
|
+
}, z.core.$strip>;
|
|
922
|
+
type RevokeSelfResult = z.infer<typeof revokeSelfResult>;
|
|
923
|
+
/**
|
|
924
|
+
* The signed payload behind `scanEstimate.quote.token`: base64url(payload) + "." + base64url(mac),
|
|
925
|
+
* HMAC-SHA256 over the canonical JSON, 5 minute TTL, `modelIds` sorted lexically before signing.
|
|
926
|
+
* Minting and verification live in src/api/quote.ts; this is the shape only.
|
|
927
|
+
*/
|
|
928
|
+
declare const quotePayload: z.ZodObject<{
|
|
929
|
+
v: z.ZodLiteral<1>;
|
|
930
|
+
orgId: z.ZodString;
|
|
931
|
+
workspaceId: z.ZodString;
|
|
932
|
+
keyId: z.ZodString;
|
|
933
|
+
promptCount: z.ZodNumber;
|
|
934
|
+
modelIds: z.ZodArray<z.ZodString>;
|
|
935
|
+
repetitions: z.ZodNumber;
|
|
936
|
+
mode: z.ZodEnum<{
|
|
937
|
+
grounded: "grounded";
|
|
938
|
+
raw: "raw";
|
|
939
|
+
both: "both";
|
|
940
|
+
}>;
|
|
941
|
+
creditCost: z.ZodNumber;
|
|
942
|
+
byok: z.ZodBoolean;
|
|
943
|
+
iat: z.ZodNumber;
|
|
944
|
+
exp: z.ZodNumber;
|
|
945
|
+
}, z.core.$strip>;
|
|
946
|
+
type QuotePayload = z.infer<typeof quotePayload>;
|
|
947
|
+
declare const QUOTE_TTL_SECONDS = 300;
|
|
948
|
+
/**
|
|
949
|
+
* Mirrors `ReportData` from ./report-data.ts field for field. That interface is the canonical
|
|
950
|
+
* response schema and is served verbatim; this zod schema exists so the wire can be validated in
|
|
951
|
+
* tests. The assertion below makes the two inseparable: change one and the other fails to
|
|
952
|
+
* typecheck.
|
|
953
|
+
*/
|
|
954
|
+
declare const reportData: z.ZodObject<{
|
|
955
|
+
scanId: z.ZodString;
|
|
956
|
+
brandName: z.ZodString;
|
|
957
|
+
workspaceName: z.ZodString;
|
|
958
|
+
scanDate: z.ZodString;
|
|
959
|
+
score: z.ZodNumber;
|
|
960
|
+
presenceRate: z.ZodNumber;
|
|
961
|
+
presenceCiLow: z.ZodNumber;
|
|
962
|
+
presenceCiHigh: z.ZodNumber;
|
|
963
|
+
sov: z.ZodNumber;
|
|
964
|
+
sentimentScore: z.ZodNullable<z.ZodNumber>;
|
|
965
|
+
brandCitationShare: z.ZodNumber;
|
|
966
|
+
perModel: z.ZodArray<z.ZodObject<{
|
|
967
|
+
model: z.ZodString;
|
|
968
|
+
score: z.ZodNumber;
|
|
969
|
+
}, z.core.$strip>>;
|
|
970
|
+
competitors: z.ZodArray<z.ZodObject<{
|
|
971
|
+
name: z.ZodString;
|
|
972
|
+
mentions: z.ZodNumber;
|
|
973
|
+
sov: z.ZodNumber;
|
|
974
|
+
isTarget: z.ZodBoolean;
|
|
975
|
+
}, z.core.$strip>>;
|
|
976
|
+
citations: z.ZodArray<z.ZodObject<{
|
|
977
|
+
domain: z.ZodString;
|
|
978
|
+
count: z.ZodNumber;
|
|
979
|
+
share: z.ZodNumber;
|
|
980
|
+
bucket: z.ZodEnum<{
|
|
981
|
+
owned: "owned";
|
|
982
|
+
competitor: "competitor";
|
|
983
|
+
third_party: "third_party";
|
|
984
|
+
}>;
|
|
985
|
+
}, z.core.$strip>>;
|
|
986
|
+
recommendations: z.ZodArray<z.ZodObject<{
|
|
987
|
+
title: z.ZodString;
|
|
988
|
+
body: z.ZodString;
|
|
989
|
+
priority: z.ZodNumber;
|
|
990
|
+
}, z.core.$strip>>;
|
|
991
|
+
methodologyVersion: z.ZodString;
|
|
992
|
+
}, z.core.$strip>;
|
|
993
|
+
declare const siteUrlInput: z.ZodObject<{
|
|
994
|
+
url: z.ZodString;
|
|
995
|
+
}, z.core.$strict>;
|
|
996
|
+
/** T1 check_ai_crawler_access / POST /api/site/check-crawlers */
|
|
997
|
+
declare const crawlerAccessResult: z.ZodObject<{
|
|
998
|
+
origin: z.ZodString;
|
|
999
|
+
robotsStatus: z.ZodNumber;
|
|
1000
|
+
robotsMissing: z.ZodBoolean;
|
|
1001
|
+
robotsServerError: z.ZodBoolean;
|
|
1002
|
+
truncated: z.ZodBoolean;
|
|
1003
|
+
sitemaps: z.ZodArray<z.ZodString>;
|
|
1004
|
+
bots: z.ZodArray<z.ZodObject<{
|
|
1005
|
+
token: z.ZodString;
|
|
1006
|
+
operator: z.ZodString;
|
|
1007
|
+
category: z.ZodString;
|
|
1008
|
+
respectsRobots: z.ZodEnum<{
|
|
1009
|
+
yes: "yes";
|
|
1010
|
+
no: "no";
|
|
1011
|
+
unverified: "unverified";
|
|
1012
|
+
}>;
|
|
1013
|
+
allowed: z.ZodBoolean;
|
|
1014
|
+
via: z.ZodEnum<{
|
|
1015
|
+
named: "named";
|
|
1016
|
+
wildcard: "wildcard";
|
|
1017
|
+
none: "none";
|
|
1018
|
+
}>;
|
|
1019
|
+
matchedLine: z.ZodNullable<z.ZodNumber>;
|
|
1020
|
+
note: z.ZodNullable<z.ZodString>;
|
|
1021
|
+
untrusted: z.ZodObject<{
|
|
1022
|
+
matchedRule: z.ZodNullable<z.ZodString>;
|
|
1023
|
+
}, z.core.$strip>;
|
|
1024
|
+
}, z.core.$strip>>;
|
|
1025
|
+
summary: z.ZodObject<{
|
|
1026
|
+
allowed: z.ZodNumber;
|
|
1027
|
+
blocked: z.ZodNumber;
|
|
1028
|
+
}, z.core.$strip>;
|
|
1029
|
+
}, z.core.$strip>;
|
|
1030
|
+
type CrawlerAccessResult = z.infer<typeof crawlerAccessResult>;
|
|
1031
|
+
/** T2 validate_llms_txt / POST /api/site/validate-llms-txt */
|
|
1032
|
+
declare const llmsTxtValidation: z.ZodObject<{
|
|
1033
|
+
origin: z.ZodString;
|
|
1034
|
+
status: z.ZodNumber;
|
|
1035
|
+
missing: z.ZodBoolean;
|
|
1036
|
+
score: z.ZodNullable<z.ZodNumber>;
|
|
1037
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
1038
|
+
severity: z.ZodEnum<{
|
|
1039
|
+
error: "error";
|
|
1040
|
+
warning: "warning";
|
|
1041
|
+
info: "info";
|
|
1042
|
+
}>;
|
|
1043
|
+
message: z.ZodString;
|
|
1044
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
1045
|
+
}, z.core.$strip>>;
|
|
1046
|
+
stats: z.ZodNullable<z.ZodObject<{
|
|
1047
|
+
lines: z.ZodNumber;
|
|
1048
|
+
bytes: z.ZodNumber;
|
|
1049
|
+
sections: z.ZodNumber;
|
|
1050
|
+
entries: z.ZodNumber;
|
|
1051
|
+
entriesWithDescription: z.ZodNumber;
|
|
1052
|
+
}, z.core.$strip>>;
|
|
1053
|
+
linksChecked: z.ZodNumber;
|
|
1054
|
+
brokenLinks: z.ZodArray<z.ZodObject<{
|
|
1055
|
+
url: z.ZodString;
|
|
1056
|
+
status: z.ZodNumber;
|
|
1057
|
+
}, z.core.$strip>>;
|
|
1058
|
+
hasLlmsFullTxt: z.ZodBoolean;
|
|
1059
|
+
}, z.core.$strip>;
|
|
1060
|
+
type LlmsTxtValidation = z.infer<typeof llmsTxtValidation>;
|
|
1061
|
+
declare const LLMS_TXT_DEPTHS: readonly ["index", "full"];
|
|
1062
|
+
type LlmsTxtDepth = (typeof LLMS_TXT_DEPTHS)[number];
|
|
1063
|
+
declare const generateLlmsTxtInput: z.ZodObject<{
|
|
1064
|
+
url: z.ZodString;
|
|
1065
|
+
depth: z.ZodDefault<z.ZodEnum<{
|
|
1066
|
+
index: "index";
|
|
1067
|
+
full: "full";
|
|
1068
|
+
}>>;
|
|
1069
|
+
siteName: z.ZodOptional<z.ZodString>;
|
|
1070
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1071
|
+
}, z.core.$strict>;
|
|
1072
|
+
type GenerateLlmsTxtInput = z.input<typeof generateLlmsTxtInput>;
|
|
1073
|
+
/** T3 generate_llms_txt / POST /api/site/generate-llms-txt */
|
|
1074
|
+
declare const llmsTxtGeneration: z.ZodObject<{
|
|
1075
|
+
untrusted: z.ZodObject<{
|
|
1076
|
+
content: z.ZodString;
|
|
1077
|
+
}, z.core.$strip>;
|
|
1078
|
+
depth: z.ZodEnum<{
|
|
1079
|
+
index: "index";
|
|
1080
|
+
full: "full";
|
|
1081
|
+
}>;
|
|
1082
|
+
pageCount: z.ZodNumber;
|
|
1083
|
+
skippedCount: z.ZodNumber;
|
|
1084
|
+
discoveredVia: z.ZodEnum<{
|
|
1085
|
+
sitemap: "sitemap";
|
|
1086
|
+
links: "links";
|
|
1087
|
+
"sitemap+links": "sitemap+links";
|
|
1088
|
+
}>;
|
|
1089
|
+
timedOut: z.ZodBoolean;
|
|
1090
|
+
notices: z.ZodArray<z.ZodString>;
|
|
1091
|
+
totalWords: z.ZodOptional<z.ZodNumber>;
|
|
1092
|
+
estTokens: z.ZodOptional<z.ZodNumber>;
|
|
1093
|
+
}, z.core.$strip>;
|
|
1094
|
+
type LlmsTxtGeneration = z.infer<typeof llmsTxtGeneration>;
|
|
1095
|
+
/** T4 generate_sitemap / POST /api/site/generate-sitemap */
|
|
1096
|
+
declare const sitemapGeneration: z.ZodObject<{
|
|
1097
|
+
untrusted: z.ZodObject<{
|
|
1098
|
+
xml: z.ZodString;
|
|
1099
|
+
}, z.core.$strip>;
|
|
1100
|
+
urlCount: z.ZodNumber;
|
|
1101
|
+
skipped: z.ZodNumber;
|
|
1102
|
+
discoveredVia: z.ZodEnum<{
|
|
1103
|
+
sitemap: "sitemap";
|
|
1104
|
+
links: "links";
|
|
1105
|
+
"sitemap+links": "sitemap+links";
|
|
1106
|
+
}>;
|
|
1107
|
+
timedOut: z.ZodBoolean;
|
|
1108
|
+
}, z.core.$strip>;
|
|
1109
|
+
type SitemapGeneration = z.infer<typeof sitemapGeneration>;
|
|
1110
|
+
/** T5 analyze_content_chunking / POST /api/site/analyze-chunks. Never carries `html`. */
|
|
1111
|
+
declare const chunkAnalysisResult: z.ZodObject<{
|
|
1112
|
+
url: z.ZodString;
|
|
1113
|
+
mode: z.ZodEnum<{
|
|
1114
|
+
text: "text";
|
|
1115
|
+
html: "html";
|
|
1116
|
+
}>;
|
|
1117
|
+
score: z.ZodNumber;
|
|
1118
|
+
errors: z.ZodNumber;
|
|
1119
|
+
warnings: z.ZodNumber;
|
|
1120
|
+
strengthCount: z.ZodNumber;
|
|
1121
|
+
totalWords: z.ZodNumber;
|
|
1122
|
+
totalTokens: z.ZodNumber;
|
|
1123
|
+
topFixes: z.ZodArray<z.ZodString>;
|
|
1124
|
+
docFindings: z.ZodArray<z.ZodObject<{
|
|
1125
|
+
severity: z.ZodEnum<{
|
|
1126
|
+
error: "error";
|
|
1127
|
+
warning: "warning";
|
|
1128
|
+
}>;
|
|
1129
|
+
message: z.ZodString;
|
|
1130
|
+
}, z.core.$strip>>;
|
|
1131
|
+
chunks: z.ZodArray<z.ZodObject<{
|
|
1132
|
+
level: z.ZodNumber;
|
|
1133
|
+
untrusted: z.ZodObject<{
|
|
1134
|
+
heading: z.ZodNullable<z.ZodString>;
|
|
1135
|
+
}, z.core.$strip>;
|
|
1136
|
+
words: z.ZodNumber;
|
|
1137
|
+
tokens: z.ZodNumber;
|
|
1138
|
+
paragraphs: z.ZodNumber;
|
|
1139
|
+
longestParagraphWords: z.ZodNumber;
|
|
1140
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
1141
|
+
severity: z.ZodEnum<{
|
|
1142
|
+
error: "error";
|
|
1143
|
+
warning: "warning";
|
|
1144
|
+
}>;
|
|
1145
|
+
message: z.ZodString;
|
|
1146
|
+
}, z.core.$strip>>;
|
|
1147
|
+
strengths: z.ZodArray<z.ZodString>;
|
|
1148
|
+
}, z.core.$strip>>;
|
|
1149
|
+
}, z.core.$strip>;
|
|
1150
|
+
type ChunkAnalysisResult = z.infer<typeof chunkAnalysisResult>;
|
|
1151
|
+
/** T6 validate_structured_data / POST /api/site/validate-structured-data. Never raw JSON-LD. */
|
|
1152
|
+
declare const structuredDataValidation: z.ZodObject<{
|
|
1153
|
+
url: z.ZodString;
|
|
1154
|
+
score: z.ZodNumber;
|
|
1155
|
+
entityCount: z.ZodNumber;
|
|
1156
|
+
errors: z.ZodNumber;
|
|
1157
|
+
warnings: z.ZodNumber;
|
|
1158
|
+
passes: z.ZodNumber;
|
|
1159
|
+
microdataCount: z.ZodNumber;
|
|
1160
|
+
rdfaCount: z.ZodNumber;
|
|
1161
|
+
blocks: z.ZodArray<z.ZodObject<{
|
|
1162
|
+
index: z.ZodNumber;
|
|
1163
|
+
syntaxError: z.ZodOptional<z.ZodString>;
|
|
1164
|
+
entities: z.ZodArray<z.ZodObject<{
|
|
1165
|
+
type: z.ZodString;
|
|
1166
|
+
untrusted: z.ZodObject<{
|
|
1167
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1168
|
+
}, z.core.$strip>;
|
|
1169
|
+
aiNote: z.ZodOptional<z.ZodString>;
|
|
1170
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
1171
|
+
severity: z.ZodEnum<{
|
|
1172
|
+
error: "error";
|
|
1173
|
+
warning: "warning";
|
|
1174
|
+
info: "info";
|
|
1175
|
+
pass: "pass";
|
|
1176
|
+
}>;
|
|
1177
|
+
message: z.ZodString;
|
|
1178
|
+
}, z.core.$strip>>;
|
|
1179
|
+
}, z.core.$strip>>;
|
|
1180
|
+
}, z.core.$strip>>;
|
|
1181
|
+
}, z.core.$strip>;
|
|
1182
|
+
type StructuredDataValidation = z.infer<typeof structuredDataValidation>;
|
|
1183
|
+
declare const checkMetaInput: z.ZodObject<{
|
|
1184
|
+
url: z.ZodString;
|
|
1185
|
+
keyword: z.ZodOptional<z.ZodString>;
|
|
1186
|
+
}, z.core.$strict>;
|
|
1187
|
+
type CheckMetaInput = z.infer<typeof checkMetaInput>;
|
|
1188
|
+
/** T7 check_meta_description / POST /api/site/check-meta */
|
|
1189
|
+
declare const metaAnalysisResult: z.ZodObject<{
|
|
1190
|
+
url: z.ZodString;
|
|
1191
|
+
untrusted: z.ZodObject<{
|
|
1192
|
+
title: z.ZodNullable<z.ZodString>;
|
|
1193
|
+
description: z.ZodNullable<z.ZodString>;
|
|
1194
|
+
ogDescription: z.ZodNullable<z.ZodString>;
|
|
1195
|
+
firstParagraph: z.ZodNullable<z.ZodString>;
|
|
1196
|
+
}, z.core.$strip>;
|
|
1197
|
+
score: z.ZodNumber;
|
|
1198
|
+
chars: z.ZodNumber;
|
|
1199
|
+
pixels: z.ZodNumber;
|
|
1200
|
+
desktopCutoff: z.ZodNullable<z.ZodNumber>;
|
|
1201
|
+
mobileCutoff: z.ZodNullable<z.ZodNumber>;
|
|
1202
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
1203
|
+
level: z.ZodEnum<{
|
|
1204
|
+
error: "error";
|
|
1205
|
+
warning: "warning";
|
|
1206
|
+
pass: "pass";
|
|
1207
|
+
suggestion: "suggestion";
|
|
1208
|
+
}>;
|
|
1209
|
+
message: z.ZodString;
|
|
1210
|
+
}, z.core.$strip>>;
|
|
1211
|
+
openingParagraphChecks: z.ZodArray<z.ZodObject<{
|
|
1212
|
+
level: z.ZodEnum<{
|
|
1213
|
+
error: "error";
|
|
1214
|
+
warning: "warning";
|
|
1215
|
+
pass: "pass";
|
|
1216
|
+
suggestion: "suggestion";
|
|
1217
|
+
}>;
|
|
1218
|
+
message: z.ZodString;
|
|
1219
|
+
}, z.core.$strip>>;
|
|
1220
|
+
}, z.core.$strip>;
|
|
1221
|
+
type MetaAnalysisResult = z.infer<typeof metaAnalysisResult>;
|
|
1222
|
+
/**
|
|
1223
|
+
* The seven no-account routes, by client method name. One table so a rename happens in one place.
|
|
1224
|
+
* They live at /api/site/*, deliberately outside /api/v1 (08 section 1.2, 10 section 3.9).
|
|
1225
|
+
*/
|
|
1226
|
+
declare const SITE_ROUTES: {
|
|
1227
|
+
readonly checkCrawlers: "check-crawlers";
|
|
1228
|
+
readonly validateLlmsTxt: "validate-llms-txt";
|
|
1229
|
+
readonly generateLlmsTxt: "generate-llms-txt";
|
|
1230
|
+
readonly generateSitemap: "generate-sitemap";
|
|
1231
|
+
readonly validateStructuredData: "validate-structured-data";
|
|
1232
|
+
readonly checkMeta: "check-meta";
|
|
1233
|
+
readonly analyzeChunks: "analyze-chunks";
|
|
1234
|
+
};
|
|
1235
|
+
type SiteRoute = (typeof SITE_ROUTES)[keyof typeof SITE_ROUTES];
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* The typed fetch wrapper every machine client of whereamimentioned goes through (10-CLI section
|
|
1239
|
+
* 12.1). Neither the CLI nor the MCP server calls `fetch` against /api/v1 directly.
|
|
1240
|
+
*
|
|
1241
|
+
* What it does, and nothing more:
|
|
1242
|
+
* - attaches `Authorization: Bearer` and `X-Wam-Api-Version` on every /api/v1 call;
|
|
1243
|
+
* - sends `X-Wam-Org` on org-scoped calls and SUPPRESSES it on the three routes that resolve no
|
|
1244
|
+
* organization (`organizations.list`, `organizations.create`, `keys.revokeSelf`);
|
|
1245
|
+
* - sends `Idempotency-Key` on the two routes that require it (`scans.create`,
|
|
1246
|
+
* `organizations.create`) and on no other;
|
|
1247
|
+
* - maps the 08 section 4.2 error envelope to a typed `ApiError`, reading `X-Request-Id` and
|
|
1248
|
+
* `Retry-After`; a 2xx whose body is not JSON becomes the same `ApiError` (code `unknown`);
|
|
1249
|
+
* - exposes the last response's status and headers as `lastResponse`, including whether it was an
|
|
1250
|
+
* idempotent replay (`X-Idempotent-Replay`), because the 08 bodies deliberately carry no replay
|
|
1251
|
+
* flag and the status plus that header are the only signal (08 sections 7.1 and 7.3);
|
|
1252
|
+
* - retries idempotent GETs only, at most twice, with exponential backoff, on 502/503/504 and on
|
|
1253
|
+
* network-level failures. A POST is never retried. A 429 is never retried: the server has
|
|
1254
|
+
* already said stop, and `retryAfterSeconds` on the error tells the caller when.
|
|
1255
|
+
* - aborts any request after `timeoutMs` (default 30 s).
|
|
1256
|
+
*
|
|
1257
|
+
* It does not validate response bodies against the contract at runtime: the routes are asserted
|
|
1258
|
+
* against the contract schemas in the server's own tests, and a client that re-serialised a parsed
|
|
1259
|
+
* copy could never promise "byte-identical to the API body" to `--json` consumers.
|
|
1260
|
+
*/
|
|
1261
|
+
|
|
1262
|
+
declare const DEFAULT_BASE_URL = "https://whereamimentioned.com";
|
|
1263
|
+
declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
1264
|
+
/** The /api/v1 surface version this client was built against (08 section 4.3, 10 section 9.1). */
|
|
1265
|
+
declare const SUPPORTED_API_VERSION: number;
|
|
1266
|
+
/** Idempotent GETs only: at most this many retries, so three attempts in total. */
|
|
1267
|
+
declare const MAX_GET_RETRIES = 2;
|
|
1268
|
+
interface WamClientOptions {
|
|
1269
|
+
baseUrl: string;
|
|
1270
|
+
token?: string;
|
|
1271
|
+
org?: string;
|
|
1272
|
+
fetch?: typeof globalThis.fetch;
|
|
1273
|
+
userAgent: string;
|
|
1274
|
+
timeoutMs?: number;
|
|
1275
|
+
}
|
|
1276
|
+
declare class ApiError extends Error {
|
|
1277
|
+
readonly status: number;
|
|
1278
|
+
readonly code: ApiErrorCode | string;
|
|
1279
|
+
readonly requestId: string | null;
|
|
1280
|
+
readonly details: Record<string, unknown> | undefined;
|
|
1281
|
+
readonly retryAfterSeconds: number | null;
|
|
1282
|
+
constructor(init: {
|
|
1283
|
+
status: number;
|
|
1284
|
+
code: ApiErrorCode | string;
|
|
1285
|
+
message: string;
|
|
1286
|
+
requestId: string | null;
|
|
1287
|
+
details?: Record<string, unknown>;
|
|
1288
|
+
retryAfterSeconds: number | null;
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
/** The request exceeded `timeoutMs`. Not retried: the caller set that budget deliberately. */
|
|
1292
|
+
declare class ApiTimeoutError extends Error {
|
|
1293
|
+
readonly timeoutMs: number;
|
|
1294
|
+
readonly method: string;
|
|
1295
|
+
readonly path: string;
|
|
1296
|
+
constructor(method: string, path: string, timeoutMs: number);
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* What the last completed request answered with, beyond its body. The 08 bodies deliberately carry
|
|
1300
|
+
* no replay flag (the signal is the status and `X-Idempotent-Replay`), so this is where a caller
|
|
1301
|
+
* reads it: `scans.create` or `organizations.create` resolves with the body, and `lastResponse.replayed`
|
|
1302
|
+
* then says whether it was the original 201 or the 200 of 08 sections 7.1 and 7.3. It is per client
|
|
1303
|
+
* instance and describes the most recent completed request (null before the first, and null again
|
|
1304
|
+
* while a request is in flight or after one failed at the network level), so a caller running
|
|
1305
|
+
* concurrent requests on one instance must read it before issuing the next call. The CLI is
|
|
1306
|
+
* sequential (estimate, confirm, create); the MCP server reads `replayed` in-process instead.
|
|
1307
|
+
*/
|
|
1308
|
+
interface WamResponseMeta {
|
|
1309
|
+
status: number;
|
|
1310
|
+
headers: Headers;
|
|
1311
|
+
/** `X-Idempotent-Replay: true` was present. Always false on a 201. */
|
|
1312
|
+
replayed: boolean;
|
|
1313
|
+
}
|
|
1314
|
+
interface WamClient {
|
|
1315
|
+
/** The integer from the last `X-Wam-Api-Version` response header seen, success or failure. */
|
|
1316
|
+
readonly lastApiVersion: number | null;
|
|
1317
|
+
/** The last `X-Request-Id` seen. For `--debug` output and support tickets. */
|
|
1318
|
+
readonly lastRequestId: string | null;
|
|
1319
|
+
/** Status, headers and the replay flag of the last completed request, success or failure. */
|
|
1320
|
+
readonly lastResponse: WamResponseMeta | null;
|
|
1321
|
+
me(): Promise<Me>;
|
|
1322
|
+
credits(): Promise<Credits>;
|
|
1323
|
+
organizations: {
|
|
1324
|
+
list(q?: PageQuery): Promise<Page<OrganizationSummary>>;
|
|
1325
|
+
create(body: CreateOrganizationBody, idempotencyKey: string): Promise<CreateOrganizationResult>;
|
|
1326
|
+
};
|
|
1327
|
+
workspaces: {
|
|
1328
|
+
list(q?: PageQuery): Promise<Page<WorkspaceSummary>>;
|
|
1329
|
+
get(slug: string): Promise<WorkspaceDetail>;
|
|
1330
|
+
create(orgSlug: string, body: CreateWorkspaceBody): Promise<WorkspaceDetail>;
|
|
1331
|
+
};
|
|
1332
|
+
scans: {
|
|
1333
|
+
list(ws: string, q?: ScanListQuery): Promise<Page<ScanSummary>>;
|
|
1334
|
+
estimate(ws: string): Promise<ScanEstimate>;
|
|
1335
|
+
create(ws: string, body: CreateScanBody, idempotencyKey: string): Promise<CreateScanResult>;
|
|
1336
|
+
get(scanId: string): Promise<ScanStatus>;
|
|
1337
|
+
answers(scanId: string, q?: AnswerListQuery): Promise<Page<ScanAnswer>>;
|
|
1338
|
+
report(scanId: string, format: ReportFormat): Promise<ReportData | Uint8Array>;
|
|
1339
|
+
};
|
|
1340
|
+
prompts: {
|
|
1341
|
+
list(ws: string, q?: PromptListQuery): Promise<PromptListResponse>;
|
|
1342
|
+
create(ws: string, body: CreatePromptBody): Promise<Prompt>;
|
|
1343
|
+
patch(ws: string, promptId: string, body: PatchPromptBody): Promise<Prompt>;
|
|
1344
|
+
/** A 404 here is success: the prompt is already gone (08 section 4.8). */
|
|
1345
|
+
remove(ws: string, promptId: string): Promise<void>;
|
|
1346
|
+
};
|
|
1347
|
+
competitors: {
|
|
1348
|
+
list(ws: string, q?: PageQuery): Promise<Page<Competitor>>;
|
|
1349
|
+
create(ws: string, body: CreateCompetitorBody): Promise<Competitor>;
|
|
1350
|
+
};
|
|
1351
|
+
recommendations: {
|
|
1352
|
+
list(ws: string, q?: RecommendationListQuery): Promise<Page<Recommendation>>;
|
|
1353
|
+
};
|
|
1354
|
+
citations: {
|
|
1355
|
+
list(ws: string, q?: CitationListQuery): Promise<Page<Citation>>;
|
|
1356
|
+
};
|
|
1357
|
+
site: {
|
|
1358
|
+
checkCrawlers(url: string): Promise<CrawlerAccessResult>;
|
|
1359
|
+
validateLlmsTxt(url: string): Promise<LlmsTxtValidation>;
|
|
1360
|
+
generateLlmsTxt(url: string, opts?: {
|
|
1361
|
+
full?: boolean;
|
|
1362
|
+
}): Promise<LlmsTxtGeneration>;
|
|
1363
|
+
generateSitemap(url: string): Promise<SitemapGeneration>;
|
|
1364
|
+
validateStructuredData(url: string): Promise<StructuredDataValidation>;
|
|
1365
|
+
checkMeta(url: string, keyword?: string): Promise<MetaAnalysisResult>;
|
|
1366
|
+
analyzeChunks(url: string): Promise<ChunkAnalysisResult>;
|
|
1367
|
+
};
|
|
1368
|
+
keys: {
|
|
1369
|
+
revokeSelf(all?: "cli"): Promise<RevokeSelfResult>;
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
declare function createWamClient(opts: WamClientOptions): WamClient;
|
|
1373
|
+
|
|
1374
|
+
export { ANSWER_CITATIONS_MAX, ANSWER_TEXT_MAX_CHARS, API_ERROR_CODES, API_ERROR_DETAILS, API_KEY_ENVS, API_KEY_KINDS, API_SCOPES, API_VERSION, API_VERSION_HEADER, type AnswerCitation, type AnswerListQuery, ApiError, type ApiErrorBody, type ApiErrorCode, type ApiKeyEnv, type ApiKeyKind, type ApiScope, ApiTimeoutError, type BrandPresent, CITATION_BUCKETS, type CheckMetaInput, type ChunkAnalysisResult, type Citation, type CitationBucket, type CitationListQuery, type Competitor, type ConflictDetails, type CrawlerAccessResult, type CreateCompetitorBody, type CreateOrganizationBody, type CreateOrganizationResult, type CreatePromptBody, type CreateScanBody, type CreateScanResult, type CreateWorkspaceBody, type Credits, DEFAULT_BASE_URL, DEFAULT_TIMEOUT_MS, type DeletePromptResult, type EstimateScanBody, type FeatureNotAvailableDetails, type GenerateLlmsTxtInput, IDEMPOTENT_REPLAY_HEADER, INTENT_STAGES, type InsufficientCreditsDetails, type IntentStage, LLMS_TXT_DEPTHS, type LatestScanRef, type LlmsTxtDepth, type LlmsTxtGeneration, type LlmsTxtValidation, MAX_GET_RETRIES, type Me, type MetaAnalysisResult, ORG_ROLES, ORG_TYPES, type OrgRole, type OrgType, type OrganizationSummary, PROMPT_SOURCES, PROMPT_TYPES, type Page, type PageQuery, type Pagination, type PatchPromptBody, type Prompt, type PromptListQuery, type PromptListResponse, type PromptSource, type PromptType, QUOTE_TTL_SECONDS, type QuotePayload, READ_ONLY_SCOPES, RECOMMENDATION_STATUSES, RECOMMENDATION_TYPES, REPORT_FORMATS, type RateLimitedDetails, type Recommendation, type RecommendationListQuery, type RecommendationStatus, type RecommendationType, type ReportData, type ReportFormat, type ReportNotFoundDetails, type RevokeSelfResult, SCAN_MODES, SCAN_STATUSES, SENTIMENTS, SITE_ROUTES, SUPPORTED_API_VERSION, type ScanAlreadyRunningDetails, type ScanAnswer, type ScanEstimate, type ScanListQuery, type ScanMode, type ScanModelRef, type ScanProgress, type ScanStatus, type ScanStatus$1 as ScanStatusValue, type ScanSummary, type Sentiment, type SiteRoute, type SitemapGeneration, type StructuredDataValidation, TIERS, type Tier, type ValidationFailedDetails, type WamClient, type WamClientOptions, type WamResponseMeta, type WorkspaceDetail, type WorkspaceSummary, answerCitation, answerListQuery, apiErrorBody, brandPresent, checkMetaInput, chunkAnalysisResult, citation, citationListQuery, competitor, conflictDetails, crawlerAccessResult, createCompetitorBody, createOrganizationBody, createOrganizationResult, createPromptBody, createScanBody, createScanResult, createWamClient, createWorkspaceBody, credits, deletePromptResult, estimateScanBody, featureNotAvailableDetails, generateLlmsTxtInput, idempotencyKey, insufficientCreditsDetails, latestScanRef, llmsTxtGeneration, llmsTxtValidation, meResponse, metaAnalysisResult, organizationSummary, page, pageQuery, pagination, parseErrorDetails, patchPromptBody, prompt, promptListQuery, promptListResponse, quotePayload, rateLimitedDetails, recommendation, recommendationListQuery, reportData, reportNotFoundDetails, requestId, revokeSelfQuery, revokeSelfResult, scanAlreadyRunningDetails, scanAnswer, scanEstimate, scanListQuery, scanModelRef, scanProgress, scanStatus, scanSummary, siteUrlInput, sitemapGeneration, structuredDataValidation, validationFailedDetails, workspaceDetail, workspaceSummary };
|