UNPKG

@allma/core-sdk

Version:

Core SDK with shared utilities (logging, auth, S3 utils) for building on the Allma serverless AI orchestration platform.

26 lines 1.49 kB
import type { AdminApiErrorResponse, AdminApiSuccessResponse } from '@allma/core-types'; import type { APIGatewayProxyResultV2 } from 'aws-lambda'; /** * Builds a standardized success response object. * @param data The data payload for the successful response. * @returns AdminApiSuccessResponse<T> */ export declare function buildSuccessResponse<T>(data: T): AdminApiSuccessResponse<T>; /** * Builds a standardized error response object. * @param message The error message. * @param code An optional error code (e.g., 'NOT_FOUND', 'VALIDATION_ERROR'). * @param details Optional additional error details. * @returns AdminApiErrorResponse */ export declare function buildErrorResponse(message: string, code: string, details?: any): AdminApiErrorResponse; /** * Creates a complete APIGatewayProxyResultV2 object for Lambda responses. * It determines the HTTP status code based on the success flag and error code. * @param defaultStatusCode The HTTP status code to use if success is true, or if no specific error code maps to a status. * @param bodyObject The AdminApiSuccessResponse or AdminApiErrorResponse to be stringified in the body. * @param correlationId Optional correlation ID for logging. * @returns APIGatewayProxyResultV2 */ export declare function createApiGatewayResponse(defaultStatusCode: number, bodyObject: AdminApiSuccessResponse<any> | AdminApiErrorResponse, correlationId?: string): APIGatewayProxyResultV2; //# sourceMappingURL=apiResponseBuilder.d.ts.map