// This file was generated by liblab | https://liblab.com/ import { z } from 'zod'; import { success, successRequest, successResponse } from './success'; import { responseError, responseErrorRequest, responseErrorResponse } from './response-error'; /** * The shape of the model inside the application code - what the users use */ export const response = z.object({ success: success.optional(), error: responseError.optional(), }); /** * * @typedef {Response} response * @property {Success} * @property {ResponseError} */ export type Response = z.infer; /** * The shape of the model mapping from the api schema into the application shape. * Is equal to application shape if all property names match the api schema */ export const responseResponse = z .object({ success: successResponse.optional(), error: responseErrorResponse.optional(), }) .transform((data) => ({ success: data['success'], error: data['error'], })); /** * The shape of the model mapping from the application shape into the api schema. * Is equal to application shape if all property names match the api schema */ export const responseRequest = z .object({ success: successRequest.nullish(), error: responseErrorRequest.nullish() }) .transform((data) => ({ success: data['success'], error: data['error'], }));