refactor: bare structure for new backend architecture and runtime; no behavior changes yet

This commit is contained in:
Haileyesus
2026-03-12 14:17:12 +03:00
parent b54cdf8168
commit e67738c9fc
40 changed files with 10316 additions and 9 deletions

View File

@@ -0,0 +1,36 @@
import type { ApiErrorShape, ApiMeta, ApiSuccessShape } from '../types/http.js';
export function createApiMeta(requestId?: string, startedAt?: string): ApiMeta {
return {
requestId,
startedAt,
};
}
export function createApiSuccessResponse<TData>(
data: TData,
meta?: ApiMeta
): ApiSuccessShape<TData> {
return {
success: true,
data,
meta,
};
}
export function createApiErrorResponse(
code: string,
message: string,
meta?: ApiMeta,
details?: unknown
): ApiErrorShape {
return {
success: false,
error: {
code,
message,
details,
},
meta,
};
}