UNPKG

@tmlmobilidade/types

Version:

This package provides shared Zod validation schemas and their corresponding TypeScript types for use across projects. All types are automatically inferred from the schemas to ensure full type safety and reduce maintenance overhead.

75 lines (74 loc) 3.08 kB
import { type UnixTimestamp } from '../_common/unix-timestamp.js'; import { z } from 'zod'; export declare const SessionSchema: z.ZodObject<{ _id: z.ZodString; created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>; updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>; } & { expires_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>; token: z.ZodString; user_id: z.ZodString; }, "strict", z.ZodTypeAny, { _id: string; user_id: string; token: string; created_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; updated_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; expires_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; }, { _id: string; user_id: string; token: string; created_at?: number | null | undefined; updated_at?: number | null | undefined; expires_at?: number | null | undefined; }>; export declare const CreateSessionSchema: z.ZodObject<Omit<{ _id: z.ZodString; created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>; updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>; } & { expires_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>; token: z.ZodString; user_id: z.ZodString; }, "_id" | "created_at" | "updated_at">, "strict", z.ZodTypeAny, { user_id: string; token: string; expires_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; }, { user_id: string; token: string; expires_at?: number | null | undefined; }>; export declare const UpdateSessionSchema: z.ZodObject<{ user_id: z.ZodOptional<z.ZodString>; expires_at: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>>; token: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { user_id?: string | undefined; expires_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; token?: string | undefined; }, { user_id?: string | undefined; expires_at?: number | null | undefined; token?: string | undefined; }>; export interface Session extends Omit<z.infer<typeof SessionSchema>, 'created_at' | 'expires_at' | 'updated_at'> { created_at: UnixTimestamp; expires_at?: UnixTimestamp; updated_at: UnixTimestamp; } export interface CreateSessionDto extends Omit<z.infer<typeof CreateSessionSchema>, 'expires_at'> { expires_at?: UnixTimestamp; } export type UpdateSessionDto = Partial<CreateSessionDto>;