(
data: T,
meta: Record<string, any> = {}
)
| 25 | * Create a success response with the given data |
| 26 | */ |
| 27 | export function formatSuccessResponse<T>( |
| 28 | data: T, |
| 29 | meta: Record<string, any> = {} |
| 30 | ): { |
| 31 | success: true; |
| 32 | data: T; |
| 33 | meta?: Record<string, any>; |
| 34 | } { |
| 35 | return { |
| 36 | success: true, |
| 37 | data, |
| 38 | ...(Object.keys(meta).length > 0 ? { meta } : {}), |
| 39 | }; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Create an error response with the given message and code |
no outgoing calls
no test coverage detected