@tmlmobilidade/types
Version:
377 lines (376 loc) • 19.7 kB
TypeScript
import { z } from 'zod';
export declare const SamSchema: z.ZodObject<{
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
created_by: z.ZodOptional<z.ZodString>;
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
updated_by: z.ZodOptional<z.ZodString>;
} & {
_id: z.ZodNumber;
agency_id: z.ZodString;
analysis: z.ZodDefault<z.ZodArray<z.ZodObject<{
apex_version: z.ZodNullable<z.ZodString>;
device_id: z.ZodNullable<z.ZodString>;
end_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
first_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
first_transaction_id: z.ZodNullable<z.ZodString>;
first_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
last_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
last_transaction_id: z.ZodNullable<z.ZodString>;
last_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
start_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
transactions_expected: z.ZodNumber;
transactions_found: z.ZodNumber;
transactions_missing: z.ZodNumber;
vehicle_id: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}, {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: number | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: number | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}>, "many">>;
latest_apex_version: z.ZodNullable<z.ZodString>;
remarks: z.ZodDefault<z.ZodNullable<z.ZodString>>;
seen_first_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
seen_last_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
system_status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error", "skipped"]>>;
transactions_expected: z.ZodNullable<z.ZodNumber>;
transactions_found: z.ZodNullable<z.ZodNumber>;
transactions_missing: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
_id: number;
created_at: number & {
__brand: "UnixTimestamp";
};
updated_at: number & {
__brand: "UnixTimestamp";
};
agency_id: string;
seen_last_at: import("../_common/unix-timestamp.js").UnixTimestamp | null;
seen_first_at: import("../_common/unix-timestamp.js").UnixTimestamp | null;
analysis: {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}[];
system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
transactions_expected: number | null;
transactions_found: number | null;
transactions_missing: number | null;
latest_apex_version: string | null;
remarks: string | null;
created_by?: string | undefined;
updated_by?: string | undefined;
}, {
_id: number;
created_at: number;
updated_at: number;
agency_id: string;
seen_last_at: number | null;
seen_first_at: number | null;
transactions_expected: number | null;
transactions_found: number | null;
transactions_missing: number | null;
latest_apex_version: string | null;
created_by?: string | undefined;
updated_by?: string | undefined;
analysis?: {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: number | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: number | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}[] | undefined;
system_status?: "waiting" | "processing" | "complete" | "error" | "skipped" | undefined;
remarks?: string | null | undefined;
}>;
export declare const CreateSamSchema: z.ZodObject<Omit<{
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
created_by: z.ZodOptional<z.ZodString>;
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
updated_by: z.ZodOptional<z.ZodString>;
} & {
_id: z.ZodNumber;
agency_id: z.ZodString;
analysis: z.ZodDefault<z.ZodArray<z.ZodObject<{
apex_version: z.ZodNullable<z.ZodString>;
device_id: z.ZodNullable<z.ZodString>;
end_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
first_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
first_transaction_id: z.ZodNullable<z.ZodString>;
first_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
last_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
last_transaction_id: z.ZodNullable<z.ZodString>;
last_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
start_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
transactions_expected: z.ZodNumber;
transactions_found: z.ZodNumber;
transactions_missing: z.ZodNumber;
vehicle_id: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}, {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: number | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: number | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}>, "many">>;
latest_apex_version: z.ZodNullable<z.ZodString>;
remarks: z.ZodDefault<z.ZodNullable<z.ZodString>>;
seen_first_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
seen_last_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
system_status: z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error", "skipped"]>>;
transactions_expected: z.ZodNullable<z.ZodNumber>;
transactions_found: z.ZodNullable<z.ZodNumber>;
transactions_missing: z.ZodNullable<z.ZodNumber>;
}, "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
_id: number;
agency_id: string;
seen_last_at: import("../_common/unix-timestamp.js").UnixTimestamp | null;
seen_first_at: import("../_common/unix-timestamp.js").UnixTimestamp | null;
analysis: {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}[];
system_status: "waiting" | "processing" | "complete" | "error" | "skipped";
transactions_expected: number | null;
transactions_found: number | null;
transactions_missing: number | null;
latest_apex_version: string | null;
remarks: string | null;
created_by?: string | undefined;
updated_by?: string | undefined;
}, {
_id: number;
agency_id: string;
seen_last_at: number | null;
seen_first_at: number | null;
transactions_expected: number | null;
transactions_found: number | null;
transactions_missing: number | null;
latest_apex_version: string | null;
created_by?: string | undefined;
updated_by?: string | undefined;
analysis?: {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: number | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: number | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}[] | undefined;
system_status?: "waiting" | "processing" | "complete" | "error" | "skipped" | undefined;
remarks?: string | null | undefined;
}>;
export declare const UpdateSamSchema: z.ZodObject<{
_id: z.ZodOptional<z.ZodNumber>;
updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
agency_id: z.ZodOptional<z.ZodString>;
seen_last_at: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>>;
seen_first_at: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>>;
analysis: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
apex_version: z.ZodNullable<z.ZodString>;
device_id: z.ZodNullable<z.ZodString>;
end_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
first_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
first_transaction_id: z.ZodNullable<z.ZodString>;
first_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
last_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
last_transaction_id: z.ZodNullable<z.ZodString>;
last_transaction_type: z.ZodNullable<z.ZodEnum<["location", "on_board_refund", "on_board_sale", "validation"]>>;
start_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>;
transactions_expected: z.ZodNumber;
transactions_found: z.ZodNumber;
transactions_missing: z.ZodNumber;
vehicle_id: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}, {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: number | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: number | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}>, "many">>>;
system_status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["waiting", "processing", "complete", "error", "skipped"]>>>;
transactions_expected: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
transactions_found: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
transactions_missing: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
latest_apex_version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
remarks: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
}, "strip", z.ZodTypeAny, {
_id?: number | undefined;
updated_by?: string | undefined;
agency_id?: string | undefined;
seen_last_at?: import("../_common/unix-timestamp.js").UnixTimestamp | null | undefined;
seen_first_at?: import("../_common/unix-timestamp.js").UnixTimestamp | null | undefined;
analysis?: {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: import("../_common/unix-timestamp.js").UnixTimestamp | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}[] | undefined;
system_status?: "waiting" | "processing" | "complete" | "error" | "skipped" | undefined;
transactions_expected?: number | null | undefined;
transactions_found?: number | null | undefined;
transactions_missing?: number | null | undefined;
latest_apex_version?: string | null | undefined;
remarks?: string | null | undefined;
}, {
_id?: number | undefined;
updated_by?: string | undefined;
agency_id?: string | undefined;
seen_last_at?: number | null | undefined;
seen_first_at?: number | null | undefined;
analysis?: {
apex_version: string | null;
device_id: string | null;
vehicle_id: number | null;
end_time: number | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: "validation" | "location" | "on_board_refund" | "on_board_sale" | null;
start_time: number | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
}[] | undefined;
system_status?: "waiting" | "processing" | "complete" | "error" | "skipped" | undefined;
transactions_expected?: number | null | undefined;
transactions_found?: number | null | undefined;
transactions_missing?: number | null | undefined;
latest_apex_version?: string | null | undefined;
remarks?: string | null | undefined;
}>;
/**
* SAMs are the chips that contain the keys used to sign APEX transactions.
* They live in the validator machines and produce an incrementing counter value
* every time a transaction is signed. This counter value is used to ensure that
* the transactions are real, unique and incremental. This allows the system to
* detect if a transaction has been tampered with or if any transactions are missing.
*/
export type Sam = z.infer<typeof SamSchema>;
export type CreateSamDto = z.infer<typeof CreateSamSchema>;
export type UpdateSamDto = z.infer<typeof UpdateSamSchema>;