@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.
545 lines (544 loc) • 23.7 kB
TypeScript
import { type UnixTimestamp } from '../_common/unix-timestamp.js';
import { GtfsAgency, GtfsFeedInfo } from '../gtfs.js';
import { PlanController } from './plan-controller.js';
import { z } from 'zod';
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">>>;
} & {
controller: z.ZodObject<{
last_hash: z.ZodNullable<z.ZodString>;
status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
timestamp: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
}, "strict", z.ZodTypeAny, {
status: "waiting" | "processing" | "complete" | "error";
last_hash: string | null;
timestamp: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null;
}, {
last_hash: string | null;
timestamp: number | null;
status?: "waiting" | "processing" | "complete" | "error" | undefined;
}>;
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;
}>;
hash: z.ZodString;
is_locked: z.ZodDefault<z.ZodBoolean>;
operation_file_id: z.ZodString;
pcgi_legacy: z.ZodObject<{
operation_plan_id: z.ZodNullable<z.ZodString>;
}, "strict", z.ZodTypeAny, {
operation_plan_id: string | null;
}, {
operation_plan_id: string | null;
}>;
status_merger: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
}, "strict", z.ZodTypeAny, {
_id: string;
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;
};
controller: {
status: "waiting" | "processing" | "complete" | "error";
last_hash: string | null;
timestamp: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null;
};
hash: string;
is_locked: boolean;
operation_file_id: string;
pcgi_legacy: {
operation_plan_id: string | null;
};
status_merger: "waiting" | "processing" | "complete" | "error";
created_at?: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null | undefined;
updated_at?: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null | undefined;
}, {
_id: string;
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;
};
controller: {
last_hash: string | null;
timestamp: number | null;
status?: "waiting" | "processing" | "complete" | "error" | undefined;
};
hash: string;
operation_file_id: string;
pcgi_legacy: {
operation_plan_id: string | null;
};
created_at?: number | null | undefined;
updated_at?: number | null | undefined;
is_locked?: boolean | undefined;
status_merger?: "waiting" | "processing" | "complete" | "error" | undefined;
}>;
export declare const CreatePlanSchema: 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">>>;
} & {
controller: z.ZodObject<{
last_hash: z.ZodNullable<z.ZodString>;
status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
timestamp: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
}, "strict", z.ZodTypeAny, {
status: "waiting" | "processing" | "complete" | "error";
last_hash: string | null;
timestamp: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null;
}, {
last_hash: string | null;
timestamp: number | null;
status?: "waiting" | "processing" | "complete" | "error" | undefined;
}>;
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;
}>;
hash: z.ZodString;
is_locked: z.ZodDefault<z.ZodBoolean>;
operation_file_id: z.ZodString;
pcgi_legacy: z.ZodObject<{
operation_plan_id: z.ZodNullable<z.ZodString>;
}, "strict", z.ZodTypeAny, {
operation_plan_id: string | null;
}, {
operation_plan_id: string | null;
}>;
status_merger: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
}, "_id" | "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
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;
};
controller: {
status: "waiting" | "processing" | "complete" | "error";
last_hash: string | null;
timestamp: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null;
};
hash: string;
is_locked: boolean;
operation_file_id: string;
pcgi_legacy: {
operation_plan_id: string | null;
};
status_merger: "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;
};
controller: {
last_hash: string | null;
timestamp: number | null;
status?: "waiting" | "processing" | "complete" | "error" | undefined;
};
hash: string;
operation_file_id: string;
pcgi_legacy: {
operation_plan_id: string | null;
};
is_locked?: boolean | undefined;
status_merger?: "waiting" | "processing" | "complete" | "error" | undefined;
}>;
export declare const UpdatePlanSchema: z.ZodObject<{
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;
}>>;
controller: z.ZodOptional<z.ZodObject<{
last_hash: z.ZodNullable<z.ZodString>;
status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>;
timestamp: z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>;
}, "strict", z.ZodTypeAny, {
status: "waiting" | "processing" | "complete" | "error";
last_hash: string | null;
timestamp: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null;
}, {
last_hash: string | null;
timestamp: number | null;
status?: "waiting" | "processing" | "complete" | "error" | undefined;
}>>;
hash: z.ZodOptional<z.ZodString>;
is_locked: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
operation_file_id: z.ZodOptional<z.ZodString>;
pcgi_legacy: z.ZodOptional<z.ZodObject<{
operation_plan_id: z.ZodNullable<z.ZodString>;
}, "strict", z.ZodTypeAny, {
operation_plan_id: string | null;
}, {
operation_plan_id: string | null;
}>>;
status_merger: z.ZodOptional<z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error"]>>>;
}, "strict", z.ZodTypeAny, {
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;
controller?: {
status: "waiting" | "processing" | "complete" | "error";
last_hash: string | null;
timestamp: (number & {
__brand: "UnixTimestamp";
} & z.BRAND<"UnixTimestamp">) | null;
} | undefined;
hash?: string | undefined;
is_locked?: boolean | undefined;
operation_file_id?: string | undefined;
pcgi_legacy?: {
operation_plan_id: string | null;
} | undefined;
status_merger?: "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;
controller?: {
last_hash: string | null;
timestamp: number | null;
status?: "waiting" | "processing" | "complete" | "error" | undefined;
} | undefined;
hash?: string | undefined;
is_locked?: boolean | undefined;
operation_file_id?: string | undefined;
pcgi_legacy?: {
operation_plan_id: string | null;
} | undefined;
status_merger?: "waiting" | "processing" | "complete" | "error" | undefined;
}>;
export interface Plan extends Omit<z.infer<typeof PlanSchema>, 'controller' | 'created_at' | 'gtfs_agency' | 'gtfs_feed_info' | 'updated_at'> {
controller: PlanController;
created_at: UnixTimestamp;
gtfs_agency: GtfsAgency;
gtfs_feed_info: GtfsFeedInfo;
updated_at: UnixTimestamp;
}
export interface CreatePlanDto extends Omit<z.infer<typeof CreatePlanSchema>, 'controller' | 'gtfs_agency' | 'gtfs_feed_info'> {
controller: PlanController;
gtfs_agency: GtfsAgency;
gtfs_feed_info: GtfsFeedInfo;
}
export type UpdatePlanDto = Partial<CreatePlanDto>;
export interface HashablePlanMetadata {
_id: Plan['_id'];
gtfs_agency: Plan['gtfs_agency'];
gtfs_feed_info: Plan['gtfs_feed_info'];
operation_file_id: Plan['operation_file_id'];
}
export declare const PlanPermissionSchema: z.ZodObject<{
agency_ids: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
agency_ids: string[];
}, {
agency_ids: string[];
}>;
export type PlanPermission = z.infer<typeof PlanPermissionSchema>;