MCPcopy Create free account
hub / github.com/bytebase/dbhub / formatSuccessResponse

Function formatSuccessResponse

src/utils/response-formatter.ts:27–40  ·  view source on GitHub ↗
(
  data: T,
  meta: Record<string, any> = {}
)

Source from the content-addressed store, hash-verified

25 * Create a success response with the given data
26 */
27export 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

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected