@quikturn/logos 0.2.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/LICENSE +21 -0
- package/README.md +498 -0
- package/dist/client/index.cjs +726 -0
- package/dist/client/index.d.cts +399 -0
- package/dist/client/index.d.ts +399 -0
- package/dist/client/index.mjs +721 -0
- package/dist/index.cjs +319 -0
- package/dist/index.d.cts +437 -0
- package/dist/index.d.ts +437 -0
- package/dist/index.mjs +294 -0
- package/dist/server/index.cjs +858 -0
- package/dist/server/index.d.cts +423 -0
- package/dist/server/index.d.ts +423 -0
- package/dist/server/index.mjs +854 -0
- package/package.json +89 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @quikturn/logos SDK — Public Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* All types mirror the Cloudflare Worker's type system exactly.
|
|
5
|
+
* This file contains only type-level constructs (no runtime code).
|
|
6
|
+
*
|
|
7
|
+
* Source of truth: cf-worker-logos/src/types.ts, options.ts, rateLimit.ts, monthlyQuota.ts
|
|
8
|
+
*/
|
|
9
|
+
/** Distinguishes between publishable (browser-safe) and secret (server-only) keys. */
|
|
10
|
+
type KeyType = "publishable" | "secret";
|
|
11
|
+
/** Valid key prefixes used to identify key type from the token string. */
|
|
12
|
+
type KeyPrefix = "qt_" | "pk_" | "sk_";
|
|
13
|
+
/** Subscription tier determining rate limits, monthly quotas, and max image width. */
|
|
14
|
+
type Tier = "free" | "launch" | "growth" | "enterprise";
|
|
15
|
+
/** Current lifecycle status of an API token. */
|
|
16
|
+
type TokenStatus = "active" | "suspended" | "revoked";
|
|
17
|
+
/** Theme adjusts the gamma curve applied during image transformation. */
|
|
18
|
+
type ThemeOption = "light" | "dark";
|
|
19
|
+
/** Full MIME-type output formats supported by the worker's image pipeline. */
|
|
20
|
+
type SupportedOutputFormat = "image/png" | "image/jpeg" | "image/webp" | "image/avif";
|
|
21
|
+
/** Shorthand aliases accepted in query parameters and SDK options. */
|
|
22
|
+
type FormatShorthand = "png" | "jpeg" | "webp" | "avif";
|
|
23
|
+
/**
|
|
24
|
+
* Options accepted by the URL builder and both client classes.
|
|
25
|
+
*
|
|
26
|
+
* - `token` — Publishable key (qt_/pk_) appended as a query parameter.
|
|
27
|
+
* - `size` — Output width in pixels. Clamped to 1..800 (publishable) or 1..1200 (secret). Default: 128.
|
|
28
|
+
* - `width` — Alias for `size`.
|
|
29
|
+
* - `greyscale` — When true, applies saturation: 0 transformation. Default: false.
|
|
30
|
+
* - `theme` — "light" (gamma 0.9) or "dark" (gamma 1.12).
|
|
31
|
+
* - `format` — Output image format. Accepts full MIME type or shorthand. Default: "image/png".
|
|
32
|
+
* - `autoScrape` — When true, triggers a background scrape if the logo is not found. Default: false.
|
|
33
|
+
* - `baseUrl` — Override the default API base URL. Useful for testing or proxied environments.
|
|
34
|
+
*/
|
|
35
|
+
interface LogoRequestOptions {
|
|
36
|
+
token?: string;
|
|
37
|
+
size?: number;
|
|
38
|
+
width?: number;
|
|
39
|
+
greyscale?: boolean;
|
|
40
|
+
theme?: ThemeOption;
|
|
41
|
+
format?: SupportedOutputFormat | FormatShorthand;
|
|
42
|
+
autoScrape?: boolean;
|
|
43
|
+
baseUrl?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Structured metadata parsed from the worker's response headers.
|
|
47
|
+
*
|
|
48
|
+
* Every successful response includes cache, rate-limit, and quota information.
|
|
49
|
+
* Transformation metadata is present when the image pipeline processes the request.
|
|
50
|
+
*/
|
|
51
|
+
interface LogoMetadata {
|
|
52
|
+
cache: {
|
|
53
|
+
status: "HIT" | "MISS";
|
|
54
|
+
};
|
|
55
|
+
rateLimit: {
|
|
56
|
+
remaining: number;
|
|
57
|
+
reset: Date;
|
|
58
|
+
};
|
|
59
|
+
quota: {
|
|
60
|
+
remaining: number;
|
|
61
|
+
limit: number;
|
|
62
|
+
};
|
|
63
|
+
transformation: {
|
|
64
|
+
applied: boolean;
|
|
65
|
+
status?: "not-requested" | "unsupported-format" | "transformation-error";
|
|
66
|
+
method?: "images-binding";
|
|
67
|
+
width?: number;
|
|
68
|
+
greyscale?: boolean;
|
|
69
|
+
gamma?: number;
|
|
70
|
+
};
|
|
71
|
+
tokenPrefix?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Response shape returned by the browser client's `get()` method.
|
|
75
|
+
*
|
|
76
|
+
* - `url` — A `blob:` object URL suitable for `<img src>`.
|
|
77
|
+
* - `blob` — The raw image Blob for further processing.
|
|
78
|
+
* - `contentType` — MIME type of the image (e.g. "image/webp").
|
|
79
|
+
* - `metadata` — Parsed response headers (cache, rate-limit, quota, transformation).
|
|
80
|
+
*/
|
|
81
|
+
interface BrowserLogoResponse {
|
|
82
|
+
url: string;
|
|
83
|
+
blob: Blob;
|
|
84
|
+
contentType: string;
|
|
85
|
+
metadata: LogoMetadata;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Response shape returned by the server client's `get()` method.
|
|
89
|
+
*
|
|
90
|
+
* - `buffer` — Raw image bytes as a Node.js Buffer.
|
|
91
|
+
* - `contentType` — MIME type of the image (e.g. "image/png").
|
|
92
|
+
* - `metadata` — Parsed response headers (cache, rate-limit, quota, transformation).
|
|
93
|
+
*/
|
|
94
|
+
interface ServerLogoResponse {
|
|
95
|
+
buffer: Buffer;
|
|
96
|
+
contentType: string;
|
|
97
|
+
metadata: LogoMetadata;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Describes a background scrape job returned in a 202 response.
|
|
101
|
+
*
|
|
102
|
+
* - `jobId` — Unique identifier for the scrape job.
|
|
103
|
+
* - `pollUrl` — URL to poll for scrape progress.
|
|
104
|
+
* - `estimatedWaitMs` — Estimated time in milliseconds before the scrape completes.
|
|
105
|
+
*/
|
|
106
|
+
interface ScrapeJob {
|
|
107
|
+
jobId: string;
|
|
108
|
+
pollUrl: string;
|
|
109
|
+
estimatedWaitMs: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The JSON body returned by the worker when a 202 (scrape pending) response is issued.
|
|
113
|
+
*
|
|
114
|
+
* - `status` — Always "scrape_pending".
|
|
115
|
+
* - `message` — Human-readable status message.
|
|
116
|
+
* - `companyId` — Optional identifier of the matched company.
|
|
117
|
+
* - `companyName` — Optional name of the matched company.
|
|
118
|
+
* - `scrapeJob` — Details for polling the scrape job.
|
|
119
|
+
*/
|
|
120
|
+
interface ScrapePendingResponse {
|
|
121
|
+
status: "scrape_pending";
|
|
122
|
+
message: string;
|
|
123
|
+
companyId?: number;
|
|
124
|
+
companyName?: string;
|
|
125
|
+
scrapeJob: ScrapeJob;
|
|
126
|
+
}
|
|
127
|
+
/** Lifecycle status of a background scrape job. */
|
|
128
|
+
type ScrapeJobStatus = "pending" | "complete" | "failed";
|
|
129
|
+
/**
|
|
130
|
+
* Event emitted during scrape polling to report progress.
|
|
131
|
+
*
|
|
132
|
+
* - `status` — Current job status.
|
|
133
|
+
* - `progress` — Optional progress percentage (0-100).
|
|
134
|
+
* - `logo` — Present when status is "complete"; contains the scraped logo details.
|
|
135
|
+
* - `error` — Present when status is "failed"; contains the error message.
|
|
136
|
+
*/
|
|
137
|
+
interface ScrapeProgressEvent {
|
|
138
|
+
status: ScrapeJobStatus;
|
|
139
|
+
progress?: number;
|
|
140
|
+
logo?: {
|
|
141
|
+
id: number;
|
|
142
|
+
url: string;
|
|
143
|
+
companyId: number;
|
|
144
|
+
companyName: string;
|
|
145
|
+
};
|
|
146
|
+
error?: string;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Possible attribution verification states for free-tier consumers.
|
|
150
|
+
*
|
|
151
|
+
* - "verified" — Attribution confirmed and valid.
|
|
152
|
+
* - "pending" — Verification in progress; treated as valid.
|
|
153
|
+
* - "unverified" — Attribution not yet set up.
|
|
154
|
+
* - "failed" — Verification attempted but failed.
|
|
155
|
+
* - "grace-period" — Temporary grace; validity depends on graceDeadline.
|
|
156
|
+
* - "error" — An error occurred during verification.
|
|
157
|
+
*/
|
|
158
|
+
type AttributionStatus = "verified" | "pending" | "unverified" | "failed" | "grace-period" | "error";
|
|
159
|
+
/**
|
|
160
|
+
* Structured attribution information parsed from response headers.
|
|
161
|
+
*
|
|
162
|
+
* - `status` — Current attribution verification state.
|
|
163
|
+
* - `graceDeadline` — If in grace period, the deadline by which attribution must be verified.
|
|
164
|
+
* - `verifiedAt` — Timestamp of when attribution was last verified.
|
|
165
|
+
* - `isValid` — Derived boolean: true when status is "verified", "pending",
|
|
166
|
+
* or "grace-period" with a future graceDeadline.
|
|
167
|
+
*/
|
|
168
|
+
interface AttributionInfo {
|
|
169
|
+
status: AttributionStatus;
|
|
170
|
+
graceDeadline?: Date;
|
|
171
|
+
verifiedAt?: Date;
|
|
172
|
+
isValid: boolean;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Discriminated union of all machine-readable error codes used by the SDK.
|
|
176
|
+
*
|
|
177
|
+
* Each code maps to a specific error class or error condition:
|
|
178
|
+
* - `DOMAIN_VALIDATION_ERROR` — {@link DomainValidationError}
|
|
179
|
+
* - `RATE_LIMIT_ERROR` — {@link RateLimitError}
|
|
180
|
+
* - `QUOTA_EXCEEDED_ERROR` — {@link QuotaExceededError}
|
|
181
|
+
* - `AUTHENTICATION_ERROR` — {@link AuthenticationError}
|
|
182
|
+
* - `FORBIDDEN_ERROR` — {@link ForbiddenError}
|
|
183
|
+
* - `NOT_FOUND_ERROR` — {@link NotFoundError}
|
|
184
|
+
* - `SCRAPE_TIMEOUT_ERROR` — {@link ScrapeTimeoutError}
|
|
185
|
+
* - `ABORT_ERROR` — Abort signal triggered
|
|
186
|
+
* - `NETWORK_ERROR` — Network failure
|
|
187
|
+
* - `SERVER_ERROR` — HTTP 5xx response
|
|
188
|
+
* - `UNEXPECTED_ERROR` — Unhandled HTTP status
|
|
189
|
+
* - `SCRAPE_FAILED` — Scrape job failed
|
|
190
|
+
* - `SCRAPE_PARSE_ERROR` — Scrape response parsing failure
|
|
191
|
+
* - `BAD_REQUEST_ERROR` — {@link BadRequestError}
|
|
192
|
+
*/
|
|
193
|
+
type LogoErrorCode = "DOMAIN_VALIDATION_ERROR" | "RATE_LIMIT_ERROR" | "QUOTA_EXCEEDED_ERROR" | "AUTHENTICATION_ERROR" | "FORBIDDEN_ERROR" | "NOT_FOUND_ERROR" | "SCRAPE_TIMEOUT_ERROR" | "ABORT_ERROR" | "NETWORK_ERROR" | "SERVER_ERROR" | "UNEXPECTED_ERROR" | "SCRAPE_FAILED" | "SCRAPE_PARSE_ERROR" | "BAD_REQUEST_ERROR";
|
|
194
|
+
|
|
195
|
+
/** Root endpoint for the Quikturn Logos API. */
|
|
196
|
+
declare const BASE_URL: "https://logos.getquikturn.io";
|
|
197
|
+
/** Default logo width in pixels when no size/width is provided. */
|
|
198
|
+
declare const DEFAULT_WIDTH: 128;
|
|
199
|
+
/** Maximum width (px) for requests using publishable keys (qt_/pk_). */
|
|
200
|
+
declare const MAX_WIDTH: 800;
|
|
201
|
+
/** Maximum width (px) for requests using secret keys (sk_). */
|
|
202
|
+
declare const MAX_WIDTH_SERVER: 1200;
|
|
203
|
+
/** Default MIME type returned when no format is specified. */
|
|
204
|
+
declare const DEFAULT_FORMAT: SupportedOutputFormat;
|
|
205
|
+
/** All MIME types the Logos API can produce. */
|
|
206
|
+
declare const SUPPORTED_FORMATS: ReadonlySet<SupportedOutputFormat>;
|
|
207
|
+
/** Maps shorthand format strings to their full MIME types. */
|
|
208
|
+
declare const FORMAT_ALIASES: Readonly<Record<FormatShorthand, SupportedOutputFormat>>;
|
|
209
|
+
/**
|
|
210
|
+
* Per-tier rate limits for publishable-key (browser) requests.
|
|
211
|
+
* All tiers share a 60-second sliding window.
|
|
212
|
+
*/
|
|
213
|
+
declare const RATE_LIMITS: Readonly<Record<Tier, {
|
|
214
|
+
requests: number;
|
|
215
|
+
windowSeconds: number;
|
|
216
|
+
}>>;
|
|
217
|
+
/**
|
|
218
|
+
* Per-tier rate limits for secret-key (server) requests.
|
|
219
|
+
* The free tier does not have server-side access.
|
|
220
|
+
*/
|
|
221
|
+
declare const SERVER_RATE_LIMITS: Readonly<Record<Exclude<Tier, "free">, {
|
|
222
|
+
requests: number;
|
|
223
|
+
windowSeconds: number;
|
|
224
|
+
}>>;
|
|
225
|
+
/** All subscription tiers as a runtime-iterable tuple. */
|
|
226
|
+
declare const TIERS: readonly Tier[];
|
|
227
|
+
/** All key types as a runtime-iterable tuple. */
|
|
228
|
+
declare const KEY_TYPES: readonly KeyType[];
|
|
229
|
+
/** Maximum logo requests per calendar month for each tier. */
|
|
230
|
+
declare const MONTHLY_LIMITS: Readonly<Record<Tier, number>>;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @quikturn/logos SDK — URL Builder
|
|
234
|
+
*
|
|
235
|
+
* Pure function that constructs a fully-qualified Logos API URL from a domain
|
|
236
|
+
* string and optional request parameters. No network calls are made.
|
|
237
|
+
*
|
|
238
|
+
* The URL builder performs strict domain validation (RFC 1035/1123), resolves
|
|
239
|
+
* size/format options, and appends only non-default query parameters to keep
|
|
240
|
+
* generated URLs concise.
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Constructs a fully-qualified Logos API URL for the given domain.
|
|
245
|
+
*
|
|
246
|
+
* This is a pure function with no side effects. It validates the domain,
|
|
247
|
+
* resolves size and format options, and builds a URL with only the
|
|
248
|
+
* non-default query parameters appended.
|
|
249
|
+
*
|
|
250
|
+
* @param domain - The domain to fetch a logo for (e.g. "github.com").
|
|
251
|
+
* @param options - Optional request parameters (token, size, format, etc.).
|
|
252
|
+
* @returns A fully-qualified URL string.
|
|
253
|
+
*
|
|
254
|
+
* @throws {DomainValidationError} If the domain fails RFC 1035/1123 validation.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* logoUrl("github.com");
|
|
259
|
+
* // => "https://logos.getquikturn.io/github.com"
|
|
260
|
+
*
|
|
261
|
+
* logoUrl("github.com", { size: 256, greyscale: true, token: "qt_abc123" });
|
|
262
|
+
* // => "https://logos.getquikturn.io/github.com?token=qt_abc123&size=256&greyscale=1"
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
declare function logoUrl(domain: string, options?: LogoRequestOptions): string;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* @quikturn/logos SDK — Response Header Parser
|
|
269
|
+
*
|
|
270
|
+
* Parses structured metadata from Cloudflare Worker response headers into
|
|
271
|
+
* strongly-typed SDK objects. The worker attaches cache status, rate-limit
|
|
272
|
+
* counters, monthly quota info, and image transformation details as custom
|
|
273
|
+
* `X-` headers on every successful response.
|
|
274
|
+
*
|
|
275
|
+
* Two public functions are exported:
|
|
276
|
+
* - `parseLogoHeaders` — extracts a full `LogoMetadata` object.
|
|
277
|
+
* - `parseRetryAfter` — extracts the `Retry-After` value for 429 handling.
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Parses Cloudflare Worker response headers into a `LogoMetadata` object.
|
|
282
|
+
*
|
|
283
|
+
* Extracts and normalizes the following header families:
|
|
284
|
+
*
|
|
285
|
+
* | Header | Field |
|
|
286
|
+
* |-----------------------------|---------------------------------|
|
|
287
|
+
* | `X-Cache-Status` | `cache.status` |
|
|
288
|
+
* | `X-RateLimit-Remaining` | `rateLimit.remaining` |
|
|
289
|
+
* | `X-RateLimit-Reset` | `rateLimit.reset` (as `Date`) |
|
|
290
|
+
* | `X-Quota-Remaining` | `quota.remaining` |
|
|
291
|
+
* | `X-Quota-Limit` | `quota.limit` |
|
|
292
|
+
* | `X-Quikturn-Token` | `tokenPrefix` |
|
|
293
|
+
* | `X-Transformation-Applied` | `transformation.applied` |
|
|
294
|
+
* | `X-Transformation-Status` | `transformation.status` |
|
|
295
|
+
* | `X-Transformation-Method` | `transformation.method` |
|
|
296
|
+
* | `X-Transformation-Width` | `transformation.width` |
|
|
297
|
+
* | `X-Transformation-Greyscale`| `transformation.greyscale` |
|
|
298
|
+
* | `X-Transformation-Gamma` | `transformation.gamma` |
|
|
299
|
+
*
|
|
300
|
+
* Missing or unparseable numeric headers fall back to `0` for required fields
|
|
301
|
+
* and `undefined` for optional fields. The cache status defaults to `"MISS"`
|
|
302
|
+
* unless the header value is exactly `"HIT"`.
|
|
303
|
+
*
|
|
304
|
+
* @param headers - The `Headers` object from a fetch `Response`.
|
|
305
|
+
* @returns A fully-populated `LogoMetadata` object.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* const response = await fetch(logoUrl("github.com"));
|
|
310
|
+
* const metadata = parseLogoHeaders(response.headers);
|
|
311
|
+
* console.log(metadata.cache.status); // "HIT" or "MISS"
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
declare function parseLogoHeaders(headers: Headers): LogoMetadata;
|
|
315
|
+
/**
|
|
316
|
+
* Parses the `Retry-After` response header into a numeric value (seconds).
|
|
317
|
+
*
|
|
318
|
+
* The Logos API always sends `Retry-After` as an integer number of seconds
|
|
319
|
+
* (not an HTTP-date). Returns `null` when the header is absent or its value
|
|
320
|
+
* cannot be parsed as a finite number.
|
|
321
|
+
*
|
|
322
|
+
* @param headers - The `Headers` object from a fetch `Response`.
|
|
323
|
+
* @returns The retry delay in seconds, or `null` if not present.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```ts
|
|
327
|
+
* const retryAfter = parseRetryAfter(response.headers);
|
|
328
|
+
* if (retryAfter !== null) {
|
|
329
|
+
* await new Promise((r) => setTimeout(r, retryAfter * 1000));
|
|
330
|
+
* }
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
declare function parseRetryAfter(headers: Headers): number | null;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* @quikturn/logos SDK — Error Classes
|
|
337
|
+
*
|
|
338
|
+
* Structured error hierarchy for the Logos SDK. All errors extend LogoError,
|
|
339
|
+
* which itself extends the native Error class with a machine-readable `code`
|
|
340
|
+
* and an optional HTTP `status`.
|
|
341
|
+
*
|
|
342
|
+
* The Object.setPrototypeOf pattern is required to restore the prototype chain
|
|
343
|
+
* when extending built-in classes (Error) under ES5 downlevel emit, ensuring
|
|
344
|
+
* `instanceof` checks work correctly in all environments.
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Base error class for all Logos SDK errors.
|
|
349
|
+
*
|
|
350
|
+
* Every error carries a human-readable `message`, a machine-readable `code`
|
|
351
|
+
* (a {@link LogoErrorCode} discriminated union), and an optional HTTP `status` code.
|
|
352
|
+
*/
|
|
353
|
+
declare class LogoError extends Error {
|
|
354
|
+
code: LogoErrorCode;
|
|
355
|
+
status?: number;
|
|
356
|
+
constructor(message: string, code: LogoErrorCode, status?: number);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Thrown when a domain string fails RFC 1035/1123 validation.
|
|
360
|
+
*
|
|
361
|
+
* Includes the invalid `domain` for diagnostic purposes.
|
|
362
|
+
*/
|
|
363
|
+
declare class DomainValidationError extends LogoError {
|
|
364
|
+
domain: string;
|
|
365
|
+
constructor(message: string, domain: string);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Thrown when a per-minute rate limit is exceeded (HTTP 429).
|
|
369
|
+
*
|
|
370
|
+
* - `retryAfter` — seconds until the next request will be accepted.
|
|
371
|
+
* - `remaining` — requests remaining in the current window (always 0).
|
|
372
|
+
* - `resetAt` — Date when the rate-limit window resets.
|
|
373
|
+
*/
|
|
374
|
+
declare class RateLimitError extends LogoError {
|
|
375
|
+
retryAfter: number;
|
|
376
|
+
remaining: number;
|
|
377
|
+
resetAt: Date;
|
|
378
|
+
constructor(message: string, retryAfter: number, remaining: number, resetAt: Date);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Thrown when the monthly request quota is exhausted (HTTP 429).
|
|
382
|
+
*
|
|
383
|
+
* - `retryAfter` — seconds until the quota resets (beginning of next month).
|
|
384
|
+
* - `limit` — total monthly quota for the current tier.
|
|
385
|
+
* - `used` — number of requests consumed so far this month.
|
|
386
|
+
*/
|
|
387
|
+
declare class QuotaExceededError extends LogoError {
|
|
388
|
+
retryAfter: number;
|
|
389
|
+
limit: number;
|
|
390
|
+
used: number;
|
|
391
|
+
constructor(message: string, retryAfter: number, limit: number, used: number);
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Thrown when the API token is missing, malformed, or expired (HTTP 401).
|
|
395
|
+
*/
|
|
396
|
+
declare class AuthenticationError extends LogoError {
|
|
397
|
+
constructor(message: string);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Thrown when the API token is valid but lacks permission for the
|
|
401
|
+
* requested operation (HTTP 403).
|
|
402
|
+
*
|
|
403
|
+
* - `reason` — machine-readable explanation (e.g. "tier_too_low").
|
|
404
|
+
*/
|
|
405
|
+
declare class ForbiddenError extends LogoError {
|
|
406
|
+
reason: string;
|
|
407
|
+
constructor(message: string, reason: string);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Thrown when no logo exists for the requested domain and auto-scrape
|
|
411
|
+
* is not enabled (HTTP 404).
|
|
412
|
+
*
|
|
413
|
+
* - `domain` — the domain that was looked up.
|
|
414
|
+
*/
|
|
415
|
+
declare class NotFoundError extends LogoError {
|
|
416
|
+
domain: string;
|
|
417
|
+
constructor(message: string, domain: string);
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Thrown when a background scrape job exceeds the configured polling timeout.
|
|
421
|
+
*
|
|
422
|
+
* - `jobId` — the unique identifier of the timed-out scrape job.
|
|
423
|
+
* - `elapsed` — milliseconds elapsed before the timeout was triggered.
|
|
424
|
+
*/
|
|
425
|
+
declare class ScrapeTimeoutError extends LogoError {
|
|
426
|
+
jobId: string;
|
|
427
|
+
elapsed: number;
|
|
428
|
+
constructor(message: string, jobId: string, elapsed: number);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Thrown when the request is malformed or contains invalid parameters (HTTP 400).
|
|
432
|
+
*/
|
|
433
|
+
declare class BadRequestError extends LogoError {
|
|
434
|
+
constructor(message: string);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export { type AttributionInfo, type AttributionStatus, AuthenticationError, BASE_URL, BadRequestError, type BrowserLogoResponse, DEFAULT_FORMAT, DEFAULT_WIDTH, DomainValidationError, FORMAT_ALIASES, ForbiddenError, type FormatShorthand, KEY_TYPES, type KeyPrefix, type KeyType, LogoError, type LogoErrorCode, type LogoMetadata, type LogoRequestOptions, MAX_WIDTH, MAX_WIDTH_SERVER, MONTHLY_LIMITS, NotFoundError, QuotaExceededError, RATE_LIMITS, RateLimitError, SERVER_RATE_LIMITS, SUPPORTED_FORMATS, type ScrapeJob, type ScrapeJobStatus, type ScrapePendingResponse, type ScrapeProgressEvent, ScrapeTimeoutError, type ServerLogoResponse, type SupportedOutputFormat, TIERS, type ThemeOption, type Tier, type TokenStatus, logoUrl, parseLogoHeaders, parseRetryAfter };
|