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.

699 lines (698 loc) • 28.3 kB
import { type UnixTimestamp } from '../_common/unix-timestamp.js'; import { type GtfsAgency, type GtfsFeedInfo } from '../gtfs.js'; import { z } from 'zod'; export declare const SEVERITY_LEVELS: readonly ["error", "warning", "ignore", "forbidden"]; export declare const SeverityLevelSchema: z.ZodEnum<["error", "warning", "ignore", "forbidden"]>; 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", "ignore", "forbidden"]>; validation_id: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }, { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }>; 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", "ignore", "forbidden"]>; validation_id: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }, { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }>, "many">; total_errors: z.ZodNumber; total_warnings: z.ZodNumber; }, "strip", z.ZodTypeAny, { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; }, { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; }>; export type GTFSValidatorSummary = z.infer<typeof GTFSValidatorSummarySchema>; export type GTFSValidatorMessage = z.infer<typeof GTFSValidatorMessageSchema>; export declare const GtfsValidationSchema: 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", "complete", "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; }>; notification_sent: z.ZodDefault<z.ZodBoolean>; 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", "ignore", "forbidden"]>; validation_id: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }, { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }>, "many">; total_errors: z.ZodNumber; total_warnings: z.ZodNumber; }, "strip", z.ZodTypeAny, { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; }, { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; }>>>; }, "strict", z.ZodTypeAny, { _id: string; file_id: string; feeder_status: "waiting" | "processing" | "complete" | "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; }; notification_sent: boolean; created_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; updated_at?: (number & { __brand: "UnixTimestamp"; } & z.BRAND<"UnixTimestamp">) | null | undefined; summary?: { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; } | null | undefined; }, { _id: string; file_id: string; feeder_status: "waiting" | "processing" | "complete" | "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; notification_sent?: boolean | undefined; summary?: { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; } | null | undefined; }>; export declare const CreateGtfsValidationSchema: 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", "complete", "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; }>; notification_sent: z.ZodDefault<z.ZodBoolean>; 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", "ignore", "forbidden"]>; validation_id: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }, { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }>, "many">; total_errors: z.ZodNumber; total_warnings: z.ZodNumber; }, "strip", z.ZodTypeAny, { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; }, { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; }>>>; }, "_id" | "created_at" | "updated_at">, "strict", z.ZodTypeAny, { file_id: string; feeder_status: "waiting" | "processing" | "complete" | "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; }; notification_sent: boolean; summary?: { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; } | null | undefined; }, { file_id: string; feeder_status: "waiting" | "processing" | "complete" | "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; }; notification_sent?: boolean | undefined; summary?: { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; } | null | undefined; }>; export declare const UpdateGtfsValidationSchema: z.ZodObject<{ file_id: z.ZodOptional<z.ZodString>; feeder_status: z.ZodOptional<z.ZodEnum<["waiting", "processing", "complete", "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; }>>; notification_sent: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>; 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", "ignore", "forbidden"]>; validation_id: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }, { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }>, "many">; total_errors: z.ZodNumber; total_warnings: z.ZodNumber; }, "strip", z.ZodTypeAny, { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; }, { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; }>>>>; }, "strict", z.ZodTypeAny, { file_id?: string | undefined; feeder_status?: "waiting" | "processing" | "complete" | "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; notification_sent?: boolean | undefined; summary?: { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; } | null | undefined; }, { file_id?: string | undefined; feeder_status?: "waiting" | "processing" | "complete" | "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; notification_sent?: boolean | undefined; summary?: { messages: { message: string; field: string; file_name: string; rows: number[]; severity: "error" | "warning" | "ignore" | "forbidden"; validation_id: string; }[]; total_errors: number; total_warnings: number; } | null | undefined; }>; export interface GtfsValidation extends Omit<z.infer<typeof GtfsValidationSchema>, '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 CreateGtfsValidationDto extends Omit<z.infer<typeof CreateGtfsValidationSchema>, 'gtfs_agency' | 'gtfs_feed_info'> { gtfs_agency: GtfsAgency; gtfs_feed_info: GtfsFeedInfo; } export type UpdateGtfsValidationDto = Partial<CreateGtfsValidationDto>; export declare const GtfsValidationPermissionSchema: z.ZodObject<{ agency_ids: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { agency_ids: string[]; }, { agency_ids: string[]; }>; export type GtfsValidationPermission = z.infer<typeof GtfsValidationPermissionSchema>;