import { G as GQPAdapter, F as FieldType, n as GQPNode, Q as QueryFilters, b as QueryOptions } from '../../types-CqJN-Ev5.js'; /** * REST API Adapter for GQP * Wraps REST APIs as GQP data sources */ /** * REST resource configuration */ interface RESTResource { /** API endpoint path (e.g., '/users' or '/users/:id') */ endpoint: string; /** Primary key field name */ idField?: string; /** Resource description */ description?: string; /** Schema definition for the resource */ schema?: Record; /** Related resources */ relations?: Record; /** Custom headers for this resource */ headers?: Record; } /** * REST adapter configuration */ interface RESTAdapterConfig { /** Base URL for the API */ baseURL: string; /** Authentication configuration */ auth?: { type: "bearer" | "basic" | "apikey"; token?: string; apiKey?: string; apiKeyHeader?: string; username?: string; password?: string; }; /** Default headers */ headers?: Record; /** Resource definitions */ resources: Record; /** Rate limiting */ rateLimit?: { requests: number; window: "second" | "minute" | "hour"; }; /** Request timeout in ms */ timeout?: number; } /** * REST Adapter Implementation */ declare class RESTAdapter implements GQPAdapter { name: string; private config; private rateLimitState; constructor(config: RESTAdapterConfig); /** * Introspect REST API resources and return GQP nodes */ introspect(): Promise; /** * Execute a query against the REST API */ execute(nodeName: string, filters: QueryFilters, options: QueryOptions): Promise; /** * Get count from REST API (if supported) */ count(nodeName: string, filters: QueryFilters): Promise; /** * Convert REST resource to GQP node */ private resourceToNode; /** * Build URL with query parameters - with SSRF protection */ private buildURL; /** * Check if hostname is a private/internal network */ private isPrivateHost; /** * Build request headers - with injection protection */ private buildHeaders; /** * Make HTTP request with timeout */ private fetch; /** * Check and update rate limit */ private checkRateLimit; } /** * Factory function to create REST adapter * * @example * ```typescript * import { GQP } from '@mzhub/gqp'; * import { fromREST } from '@mzhub/gqp/rest'; * * const graph = new GQP({ * sources: { * stripe: fromREST({ * baseURL: 'https://api.stripe.com/v1', * auth: { type: 'bearer', token: process.env.STRIPE_KEY }, * resources: { * charges: { * endpoint: '/charges', * idField: 'id', * schema: { * id: 'String', * amount: 'Int', * status: 'String' * } * } * } * }) * } * }); * ``` */ declare function fromREST(config: RESTAdapterConfig): GQPAdapter; export { RESTAdapter, type RESTAdapterConfig, type RESTResource, fromREST };