@tmlmobilidade/types
Version:
564 lines (563 loc) • 24.2 kB
TypeScript
import { z } from 'zod';
export declare const SamSchema: z.ZodObject<{
created_at: z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>;
updated_at: z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>;
} & {
_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("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>;
first_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
first_transaction_id: z.ZodNullable<z.ZodString>;
first_transaction_type: z.ZodNullable<z.ZodString>;
last_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
last_transaction_id: z.ZodNullable<z.ZodString>;
last_transaction_type: z.ZodNullable<z.ZodString>;
start_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>;
transactions_expected: z.ZodNumber;
transactions_found: z.ZodNumber;
transactions_missing: z.ZodNumber;
vehicle_id: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
end_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
start_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}, {
end_time: number | null;
start_time: number | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}>, "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("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>;
seen_last_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>;
system_status: z.ZodDefault<z.ZodEnum<["waiting", "incomplete", "complete", "error"]>>;
timeline_summary: z.ZodNullable<z.ZodOptional<z.ZodDefault<z.ZodObject<{
months: z.ZodDefault<z.ZodArray<z.ZodObject<{
failed_count: z.ZodDefault<z.ZodNumber>;
month: z.ZodString;
successful_count: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
month: string;
failed_count: number;
successful_count: number;
}, {
month: string;
failed_count?: number | undefined;
successful_count?: number | undefined;
}>, "many">>;
undated: z.ZodNullable<z.ZodOptional<z.ZodObject<{
failed_count: z.ZodDefault<z.ZodNumber>;
successful_count: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
failed_count: number;
successful_count: number;
}, {
failed_count?: number | undefined;
successful_count?: number | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
months: {
month: string;
failed_count: number;
successful_count: number;
}[];
undated?: {
failed_count: number;
successful_count: number;
} | null | undefined;
}, {
months?: {
month: string;
failed_count?: number | undefined;
successful_count?: number | undefined;
}[] | undefined;
undated?: {
failed_count?: number | undefined;
successful_count?: number | undefined;
} | null | undefined;
}>>>>;
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("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
seen_first_at: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
transactions_expected: number | null;
transactions_found: number | null;
transactions_missing: number | null;
analysis: {
end_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
start_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}[];
system_status: "error" | "waiting" | "complete" | "incomplete";
latest_apex_version: string | null;
remarks: string | null;
timeline_summary?: {
months: {
month: string;
failed_count: number;
successful_count: number;
}[];
undated?: {
failed_count: number;
successful_count: number;
} | null | undefined;
} | null | 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;
analysis?: {
end_time: number | null;
start_time: number | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}[] | undefined;
system_status?: "error" | "waiting" | "complete" | "incomplete" | undefined;
remarks?: string | null | undefined;
timeline_summary?: {
months?: {
month: string;
failed_count?: number | undefined;
successful_count?: number | undefined;
}[] | undefined;
undated?: {
failed_count?: number | undefined;
successful_count?: number | undefined;
} | null | undefined;
} | null | undefined;
}>;
export declare const CreateSamSchema: z.ZodObject<Omit<{
created_at: z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>;
updated_at: z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>;
} & {
_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("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>;
first_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
first_transaction_id: z.ZodNullable<z.ZodString>;
first_transaction_type: z.ZodNullable<z.ZodString>;
last_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
last_transaction_id: z.ZodNullable<z.ZodString>;
last_transaction_type: z.ZodNullable<z.ZodString>;
start_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>;
transactions_expected: z.ZodNumber;
transactions_found: z.ZodNumber;
transactions_missing: z.ZodNumber;
vehicle_id: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
end_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
start_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}, {
end_time: number | null;
start_time: number | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}>, "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("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>;
seen_last_at: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>;
system_status: z.ZodDefault<z.ZodEnum<["waiting", "incomplete", "complete", "error"]>>;
timeline_summary: z.ZodNullable<z.ZodOptional<z.ZodDefault<z.ZodObject<{
months: z.ZodDefault<z.ZodArray<z.ZodObject<{
failed_count: z.ZodDefault<z.ZodNumber>;
month: z.ZodString;
successful_count: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
month: string;
failed_count: number;
successful_count: number;
}, {
month: string;
failed_count?: number | undefined;
successful_count?: number | undefined;
}>, "many">>;
undated: z.ZodNullable<z.ZodOptional<z.ZodObject<{
failed_count: z.ZodDefault<z.ZodNumber>;
successful_count: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
failed_count: number;
successful_count: number;
}, {
failed_count?: number | undefined;
successful_count?: number | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
months: {
month: string;
failed_count: number;
successful_count: number;
}[];
undated?: {
failed_count: number;
successful_count: number;
} | null | undefined;
}, {
months?: {
month: string;
failed_count?: number | undefined;
successful_count?: number | undefined;
}[] | undefined;
undated?: {
failed_count?: number | undefined;
successful_count?: number | undefined;
} | null | undefined;
}>>>>;
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("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
seen_first_at: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
transactions_expected: number | null;
transactions_found: number | null;
transactions_missing: number | null;
analysis: {
end_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
start_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}[];
system_status: "error" | "waiting" | "complete" | "incomplete";
latest_apex_version: string | null;
remarks: string | null;
timeline_summary?: {
months: {
month: string;
failed_count: number;
successful_count: number;
}[];
undated?: {
failed_count: number;
successful_count: number;
} | null | undefined;
} | null | 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;
analysis?: {
end_time: number | null;
start_time: number | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}[] | undefined;
system_status?: "error" | "waiting" | "complete" | "incomplete" | undefined;
remarks?: string | null | undefined;
timeline_summary?: {
months?: {
month: string;
failed_count?: number | undefined;
successful_count?: number | undefined;
}[] | undefined;
undated?: {
failed_count?: number | undefined;
successful_count?: number | undefined;
} | null | undefined;
} | null | undefined;
}>;
export declare const UpdateSamSchema: z.ZodObject<{
_id: z.ZodOptional<z.ZodNumber>;
agency_id: z.ZodOptional<z.ZodString>;
seen_last_at: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>>;
seen_first_at: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>>;
transactions_expected: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
transactions_found: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
transactions_missing: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
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("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>;
first_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
first_transaction_id: z.ZodNullable<z.ZodString>;
first_transaction_type: z.ZodNullable<z.ZodString>;
last_transaction_ase_counter_value: z.ZodNullable<z.ZodNumber>;
last_transaction_id: z.ZodNullable<z.ZodString>;
last_transaction_type: z.ZodNullable<z.ZodString>;
start_time: z.ZodNullable<z.ZodEffects<z.ZodNumber, import("@tmlmobilidade/go-types-shared").UnixTimestamp, number>>;
transactions_expected: z.ZodNumber;
transactions_found: z.ZodNumber;
transactions_missing: z.ZodNumber;
vehicle_id: z.ZodNullable<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
end_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
start_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}, {
end_time: number | null;
start_time: number | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}>, "many">>>;
system_status: z.ZodOptional<z.ZodDefault<z.ZodEnum<["waiting", "incomplete", "complete", "error"]>>>;
latest_apex_version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
remarks: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
timeline_summary: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodDefault<z.ZodObject<{
months: z.ZodDefault<z.ZodArray<z.ZodObject<{
failed_count: z.ZodDefault<z.ZodNumber>;
month: z.ZodString;
successful_count: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
month: string;
failed_count: number;
successful_count: number;
}, {
month: string;
failed_count?: number | undefined;
successful_count?: number | undefined;
}>, "many">>;
undated: z.ZodNullable<z.ZodOptional<z.ZodObject<{
failed_count: z.ZodDefault<z.ZodNumber>;
successful_count: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
failed_count: number;
successful_count: number;
}, {
failed_count?: number | undefined;
successful_count?: number | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
months: {
month: string;
failed_count: number;
successful_count: number;
}[];
undated?: {
failed_count: number;
successful_count: number;
} | null | undefined;
}, {
months?: {
month: string;
failed_count?: number | undefined;
successful_count?: number | undefined;
}[] | undefined;
undated?: {
failed_count?: number | undefined;
successful_count?: number | undefined;
} | null | undefined;
}>>>>>;
}, "strip", z.ZodTypeAny, {
_id?: number | undefined;
agency_id?: string | undefined;
seen_last_at?: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null | undefined;
seen_first_at?: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null | undefined;
transactions_expected?: number | null | undefined;
transactions_found?: number | null | undefined;
transactions_missing?: number | null | undefined;
analysis?: {
end_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
start_time: import("@tmlmobilidade/go-types-shared").UnixTimestamp | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}[] | undefined;
system_status?: "error" | "waiting" | "complete" | "incomplete" | undefined;
latest_apex_version?: string | null | undefined;
remarks?: string | null | undefined;
timeline_summary?: {
months: {
month: string;
failed_count: number;
successful_count: number;
}[];
undated?: {
failed_count: number;
successful_count: number;
} | null | undefined;
} | null | undefined;
}, {
_id?: number | undefined;
agency_id?: string | undefined;
seen_last_at?: number | null | undefined;
seen_first_at?: number | null | undefined;
transactions_expected?: number | null | undefined;
transactions_found?: number | null | undefined;
transactions_missing?: number | null | undefined;
analysis?: {
end_time: number | null;
start_time: number | null;
apex_version: string | null;
device_id: string | null;
first_transaction_ase_counter_value: number | null;
first_transaction_id: string | null;
first_transaction_type: string | null;
last_transaction_ase_counter_value: number | null;
last_transaction_id: string | null;
last_transaction_type: string | null;
transactions_expected: number;
transactions_found: number;
transactions_missing: number;
vehicle_id: number | null;
}[] | undefined;
system_status?: "error" | "waiting" | "complete" | "incomplete" | undefined;
latest_apex_version?: string | null | undefined;
remarks?: string | null | undefined;
timeline_summary?: {
months?: {
month: string;
failed_count?: number | undefined;
successful_count?: number | undefined;
}[] | undefined;
undated?: {
failed_count?: number | undefined;
successful_count?: number | undefined;
} | null | undefined;
} | 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>;
export type SamListItem = Omit<Sam, 'analysis'>;