@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.
318 lines (317 loc) • 14.3 kB
TypeScript
import { type UnixTimestamp } from './_common/unix-timestamp.js';
import { GtfsAgency, GtfsFeedInfo } from './gtfs.js';
import { z } from 'zod';
export declare const FeederStatusSchema: z.ZodEnum<["waiting", "processing", "success", "error"]>;
export declare const PlanSchema: 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"]>;
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;
}>;
is_approved: z.ZodDefault<z.ZodBoolean>;
is_locked: z.ZodDefault<z.ZodBoolean>;
operation_file_id: z.ZodString;
validation_id: z.ZodString;
}, "strict", z.ZodTypeAny, {
_id: string;
is_locked: boolean;
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;
};
is_approved: boolean;
operation_file_id: string;
validation_id: string;
created_at?: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null | undefined;
updated_at?: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null | undefined;
}, {
_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;
};
operation_file_id: string;
validation_id: string;
created_at?: number | null | undefined;
updated_at?: number | null | undefined;
is_locked?: boolean | undefined;
is_approved?: boolean | undefined;
}>;
export declare const CreatePlanSchema: z.ZodObject<{
validation_id: z.ZodString;
}, "strip", z.ZodTypeAny, {
validation_id: string;
}, {
validation_id: string;
}>;
export declare const UpdatePlanSchema: z.ZodObject<{
_id: z.ZodOptional<z.ZodString>;
created_at: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>>;
updated_at: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>>;
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;
}>>;
is_approved: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
is_locked: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
operation_file_id: z.ZodOptional<z.ZodString>;
validation_id: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
_id?: string | undefined;
created_at?: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null | undefined;
updated_at?: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null | undefined;
is_locked?: boolean | 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;
is_approved?: boolean | undefined;
operation_file_id?: string | undefined;
validation_id?: string | undefined;
}, {
_id?: string | undefined;
created_at?: number | null | undefined;
updated_at?: number | null | undefined;
is_locked?: boolean | 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;
is_approved?: boolean | undefined;
operation_file_id?: string | undefined;
validation_id?: string | undefined;
}>;
export type FeederStatus = z.infer<typeof FeederStatusSchema>;
export interface Plan extends Omit<z.infer<typeof PlanSchema>, 'created_at' | 'gtfs_agency' | 'gtfs_feed_info' | 'updated_at'> {
created_at: UnixTimestamp;
gtfs_agency: GtfsAgency;
gtfs_feed_info: GtfsFeedInfo;
updated_at: UnixTimestamp;
}
export type CreatePlanDto = z.infer<typeof CreatePlanSchema>;
export type UpdatePlanDto = Partial<Plan>;
export declare const PlanPermissionSchema: z.ZodObject<{
agency_ids: z.ZodArray<z.ZodString, "many">;
end_date: z.ZodString;
start_date: z.ZodString;
}, "strip", z.ZodTypeAny, {
agency_ids: string[];
end_date: string;
start_date: string;
}, {
agency_ids: string[];
end_date: string;
start_date: string;
}>;
export type PlanPermission = z.infer<typeof PlanPermissionSchema>;