Single source of truth for the Journal REST API: - API_VERSION semver constant (1.0.0) - Endpoint path constants (routes, activities, auth, uploads, push) - Zod schemas for all request/response shapes: - Routes: list, detail, create, update, compute - Activities: list, detail, create - Auth: token exchange, refresh, device management - Discovery: instance info + API version - Uploads: presigned URL flow - Errors: structured error response with field-level details - Cursor-based pagination schemas - TypeScript types inferred from Zod (z.infer) Used by Journal server (validation) and mobile client (type safety). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
16 lines
508 B
TypeScript
16 lines
508 B
TypeScript
import { z } from "zod";
|
|
|
|
/** Cursor-based pagination query params */
|
|
export const PaginationQuerySchema = z.object({
|
|
cursor: z.string().optional(),
|
|
limit: z.coerce.number().min(1).max(100).default(20),
|
|
});
|
|
|
|
export type PaginationQuery = z.infer<typeof PaginationQuerySchema>;
|
|
|
|
/** Paginated response wrapper — extend with your items */
|
|
export const PaginatedResponseSchema = z.object({
|
|
nextCursor: z.string().nullable(),
|
|
});
|
|
|
|
export type PaginatedResponse = z.infer<typeof PaginatedResponseSchema>;
|