@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
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/** Theme adjusts the gamma curve applied during image transformation. */
|
|
2
|
+
type ThemeOption = "light" | "dark";
|
|
3
|
+
/** Full MIME-type output formats supported by the worker's image pipeline. */
|
|
4
|
+
type SupportedOutputFormat = "image/png" | "image/jpeg" | "image/webp" | "image/avif";
|
|
5
|
+
/** Shorthand aliases accepted in query parameters and SDK options. */
|
|
6
|
+
type FormatShorthand = "png" | "jpeg" | "webp" | "avif";
|
|
7
|
+
/**
|
|
8
|
+
* Structured metadata parsed from the worker's response headers.
|
|
9
|
+
*
|
|
10
|
+
* Every successful response includes cache, rate-limit, and quota information.
|
|
11
|
+
* Transformation metadata is present when the image pipeline processes the request.
|
|
12
|
+
*/
|
|
13
|
+
interface LogoMetadata {
|
|
14
|
+
cache: {
|
|
15
|
+
status: "HIT" | "MISS";
|
|
16
|
+
};
|
|
17
|
+
rateLimit: {
|
|
18
|
+
remaining: number;
|
|
19
|
+
reset: Date;
|
|
20
|
+
};
|
|
21
|
+
quota: {
|
|
22
|
+
remaining: number;
|
|
23
|
+
limit: number;
|
|
24
|
+
};
|
|
25
|
+
transformation: {
|
|
26
|
+
applied: boolean;
|
|
27
|
+
status?: "not-requested" | "unsupported-format" | "transformation-error";
|
|
28
|
+
method?: "images-binding";
|
|
29
|
+
width?: number;
|
|
30
|
+
greyscale?: boolean;
|
|
31
|
+
gamma?: number;
|
|
32
|
+
};
|
|
33
|
+
tokenPrefix?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Response shape returned by the server client's `get()` method.
|
|
37
|
+
*
|
|
38
|
+
* - `buffer` — Raw image bytes as a Node.js Buffer.
|
|
39
|
+
* - `contentType` — MIME type of the image (e.g. "image/png").
|
|
40
|
+
* - `metadata` — Parsed response headers (cache, rate-limit, quota, transformation).
|
|
41
|
+
*/
|
|
42
|
+
interface ServerLogoResponse {
|
|
43
|
+
buffer: Buffer;
|
|
44
|
+
contentType: string;
|
|
45
|
+
metadata: LogoMetadata;
|
|
46
|
+
}
|
|
47
|
+
/** Lifecycle status of a background scrape job. */
|
|
48
|
+
type ScrapeJobStatus = "pending" | "complete" | "failed";
|
|
49
|
+
/**
|
|
50
|
+
* Event emitted during scrape polling to report progress.
|
|
51
|
+
*
|
|
52
|
+
* - `status` — Current job status.
|
|
53
|
+
* - `progress` — Optional progress percentage (0-100).
|
|
54
|
+
* - `logo` — Present when status is "complete"; contains the scraped logo details.
|
|
55
|
+
* - `error` — Present when status is "failed"; contains the error message.
|
|
56
|
+
*/
|
|
57
|
+
interface ScrapeProgressEvent {
|
|
58
|
+
status: ScrapeJobStatus;
|
|
59
|
+
progress?: number;
|
|
60
|
+
logo?: {
|
|
61
|
+
id: number;
|
|
62
|
+
url: string;
|
|
63
|
+
companyId: number;
|
|
64
|
+
companyName: string;
|
|
65
|
+
};
|
|
66
|
+
error?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Discriminated union of all machine-readable error codes used by the SDK.
|
|
70
|
+
*
|
|
71
|
+
* Each code maps to a specific error class or error condition:
|
|
72
|
+
* - `DOMAIN_VALIDATION_ERROR` — {@link DomainValidationError}
|
|
73
|
+
* - `RATE_LIMIT_ERROR` — {@link RateLimitError}
|
|
74
|
+
* - `QUOTA_EXCEEDED_ERROR` — {@link QuotaExceededError}
|
|
75
|
+
* - `AUTHENTICATION_ERROR` — {@link AuthenticationError}
|
|
76
|
+
* - `FORBIDDEN_ERROR` — {@link ForbiddenError}
|
|
77
|
+
* - `NOT_FOUND_ERROR` — {@link NotFoundError}
|
|
78
|
+
* - `SCRAPE_TIMEOUT_ERROR` — {@link ScrapeTimeoutError}
|
|
79
|
+
* - `ABORT_ERROR` — Abort signal triggered
|
|
80
|
+
* - `NETWORK_ERROR` — Network failure
|
|
81
|
+
* - `SERVER_ERROR` — HTTP 5xx response
|
|
82
|
+
* - `UNEXPECTED_ERROR` — Unhandled HTTP status
|
|
83
|
+
* - `SCRAPE_FAILED` — Scrape job failed
|
|
84
|
+
* - `SCRAPE_PARSE_ERROR` — Scrape response parsing failure
|
|
85
|
+
* - `BAD_REQUEST_ERROR` — {@link BadRequestError}
|
|
86
|
+
*/
|
|
87
|
+
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";
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @quikturn/logos SDK — Error Classes
|
|
91
|
+
*
|
|
92
|
+
* Structured error hierarchy for the Logos SDK. All errors extend LogoError,
|
|
93
|
+
* which itself extends the native Error class with a machine-readable `code`
|
|
94
|
+
* and an optional HTTP `status`.
|
|
95
|
+
*
|
|
96
|
+
* The Object.setPrototypeOf pattern is required to restore the prototype chain
|
|
97
|
+
* when extending built-in classes (Error) under ES5 downlevel emit, ensuring
|
|
98
|
+
* `instanceof` checks work correctly in all environments.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Base error class for all Logos SDK errors.
|
|
103
|
+
*
|
|
104
|
+
* Every error carries a human-readable `message`, a machine-readable `code`
|
|
105
|
+
* (a {@link LogoErrorCode} discriminated union), and an optional HTTP `status` code.
|
|
106
|
+
*/
|
|
107
|
+
declare class LogoError extends Error {
|
|
108
|
+
code: LogoErrorCode;
|
|
109
|
+
status?: number;
|
|
110
|
+
constructor(message: string, code: LogoErrorCode, status?: number);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @quikturn/logos SDK -- Server Batch Operations
|
|
115
|
+
*
|
|
116
|
+
* Fetches logos for multiple domains with concurrency control, order
|
|
117
|
+
* preservation, partial failure handling, rate-limit backoff, and
|
|
118
|
+
* AbortSignal support.
|
|
119
|
+
*
|
|
120
|
+
* The module is decoupled from the server fetcher via a `fetchFn`
|
|
121
|
+
* parameter, making it easy to test and compose with different fetch
|
|
122
|
+
* implementations.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Options for batch logo fetching.
|
|
127
|
+
*
|
|
128
|
+
* - `concurrency` -- Maximum parallel fetches. Default: 5.
|
|
129
|
+
* - `size` -- Output width in pixels.
|
|
130
|
+
* - `greyscale` -- When true, applies saturation: 0 transformation.
|
|
131
|
+
* - `theme` -- "light" or "dark" gamma curve.
|
|
132
|
+
* - `format` -- Output image format (MIME type or shorthand).
|
|
133
|
+
* - `signal` -- AbortSignal to cancel remaining batch items.
|
|
134
|
+
* - `continueOnError` -- When true (default), errors are captured per-domain
|
|
135
|
+
* rather than aborting the entire batch.
|
|
136
|
+
*/
|
|
137
|
+
interface BatchOptions {
|
|
138
|
+
concurrency?: number;
|
|
139
|
+
size?: number;
|
|
140
|
+
greyscale?: boolean;
|
|
141
|
+
theme?: ThemeOption;
|
|
142
|
+
format?: SupportedOutputFormat | FormatShorthand;
|
|
143
|
+
signal?: AbortSignal;
|
|
144
|
+
continueOnError?: boolean;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A single result from a batch fetch operation.
|
|
148
|
+
*
|
|
149
|
+
* On success: `success` is true, `buffer`, `contentType`, and `metadata` are set.
|
|
150
|
+
* On failure: `success` is false, `error` is set.
|
|
151
|
+
*/
|
|
152
|
+
interface BatchResult {
|
|
153
|
+
domain: string;
|
|
154
|
+
success: boolean;
|
|
155
|
+
buffer?: Buffer;
|
|
156
|
+
contentType?: string;
|
|
157
|
+
metadata?: LogoMetadata;
|
|
158
|
+
error?: LogoError;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Fetches logos for multiple domains with concurrency control.
|
|
162
|
+
* Yields results in the same order as the input domains array.
|
|
163
|
+
*
|
|
164
|
+
* The `fetchFn` parameter is a function that takes a domain and returns
|
|
165
|
+
* a result object with buffer, contentType, metadata. This decouples
|
|
166
|
+
* the batch module from the server fetcher implementation.
|
|
167
|
+
*
|
|
168
|
+
* Rate limit handling: when fetchFn throws a {@link RateLimitError},
|
|
169
|
+
* the batch pauses ALL pending work for `retryAfter` seconds before
|
|
170
|
+
* retrying the failed domain.
|
|
171
|
+
*
|
|
172
|
+
* @param domains - Array of domain strings to fetch logos for.
|
|
173
|
+
* @param fetchFn - Async function that fetches a single logo by domain.
|
|
174
|
+
* @param options - Optional batch configuration.
|
|
175
|
+
* @yields {BatchResult} Results in the same order as the input domains.
|
|
176
|
+
*/
|
|
177
|
+
declare function getMany(domains: string[], fetchFn: (domain: string) => Promise<{
|
|
178
|
+
buffer: Buffer;
|
|
179
|
+
contentType: string;
|
|
180
|
+
metadata: LogoMetadata;
|
|
181
|
+
}>, options?: BatchOptions): AsyncGenerator<BatchResult>;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @quikturn/logos SDK — Server Fetch Wrapper
|
|
185
|
+
*
|
|
186
|
+
* Low-level fetch wrapper for the server entry point. Handles HTTP error
|
|
187
|
+
* mapping, retry logic for rate-limited and server-error responses,
|
|
188
|
+
* AbortSignal propagation, and proactive warning callbacks when rate-limit
|
|
189
|
+
* or quota headroom drops below 10%.
|
|
190
|
+
*
|
|
191
|
+
* Unlike the browser fetcher, this module sends the secret key as an
|
|
192
|
+
* `Authorization: Bearer` header — tokens are NEVER appended as query
|
|
193
|
+
* parameters.
|
|
194
|
+
*/
|
|
195
|
+
/**
|
|
196
|
+
* Options accepted by {@link serverFetch}.
|
|
197
|
+
*
|
|
198
|
+
* - `token` — Required: secret key (`sk_` prefix) sent as Bearer token.
|
|
199
|
+
* - `maxRetries` — Maximum number of retry attempts for 429/500 responses. Default: 2.
|
|
200
|
+
* - `signal` — An `AbortSignal` to cancel the in-flight request.
|
|
201
|
+
* - `format` — MIME type string used as the `Accept` request header.
|
|
202
|
+
* - `onRateLimitWarning` — Called when `X-RateLimit-Remaining` drops below 10% of the limit.
|
|
203
|
+
* - `onQuotaWarning` — Called when `X-Quota-Remaining` drops below 10% of the limit.
|
|
204
|
+
*/
|
|
205
|
+
interface ServerFetcherOptions {
|
|
206
|
+
token: string;
|
|
207
|
+
maxRetries?: number;
|
|
208
|
+
signal?: AbortSignal;
|
|
209
|
+
format?: string;
|
|
210
|
+
onRateLimitWarning?: (remaining: number, limit: number) => void;
|
|
211
|
+
onQuotaWarning?: (remaining: number, limit: number) => void;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Performs a fetch request to the Logos API with Bearer token authentication,
|
|
215
|
+
* error mapping, and retry logic.
|
|
216
|
+
*
|
|
217
|
+
* **Key difference from browser fetcher:**
|
|
218
|
+
* The secret key is sent as an `Authorization: Bearer {token}` header and is
|
|
219
|
+
* NEVER included in the URL query string.
|
|
220
|
+
*
|
|
221
|
+
* **Error mapping:**
|
|
222
|
+
* | Status | Error Class | Notes |
|
|
223
|
+
* |--------|-----------------------|--------------------------------------------|
|
|
224
|
+
* | 401 | AuthenticationError | Invalid or missing API token |
|
|
225
|
+
* | 403 | ForbiddenError | Body text used as `reason` |
|
|
226
|
+
* | 404 | NotFoundError | Domain extracted from URL path |
|
|
227
|
+
* | 429 | QuotaExceededError | When `X-Quota-Limit` header is present |
|
|
228
|
+
* | 429 | RateLimitError | After retries are exhausted |
|
|
229
|
+
* | 500 | LogoError | After a single retry attempt |
|
|
230
|
+
*
|
|
231
|
+
* **Retry behavior:**
|
|
232
|
+
* - 429: Waits `Retry-After` seconds (default 60s), retries up to `maxRetries`.
|
|
233
|
+
* If `X-Quota-Limit` is present, throws `QuotaExceededError` immediately.
|
|
234
|
+
* - 500: Retries once after a 1-second delay, then throws.
|
|
235
|
+
* - AbortError: Never retried; throws immediately.
|
|
236
|
+
* - Network errors: Never retried; throws immediately.
|
|
237
|
+
*
|
|
238
|
+
* @param url - Fully-qualified Logos API URL (built by `logoUrl`).
|
|
239
|
+
* @param options - Fetch configuration including the required `token`.
|
|
240
|
+
* @returns The raw `Response` object on success (2xx).
|
|
241
|
+
*
|
|
242
|
+
* @throws {AuthenticationError} On 401.
|
|
243
|
+
* @throws {ForbiddenError} On 403.
|
|
244
|
+
* @throws {NotFoundError} On 404.
|
|
245
|
+
* @throws {RateLimitError} On 429 after retries exhausted (no quota header).
|
|
246
|
+
* @throws {QuotaExceededError} On 429 with `X-Quota-Limit` header.
|
|
247
|
+
* @throws {LogoError} On 500, network error, or abort.
|
|
248
|
+
*/
|
|
249
|
+
declare function serverFetch(url: string, options: ServerFetcherOptions): Promise<Response>;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @quikturn/logos SDK — Server Client Class
|
|
253
|
+
*
|
|
254
|
+
* High-level API for fetching logos on the server (Node.js). Integrates the
|
|
255
|
+
* URL builder, server fetcher, batch module, scrape poller, and header parser
|
|
256
|
+
* into a single ergonomic class with event emission.
|
|
257
|
+
*
|
|
258
|
+
* Unlike the browser client, the server client:
|
|
259
|
+
* - Requires a secret key (sk_ prefix) instead of publishable keys.
|
|
260
|
+
* - Sends authentication via Authorization: Bearer header, not query params.
|
|
261
|
+
* - Returns raw Buffers instead of Blobs.
|
|
262
|
+
* - Provides getStream() for streaming responses.
|
|
263
|
+
* - Provides getMany() for concurrent batch fetching.
|
|
264
|
+
*
|
|
265
|
+
* Usage:
|
|
266
|
+
* ```ts
|
|
267
|
+
* import { QuikturnLogos } from "@quikturn/logos/server";
|
|
268
|
+
*
|
|
269
|
+
* const client = new QuikturnLogos({ secretKey: "sk_your_key" });
|
|
270
|
+
* const { buffer, contentType, metadata } = await client.get("github.com", { size: 256 });
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Configuration options for the server client constructor.
|
|
276
|
+
*
|
|
277
|
+
* - `secretKey` — Required secret key (sk_ prefix). Publishable keys (qt_/pk_) are rejected.
|
|
278
|
+
* - `baseUrl` — Override the default API base URL. Useful for testing or proxied environments.
|
|
279
|
+
* - `maxRetries` — Maximum number of retry attempts for rate-limited/server-error responses. Default: 2.
|
|
280
|
+
*/
|
|
281
|
+
interface ServerClientOptions {
|
|
282
|
+
secretKey: string;
|
|
283
|
+
baseUrl?: string;
|
|
284
|
+
maxRetries?: number;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Options accepted by {@link QuikturnLogos.get} and {@link QuikturnLogos.getStream}.
|
|
288
|
+
*
|
|
289
|
+
* - `size` — Output width in pixels.
|
|
290
|
+
* - `width` — Alias for `size`.
|
|
291
|
+
* - `greyscale` — When true, returns a greyscale image.
|
|
292
|
+
* - `theme` — "light" or "dark" gamma adjustment.
|
|
293
|
+
* - `format` — Output image format (MIME type or shorthand).
|
|
294
|
+
* - `autoScrape` — When true, triggers background scrape if logo is not found.
|
|
295
|
+
* - `scrapeTimeout` — Maximum time (ms) to wait for a scrape to complete.
|
|
296
|
+
* - `onScrapeProgress`— Callback fired on each scrape poll.
|
|
297
|
+
* - `signal` — AbortSignal to cancel the request.
|
|
298
|
+
*/
|
|
299
|
+
interface ServerGetOptions {
|
|
300
|
+
size?: number;
|
|
301
|
+
width?: number;
|
|
302
|
+
greyscale?: boolean;
|
|
303
|
+
theme?: ThemeOption;
|
|
304
|
+
format?: SupportedOutputFormat | FormatShorthand;
|
|
305
|
+
autoScrape?: boolean;
|
|
306
|
+
scrapeTimeout?: number;
|
|
307
|
+
onScrapeProgress?: (event: ScrapeProgressEvent) => void;
|
|
308
|
+
signal?: AbortSignal;
|
|
309
|
+
}
|
|
310
|
+
/** Events emitted by the client via the on()/off() interface. */
|
|
311
|
+
type ClientEvent = "rateLimitWarning" | "quotaWarning";
|
|
312
|
+
/** Handler signature for client events. Receives the remaining count and tier limit. */
|
|
313
|
+
type EventHandler = (remaining: number, limit: number) => void;
|
|
314
|
+
/**
|
|
315
|
+
* Server client for the Quikturn Logos API.
|
|
316
|
+
*
|
|
317
|
+
* Manages the full lifecycle of logo requests including URL construction,
|
|
318
|
+
* network fetching with Bearer token authentication and retries, scrape
|
|
319
|
+
* polling, response parsing, batch fetching, and streaming.
|
|
320
|
+
*/
|
|
321
|
+
declare class QuikturnLogos {
|
|
322
|
+
private readonly secretKey;
|
|
323
|
+
private readonly baseUrl?;
|
|
324
|
+
private readonly maxRetries;
|
|
325
|
+
private readonly listeners;
|
|
326
|
+
constructor(options: ServerClientOptions);
|
|
327
|
+
/**
|
|
328
|
+
* Fetches a logo for the given domain and returns a {@link ServerLogoResponse}.
|
|
329
|
+
*
|
|
330
|
+
* The returned `buffer` is a Node.js Buffer containing the raw image bytes.
|
|
331
|
+
*
|
|
332
|
+
* @param domain - The domain to fetch a logo for (e.g. "github.com").
|
|
333
|
+
* @param options - Optional request configuration.
|
|
334
|
+
* @returns A ServerLogoResponse containing the Buffer, content type, and metadata.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```ts
|
|
338
|
+
* const client = new QuikturnLogos({ secretKey: "sk_your_key" });
|
|
339
|
+
* const { buffer, contentType } = await client.get("github.com", { size: 256 });
|
|
340
|
+
* fs.writeFileSync("logo.png", buffer);
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
get(domain: string, options?: ServerGetOptions): Promise<ServerLogoResponse>;
|
|
344
|
+
/**
|
|
345
|
+
* Fetches logos for multiple domains with concurrency control.
|
|
346
|
+
*
|
|
347
|
+
* Yields {@link BatchResult} items in the same order as the input domains.
|
|
348
|
+
* Delegates to the batch module's `getMany` with a fetch function that
|
|
349
|
+
* calls `this.get()` internally.
|
|
350
|
+
*
|
|
351
|
+
* @param domains - Array of domain strings to fetch logos for.
|
|
352
|
+
* @param options - Optional batch configuration (concurrency, format, etc.).
|
|
353
|
+
* @yields BatchResult items for each domain.
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* ```ts
|
|
357
|
+
* const client = new QuikturnLogos({ secretKey: "sk_your_key" });
|
|
358
|
+
* for await (const result of client.getMany(["github.com", "gitlab.com"])) {
|
|
359
|
+
* if (result.success) {
|
|
360
|
+
* fs.writeFileSync(`${result.domain}.png`, result.buffer!);
|
|
361
|
+
* }
|
|
362
|
+
* }
|
|
363
|
+
* ```
|
|
364
|
+
*/
|
|
365
|
+
getMany(domains: string[], options?: Omit<BatchOptions, "signal"> & {
|
|
366
|
+
signal?: AbortSignal;
|
|
367
|
+
}): AsyncGenerator<BatchResult>;
|
|
368
|
+
/**
|
|
369
|
+
* Fetches a logo and returns the raw Response body as a ReadableStream.
|
|
370
|
+
*
|
|
371
|
+
* Useful for piping to a file or HTTP response without buffering the
|
|
372
|
+
* entire image in memory.
|
|
373
|
+
*
|
|
374
|
+
* @param domain - The domain to fetch a logo for.
|
|
375
|
+
* @param options - Optional request configuration.
|
|
376
|
+
* @returns A ReadableStream of the response body.
|
|
377
|
+
* @throws {Error} If the response body is null (streaming not available).
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```ts
|
|
381
|
+
* const client = new QuikturnLogos({ secretKey: "sk_your_key" });
|
|
382
|
+
* const stream = await client.getStream("github.com");
|
|
383
|
+
* const writable = fs.createWriteStream("logo.png");
|
|
384
|
+
* Readable.fromWeb(stream).pipe(writable);
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
getStream(domain: string, options?: ServerGetOptions): Promise<ReadableStream>;
|
|
388
|
+
/**
|
|
389
|
+
* Returns a plain URL string for the given domain without making a network request.
|
|
390
|
+
*
|
|
391
|
+
* The URL does not include authentication — use Authorization: Bearer header
|
|
392
|
+
* when fetching. Secret keys (sk_) must never appear in URLs.
|
|
393
|
+
*
|
|
394
|
+
* @param domain - The domain to build a URL for.
|
|
395
|
+
* @param options - Optional request parameters (size, format, etc.).
|
|
396
|
+
* @returns A fully-qualified Logos API URL string (without token).
|
|
397
|
+
*/
|
|
398
|
+
getUrl(domain: string, options?: Omit<ServerGetOptions, "autoScrape" | "scrapeTimeout" | "onScrapeProgress" | "signal">): string;
|
|
399
|
+
/**
|
|
400
|
+
* Registers an event listener for a client event.
|
|
401
|
+
*
|
|
402
|
+
* @param event - The event name ("rateLimitWarning" or "quotaWarning").
|
|
403
|
+
* @param handler - Callback invoked with (remaining, limit) when the event fires.
|
|
404
|
+
*/
|
|
405
|
+
on(event: ClientEvent, handler: EventHandler): void;
|
|
406
|
+
/**
|
|
407
|
+
* Removes a previously registered event listener.
|
|
408
|
+
*
|
|
409
|
+
* @param event - The event name.
|
|
410
|
+
* @param handler - The handler to remove.
|
|
411
|
+
*/
|
|
412
|
+
off(event: ClientEvent, handler: EventHandler): void;
|
|
413
|
+
/**
|
|
414
|
+
* Emits an event to all registered listeners.
|
|
415
|
+
*
|
|
416
|
+
* @param event - The event name to emit.
|
|
417
|
+
* @param remaining - The remaining count.
|
|
418
|
+
* @param limit - The tier limit.
|
|
419
|
+
*/
|
|
420
|
+
private emit;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export { type BatchOptions, type BatchResult, type ClientEvent, type EventHandler, QuikturnLogos, type ServerClientOptions, type ServerFetcherOptions, type ServerGetOptions, getMany, serverFetch };
|