/** * External API source configuration * @module source */ /** * Options for external API source configuration */ export interface ExternalSourceOptions { /** Path prefix like '/v1' or '/api' - prepended to all endpoints */ pathPrefix?: string; /** Override auto-pluralization: 'product' instead of 'products' */ resourceName?: string; /** Override specific endpoints when API doesn't follow REST conventions */ override?: { list?: string; get?: string; create?: string; update?: string; delete?: string; }; /** Auth config for this API */ auth?: { type: 'bearer' | 'api-key'; header?: string; }; } /** * Compiled external source configuration */ export interface ExternalSourceConfig { type: 'external'; /** Base URL - can use 'env:VARIABLE_NAME' syntax */ baseUrl: string; /** Path prefix */ pathPrefix: string; /** Resource name (pluralized entity name) */ resourceName?: string; /** Resolved endpoints */ endpoints: { list: string; get: string; create: string; update: string; delete: string; }; /** Auth configuration */ auth?: { type: 'bearer' | 'api-key'; header: string; }; } /** * Database source configuration (default when no external source) */ export interface DatabaseSourceConfig { type: 'database'; } /** * Entity source configuration - either database or external API */ export type SourceConfig = DatabaseSourceConfig | ExternalSourceConfig; /** * Create an external API source configuration * * @param baseUrl - Base URL for the API. Supports 'env:VARIABLE_NAME' syntax. * @param options - Optional configuration for path prefix, resource name, endpoint overrides * @returns ExternalSourceConfig for use in entity or manifest source field * * @example * ```typescript * // Simple - all defaults * source: external('env:API_URL') * // Generates: GET/POST /products, GET/PUT/DELETE /products/:id * * // With version prefix * source: external('env:API_URL', { pathPrefix: '/v1' }) * // Generates: /v1/products, /v1/products/:id * * // Override weird endpoints * source: external('env:LEGACY_API', { * override: { * list: 'GET /catalog/search', * get: 'GET /catalog/item/:sku', * } * }) * ``` */ export declare function external(baseUrl: string, options?: ExternalSourceOptions): ExternalSourceConfig; /** * Resolve the final endpoints for an entity, using its name for pluralization */ export declare function resolveEndpoints(entityName: string, source: ExternalSourceConfig): ExternalSourceConfig['endpoints']; //# sourceMappingURL=source.d.ts.map