/** * Tinybird Token API client */ /** * API configuration for token operations. * Requires a token with TOKENS or ADMIN scope. */ export interface TokenApiConfig { /** Tinybird API base URL */ baseUrl: string; /** Workspace token with TOKENS or ADMIN scope */ token: string; /** Custom fetch implementation (optional, defaults to global fetch) */ fetch?: typeof fetch; /** Default timeout in milliseconds (optional) */ timeout?: number; } /** * Error thrown by token API operations */ export declare class TokenApiError extends Error { readonly status: number; readonly body?: unknown | undefined; constructor(message: string, status: number, body?: unknown | undefined); } /** * Scope type for JWT tokens */ export type JWTScopeType = "PIPES:READ" | "DATASOURCES:READ" | "DATASOURCES:APPEND"; /** * A scope definition for JWT tokens */ export interface JWTScope { /** The type of access being granted */ type: JWTScopeType; /** The resource name (pipe or datasource) */ resource: string; /** Fixed parameters embedded in the JWT (for pipes) */ fixed_params?: Record; /** SQL filter expression (for datasources) */ filter?: string; } /** * Rate limiting configuration for JWT tokens */ export interface JWTLimits { /** Requests per second limit */ rps?: number; } /** * Options for creating a JWT token */ export interface CreateJWTOptions { /** Token name/identifier */ name: string; /** Expiration time as Date, Unix timestamp (number), or ISO string */ expiresAt: Date | number | string; /** Array of scopes defining access permissions */ scopes: JWTScope[]; /** Optional rate limiting configuration */ limits?: JWTLimits; } /** * Result of creating a JWT token */ export interface CreateJWTResult { /** The generated JWT token string */ token: string; } /** * Create a JWT token * POST /v0/tokens/?expiration_time={unix_timestamp} * * @param config - API configuration (requires TOKENS or ADMIN scope) * @param options - JWT creation options * @returns The created JWT token */ export declare function createJWT(config: TokenApiConfig, options: CreateJWTOptions): Promise; //# sourceMappingURL=tokens.d.ts.map