UNPKG

@vigilbase/cli

Version:

Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.

60 lines (59 loc) • 2.66 kB
/** Header names and builders shared by every product on api.vigilbase.com. */ export declare const REQUEST_ID_HEADER = "X-Request-Id"; export declare const IDEMPOTENCY_HEADER = "Idempotency-Key"; /** Informational only: the major version is in the path. */ export declare const API_VERSION_HEADER = "API-Version"; export declare const RATE_LIMIT_HEADER = "RateLimit"; export declare const RATE_LIMIT_POLICY_HEADER = "RateLimit-Policy"; export declare const RETRY_AFTER_HEADER = "Retry-After"; export declare const DEPRECATION_HEADER = "Deprecation"; export declare const SUNSET_HEADER = "Sunset"; export declare const LINK_HEADER = "Link"; /** * Inbound request IDs are echoed into logs, problem bodies and responses, so * only a narrow, inert alphabet is accepted: 8 to 128 characters, no * whitespace, quotes, separators or control characters. OS's own pattern * (observability/src/request.ts) is a subset, so its IDs pass here too. */ export declare const REQUEST_ID_PATTERN: RegExp; export declare function isValidRequestId(value: unknown): value is string; export declare function newRequestId(): string; /** The caller's `X-Request-Id` when it is well-formed, otherwise a new one. */ export declare function resolveRequestId(headers: { get(name: string): string | null; }): string; /** * RateLimit and RateLimit-Policy, draft-ietf-httpapi-ratelimit-headers-11 * (structured-field lists of `"<policy>";…` items): * * RateLimit-Policy: "<policy>";q=<quota>;w=<window seconds> * RateLimit: "<policy>";r=<remaining>;t=<seconds until reset> * * plus `Retry-After` when the request was refused. The legacy `X-RateLimit-*` * and `RateLimit-Limit/-Remaining/-Reset` aliases stay on legacy hosts only. */ export interface RateLimitState { policy: string; quota: number; windowSeconds: number; remaining: number; resetSeconds: number; retryAfterSeconds?: number; } export declare function rateLimitHeaders(state: RateLimitState): Record<string, string>; export interface Deprecation { /** When the operation was (or will be) deprecated. */ at: Date; /** When it stops answering; never before `at` (RFC 9745 §4). */ sunset?: Date; /** Absolute URL of the replacement. */ successor?: string; /** Absolute URL of the deprecation notice. */ docs?: string; } /** * `Deprecation: @<epoch seconds>` (RFC 9745 §2.1, a structured-field Date, not * the pre-RFC `true`), `Sunset: <IMF-fixdate>` (RFC 8594) and `Link` relations * `successor-version` and `deprecation` (RFC 9745 §3). */ export declare function deprecationHeaders(deprecation: Deprecation): Record<string, string>;