@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
838 lines • 37.4 kB
TypeScript
import { z } from 'zod';
/**
* Schema factory utilities for creating consistent, reusable schema patterns
* across all microservices. These factories reduce duplication and ensure
* standardization of common API patterns.
*/
/**
* Create a standardized list parameters schema with pagination, search, and caching
*
* @param extensions Additional service-specific parameters to merge
* @returns Combined schema with standard list parameters plus service extensions
*/
export declare const createListParamsSchema: <T extends z.ZodRawShape>(extensions?: T) => z.ZodObject<{
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
orderBy: z.ZodOptional<z.ZodString>;
} & {
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
} & {
q: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
limit: number;
offset: number;
edgeCache?: 3 | 2 | 4 | 1 | 5 | 8 | undefined;
q?: string | undefined;
orderBy?: string | undefined;
}, {
edgeCache?: 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8" | undefined;
limit?: number | undefined;
offset?: number | undefined;
q?: string | undefined;
orderBy?: string | undefined;
}> | z.ZodObject<z.objectUtil.extendShape<{
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
orderBy: z.ZodOptional<z.ZodString>;
} & {
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
} & {
q: z.ZodOptional<z.ZodString>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
orderBy: z.ZodOptional<z.ZodString>;
} & {
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
} & {
q: z.ZodOptional<z.ZodString>;
}, T>>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
orderBy: z.ZodOptional<z.ZodString>;
} & {
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
} & {
q: z.ZodOptional<z.ZodString>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
orderBy: z.ZodOptional<z.ZodString>;
} & {
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
} & {
q: z.ZodOptional<z.ZodString>;
}, T>> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<z.objectUtil.extendShape<{
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
orderBy: z.ZodOptional<z.ZodString>;
} & {
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
} & {
q: z.ZodOptional<z.ZodString>;
}, T>>[k_1]; } : never>;
/**
* Create a standardized get parameters schema with caching support
*
* @param extensions Additional service-specific parameters to merge
* @returns Combined schema with caching parameters plus service extensions
*/
export declare const createGetParamsSchema: <T extends z.ZodRawShape>(extensions?: T) => z.ZodObject<{
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
}, "strip", z.ZodTypeAny, {
edgeCache?: 3 | 2 | 4 | 1 | 5 | 8 | undefined;
}, {
edgeCache?: 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8" | undefined;
}> | z.ZodObject<z.objectUtil.extendShape<{
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
}, T>>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
}, T>> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<z.objectUtil.extendShape<{
edgeCache: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<8>, z.ZodLiteral<"1">, z.ZodLiteral<"2">, z.ZodLiteral<"3">, z.ZodLiteral<"4">, z.ZodLiteral<"5">, z.ZodLiteral<"8">]>, 3 | 2 | 4 | 1 | 5 | 8, 3 | 2 | 4 | 1 | "1" | 5 | 8 | "2" | "3" | "4" | "5" | "8">>;
}, T>>[k_1]; } : never>;
/**
* Create a standardized list response schema
*
* @param itemSchema Schema for individual items in the list
* @returns Response schema wrapping an array of items with pagination metadata
*/
export declare const createListResponseSchema: <T extends z.ZodTypeAny>(itemSchema: T) => z.ZodEffects<z.ZodObject<{
count: z.ZodNumber;
data: z.ZodArray<T, "many">;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
params: Record<string, unknown> | unknown[];
data: T["_output"][];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}, {
params: Record<string, unknown> | unknown[];
data: T["_input"][];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>, {
params: Record<string, unknown> | unknown[];
data: T["_output"][];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}, {
params: Record<string, unknown> | unknown[];
data: T["_input"][];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
/**
* Create a standardized single item response schema
*
* @param itemSchema Schema for the individual item
* @returns Response schema wrapping a single item
*/
export declare const createItemResponseSchema: <T extends z.ZodTypeAny>(itemSchema: T) => z.ZodEffects<z.ZodObject<{
count: z.ZodNumber;
data: T;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
count: z.ZodNumber;
data: T;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
count: z.ZodNumber;
data: T;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>, any>[k]; } : never, z.baseObjectInputType<{
count: z.ZodNumber;
data: T;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
count: z.ZodNumber;
data: T;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>[k_1]; } : never>, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
count: z.ZodNumber;
data: T;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>, any> extends infer T_3 ? { [k in keyof T_3]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
count: z.ZodNumber;
data: T;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>, any>[k]; } : never, z.baseObjectInputType<{
count: z.ZodNumber;
data: T;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}> extends infer T_4 ? { [k_1 in keyof T_4]: z.baseObjectInputType<{
count: z.ZodNumber;
data: T;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>[k_1]; } : never>;
/**
* Create a standardized document response schema for enhanced documentation endpoints
* Common pattern for endpoints like /content/{id}/doc, /users/{id}/doc
*
* @param contentFields Additional fields beyond the standard document structure
* @returns Schema for document responses with id, title, content, and optional extensions
*/
export declare const createDocumentResponseSchema: <T extends z.ZodRawShape = Record<string, never>>(contentFields?: T) => z.ZodEffects<z.ZodObject<{
count: z.ZodNumber;
data: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
content: string;
metadata?: unknown;
}, {
id: string;
title: string;
content: string;
metadata?: unknown;
}> | z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>[k_1]; } : never>;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
count: z.ZodNumber;
data: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
content: string;
metadata?: unknown;
}, {
id: string;
title: string;
content: string;
metadata?: unknown;
}> | z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any> extends infer T_6 ? { [k in keyof T_6]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>> extends infer T_7 ? { [k_1 in keyof T_7]: z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>[k_1]; } : never>;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>, any> extends infer T_3 ? { [k_2 in keyof T_3]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
count: z.ZodNumber;
data: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
content: string;
metadata?: unknown;
}, {
id: string;
title: string;
content: string;
metadata?: unknown;
}> | z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any> extends infer T_4 ? { [k in keyof T_4]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>> extends infer T_5 ? { [k_1 in keyof T_5]: z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>[k_1]; } : never>;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>, any>[k_2]; } : never, z.baseObjectInputType<{
count: z.ZodNumber;
data: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
content: string;
metadata?: unknown;
}, {
id: string;
title: string;
content: string;
metadata?: unknown;
}> | z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any> extends infer T_11 ? { [k in keyof T_11]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>> extends infer T_12 ? { [k_1 in keyof T_12]: z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>[k_1]; } : never>;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}> extends infer T_8 ? { [k_3 in keyof T_8]: z.baseObjectInputType<{
count: z.ZodNumber;
data: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
content: string;
metadata?: unknown;
}, {
id: string;
title: string;
content: string;
metadata?: unknown;
}> | z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any> extends infer T_9 ? { [k in keyof T_9]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>> extends infer T_10 ? { [k_1 in keyof T_10]: z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>[k_1]; } : never>;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>[k_3]; } : never>, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
count: z.ZodNumber;
data: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
content: string;
metadata?: unknown;
}, {
id: string;
title: string;
content: string;
metadata?: unknown;
}> | z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any> extends infer T_16 ? { [k in keyof T_16]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>> extends infer T_17 ? { [k_1 in keyof T_17]: z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>[k_1]; } : never>;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>, any> extends infer T_13 ? { [k_2 in keyof T_13]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
count: z.ZodNumber;
data: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
content: string;
metadata?: unknown;
}, {
id: string;
title: string;
content: string;
metadata?: unknown;
}> | z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any> extends infer T_14 ? { [k in keyof T_14]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>> extends infer T_15 ? { [k_1 in keyof T_15]: z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>[k_1]; } : never>;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>, any>[k_2]; } : never, z.baseObjectInputType<{
count: z.ZodNumber;
data: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
content: string;
metadata?: unknown;
}, {
id: string;
title: string;
content: string;
metadata?: unknown;
}> | z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any> extends infer T_21 ? { [k in keyof T_21]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>> extends infer T_22 ? { [k_1 in keyof T_22]: z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>[k_1]; } : never>;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}> extends infer T_18 ? { [k_3 in keyof T_18]: z.baseObjectInputType<{
count: z.ZodNumber;
data: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
content: string;
metadata?: unknown;
}, {
id: string;
title: string;
content: string;
metadata?: unknown;
}> | z.ZodObject<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any> extends infer T_19 ? { [k in keyof T_19]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>> extends infer T_20 ? { [k_1 in keyof T_20]: z.baseObjectInputType<z.objectUtil.extendShape<{
id: z.ZodString;
title: z.ZodString;
content: z.ZodString;
metadata: z.ZodOptional<z.ZodUnknown>;
}, T>>[k_1]; } : never>;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}>[k_3]; } : never>;
/**
* Create CRUD request schemas for a resource
*
* @param baseSchema The base schema for the resource (must be a ZodObject)
* @returns Object containing create and update request schemas
*/
export declare const createCrudRequestSchemas: <T extends z.ZodObject<z.ZodRawShape>>(baseSchema: T) => {
readonly create: T;
readonly update: z.ZodObject<{
[x: string]: z.ZodOptional<z.ZodTypeAny>;
}, z.UnknownKeysParam, z.ZodTypeAny, {
[x: string]: any;
}, {
[x: string]: any;
}>;
};
/**
* Create status-based schemas for resources with consistent status codes
* Common pattern across services for status management
*
* @param statusValues Array of valid status code values
* @returns Schema for status codes with proper constraints
*/
export declare const createStatusSchema: (statusValues: number[]) => z.ZodLiteral<number> | z.ZodUnion<[z.ZodLiteral<number>, z.ZodLiteral<number>, ...z.ZodLiteral<number>[]]>;
/**
* Create timestamp field schemas for resources with creation/modification tracking
* Handles both camelCase and snake_case conventions
*
* @param useSnakeCase Whether to use snake_case (true) or camelCase (false) field names
* @returns Schema object with timestamp fields
*/
export declare const createTimestampSchema: (useSnakeCase?: boolean) => z.ZodObject<{
date_created: z.ZodOptional<z.ZodString>;
date_last_modified: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
date_created?: string | undefined;
date_last_modified?: string | undefined;
}, {
date_created?: string | undefined;
date_last_modified?: string | undefined;
}> | z.ZodObject<{
dateCreated: z.ZodOptional<z.ZodString>;
dateLastModified: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
dateCreated?: string | undefined;
dateLastModified?: string | undefined;
}, {
dateCreated?: string | undefined;
dateLastModified?: string | undefined;
}>;
/**
* Create a schema for CSV list parameters
* Common pattern for parameters like categoryIdList, tagsList, etc.
*
* @param fieldName The name of the CSV field
* @param description Optional description for the field
* @returns Schema for CSV string parameters
*/
export declare const createCsvListSchema: (fieldName: string, description?: string) => z.ZodObject<{
[x: string]: z.ZodString;
}, "strip", z.ZodTypeAny, {
[x: string]: string;
}, {
[x: string]: string;
}>;
/**
* Create ID field schemas with proper type constraints
* Enforces the naming convention: *Uid = number, *Id = string
*
* @param fieldName The field name (should end with 'Uid' or 'Id')
* @returns Appropriate schema based on naming convention
*/
export declare const createIdSchema: (fieldName: string) => z.ZodString | z.ZodNumber;
/**
* Create a bulk response schema for operations that return multiple items
*
* @param itemSchema Schema for individual items
* @param operationType Type of operation (create, update, delete)
* @returns Response schema for bulk operations
*/
export declare const createBulkResponseSchema: <T extends z.ZodTypeAny>(itemSchema: T, operationType: "create" | "update" | "delete") => z.ZodEffects<z.ZodObject<{
count: z.ZodNumber;
data: z.ZodObject<{
deletedCount: z.ZodNumber;
deletedIds: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
}, "strip", z.ZodTypeAny, {
deletedCount: number;
deletedIds: (string | number)[];
}, {
deletedCount: number;
deletedIds: (string | number)[];
}> | z.ZodArray<T, "many">;
message: z.ZodString;
options: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
params: z.ZodUnion<[z.ZodArray<z.ZodUnknown, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
status: z.ZodNumber;
total: z.ZodNumber;
totalResults: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
params: Record<string, unknown> | unknown[];
data: {
deletedCount: number;
deletedIds: (string | number)[];
} | T["_output"][];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}, {
params: Record<string, unknown> | unknown[];
data: {
deletedCount: number;
deletedIds: (string | number)[];
} | T["_input"][];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>, {
params: Record<string, unknown> | unknown[];
data: {
deletedCount: number;
deletedIds: (string | number)[];
} | T["_output"][];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}, {
params: Record<string, unknown> | unknown[];
data: {
deletedCount: number;
deletedIds: (string | number)[];
} | T["_input"][];
options: Record<string, unknown> | unknown[];
status: number;
message: string;
count: number;
total: number;
totalResults: number;
}>;
export type ListParamsSchema<T extends z.ZodRawShape = Record<string, never>> = ReturnType<typeof createListParamsSchema<T>>;
export type GetParamsSchema<T extends z.ZodRawShape = Record<string, never>> = ReturnType<typeof createGetParamsSchema<T>>;
export type ListResponseSchema<T extends z.ZodTypeAny> = ReturnType<typeof createListResponseSchema<T>>;
export type ItemResponseSchema<T extends z.ZodTypeAny> = ReturnType<typeof createItemResponseSchema<T>>;
export type DocumentResponseSchema<T extends z.ZodRawShape = Record<string, never>> = ReturnType<typeof createDocumentResponseSchema<T>>;
//# sourceMappingURL=schema-factories.d.ts.map