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.

694 lines (693 loc) • 27.5 kB
import { z } from 'zod'; import { UnixTimestamp } from './_common/unix-timestamp.js'; import { GtfsAgency, GtfsFeedInfo } from './gtfs.js'; export declare const SEVERITY_LEVELS: readonly ["error", "warning", "info"]; export declare const SeverityLevelSchema: z.ZodEnum<["error", "warning", "info"]>; export type SeverityLevel = z.infer<typeof SeverityLevelSchema>; export declare const GTFSValidatorMessageSchema: z.ZodObject<{ field: z.ZodString; file_name: z.ZodString; message: z.ZodString; rows: z.ZodArray<z.ZodNumber, "many">; severity: z.ZodEnum<["error", "warning", "info"]>; validation_id: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }, { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }>; export declare const GTFSValidatorSummarySchema: z.ZodObject<{ messages: z.ZodArray<z.ZodObject<{ field: z.ZodString; file_name: z.ZodString; message: z.ZodString; rows: z.ZodArray<z.ZodNumber, "many">; severity: z.ZodEnum<["error", "warning", "info"]>; validation_id: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }, { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }>, "many">; total_errors: z.ZodNumber; total_warnings: z.ZodNumber; }, "strip", z.ZodTypeAny, { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; }, { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; }>; export type GTFSValidatorSummary = z.infer<typeof GTFSValidatorSummarySchema>; export type GTFSValidatorMessage = z.infer<typeof GTFSValidatorMessageSchema>; export declare const ValidationSchema: 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">>>; } & { feeder_status: z.ZodEnum<["waiting", "processing", "success", "error"]>; file_id: z.ZodString; gtfs_agency: z.ZodObject<{ agency_email: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_fare_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_id: z.ZodString; agency_lang: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_name: z.ZodString; agency_phone: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_timezone: z.ZodString; agency_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; }, "strip", z.ZodTypeAny, { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; }, { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; }>; gtfs_feed_info: z.ZodObject<{ default_lang: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_contact_email: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_contact_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_end_date: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodString, import("./_common/operational-date.js").OperationalDate, string>, "OperationalDate">>>; feed_lang: z.ZodString; feed_publisher_name: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_publisher_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_start_date: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodString, import("./_common/operational-date.js").OperationalDate, string>, "OperationalDate">>>; feed_version: z.ZodOptional<z.ZodNullable<z.ZodString>>; }, "strip", z.ZodTypeAny, { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_version?: string | null | undefined; }, { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: string | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: string | null | undefined; feed_version?: string | null | undefined; }>; summary: z.ZodOptional<z.ZodNullable<z.ZodObject<{ messages: z.ZodArray<z.ZodObject<{ field: z.ZodString; file_name: z.ZodString; message: z.ZodString; rows: z.ZodArray<z.ZodNumber, "many">; severity: z.ZodEnum<["error", "warning", "info"]>; validation_id: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }, { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }>, "many">; total_errors: z.ZodNumber; total_warnings: z.ZodNumber; }, "strip", z.ZodTypeAny, { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; }, { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; }>>>; }, "strict", z.ZodTypeAny, { _id: string; file_id: string; feeder_status: "waiting" | "processing" | "success" | "error"; gtfs_agency: { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; }; gtfs_feed_info: { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_version?: string | null | undefined; }; created_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; updated_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; summary?: { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; } | null | undefined; }, { _id: string; file_id: string; feeder_status: "waiting" | "processing" | "success" | "error"; gtfs_agency: { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; }; gtfs_feed_info: { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: string | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: string | null | undefined; feed_version?: string | null | undefined; }; created_at?: number | null | undefined; updated_at?: number | null | undefined; summary?: { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; } | null | undefined; }>; export declare const CreateValidationSchema: 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">>>; } & { feeder_status: z.ZodEnum<["waiting", "processing", "success", "error"]>; file_id: z.ZodString; gtfs_agency: z.ZodObject<{ agency_email: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_fare_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_id: z.ZodString; agency_lang: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_name: z.ZodString; agency_phone: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_timezone: z.ZodString; agency_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; }, "strip", z.ZodTypeAny, { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; }, { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; }>; gtfs_feed_info: z.ZodObject<{ default_lang: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_contact_email: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_contact_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_end_date: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodString, import("./_common/operational-date.js").OperationalDate, string>, "OperationalDate">>>; feed_lang: z.ZodString; feed_publisher_name: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_publisher_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_start_date: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodString, import("./_common/operational-date.js").OperationalDate, string>, "OperationalDate">>>; feed_version: z.ZodOptional<z.ZodNullable<z.ZodString>>; }, "strip", z.ZodTypeAny, { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_version?: string | null | undefined; }, { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: string | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: string | null | undefined; feed_version?: string | null | undefined; }>; summary: z.ZodOptional<z.ZodNullable<z.ZodObject<{ messages: z.ZodArray<z.ZodObject<{ field: z.ZodString; file_name: z.ZodString; message: z.ZodString; rows: z.ZodArray<z.ZodNumber, "many">; severity: z.ZodEnum<["error", "warning", "info"]>; validation_id: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }, { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }>, "many">; total_errors: z.ZodNumber; total_warnings: z.ZodNumber; }, "strip", z.ZodTypeAny, { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; }, { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; }>>>; }, "_id" | "created_at" | "updated_at">, "strict", z.ZodTypeAny, { file_id: string; feeder_status: "waiting" | "processing" | "success" | "error"; gtfs_agency: { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; }; gtfs_feed_info: { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_version?: string | null | undefined; }; summary?: { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; } | null | undefined; }, { file_id: string; feeder_status: "waiting" | "processing" | "success" | "error"; gtfs_agency: { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; }; gtfs_feed_info: { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: string | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: string | null | undefined; feed_version?: string | null | undefined; }; summary?: { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; } | null | undefined; }>; export declare const UpdateValidationSchema: z.ZodObject<{ file_id: z.ZodOptional<z.ZodString>; feeder_status: z.ZodOptional<z.ZodEnum<["waiting", "processing", "success", "error"]>>; gtfs_agency: z.ZodOptional<z.ZodObject<{ agency_email: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_fare_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_id: z.ZodString; agency_lang: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_name: z.ZodString; agency_phone: z.ZodOptional<z.ZodNullable<z.ZodString>>; agency_timezone: z.ZodString; agency_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; }, "strip", z.ZodTypeAny, { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; }, { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; }>>; gtfs_feed_info: z.ZodOptional<z.ZodObject<{ default_lang: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_contact_email: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_contact_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_end_date: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodString, import("./_common/operational-date.js").OperationalDate, string>, "OperationalDate">>>; feed_lang: z.ZodString; feed_publisher_name: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_publisher_url: z.ZodOptional<z.ZodNullable<z.ZodString>>; feed_start_date: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodString, import("./_common/operational-date.js").OperationalDate, string>, "OperationalDate">>>; feed_version: z.ZodOptional<z.ZodNullable<z.ZodString>>; }, "strip", z.ZodTypeAny, { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_version?: string | null | undefined; }, { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: string | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: string | null | undefined; feed_version?: string | null | undefined; }>>; summary: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{ messages: z.ZodArray<z.ZodObject<{ field: z.ZodString; file_name: z.ZodString; message: z.ZodString; rows: z.ZodArray<z.ZodNumber, "many">; severity: z.ZodEnum<["error", "warning", "info"]>; validation_id: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }, { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }>, "many">; total_errors: z.ZodNumber; total_warnings: z.ZodNumber; }, "strip", z.ZodTypeAny, { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; }, { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; }>>>>; }, "strict", z.ZodTypeAny, { file_id?: string | undefined; feeder_status?: "waiting" | "processing" | "success" | "error" | undefined; gtfs_agency?: { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; } | undefined; gtfs_feed_info?: { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: (string & { __brand: "OperationalDate"; } & z.BRAND<"OperationalDate">) | null | undefined; feed_version?: string | null | undefined; } | undefined; summary?: { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; } | null | undefined; }, { file_id?: string | undefined; feeder_status?: "waiting" | "processing" | "success" | "error" | undefined; gtfs_agency?: { agency_id: string; agency_name: string; agency_timezone: string; agency_email?: string | null | undefined; agency_fare_url?: string | null | undefined; agency_lang?: string | null | undefined; agency_phone?: string | null | undefined; agency_url?: string | null | undefined; } | undefined; gtfs_feed_info?: { feed_lang: string; default_lang?: string | null | undefined; feed_contact_email?: string | null | undefined; feed_contact_url?: string | null | undefined; feed_end_date?: string | null | undefined; feed_publisher_name?: string | null | undefined; feed_publisher_url?: string | null | undefined; feed_start_date?: string | null | undefined; feed_version?: string | null | undefined; } | undefined; summary?: { messages: { message: string; validation_id: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "info"; }[]; total_errors: number; total_warnings: number; } | null | undefined; }>; export interface Validation extends Omit<z.infer<typeof ValidationSchema>, 'created_at' | 'gtfs_agency' | 'gtfs_feed_info' | 'summary' | 'updated_at'> { created_at: UnixTimestamp; gtfs_agency: GtfsAgency; gtfs_feed_info: GtfsFeedInfo; summary?: GTFSValidatorSummary; updated_at: UnixTimestamp; } export interface CreateValidationDto extends Omit<z.infer<typeof CreateValidationSchema>, 'gtfs_agency' | 'gtfs_feed_info' | 'summary'> { gtfs_agency: GtfsAgency; gtfs_feed_info: GtfsFeedInfo; summary?: GTFSValidatorSummary; } export type UpdateValidationDto = Partial<CreateValidationDto>; export declare const ValidationPermissionSchema: z.ZodObject<{ agency_ids: z.ZodArray<z.ZodString, "many">; municipality_ids: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { agency_ids: string[]; municipality_ids: string[]; }, { agency_ids: string[]; municipality_ids: string[]; }>; export type ValidationPermission = z.infer<typeof ValidationPermissionSchema>;