renew-ip
Version:
A module for renewing 4G/LTE IP addresses on tethered Android phones from Node JS.
419 lines • 15 kB
TypeScript
import { z } from "zod";
/**
* Define the priority level options.
* @type {z.ZodEnum}
*/
export declare const RenewalPrioritySchema: z.ZodEnum<["normal", "high"]>;
/**
* Define the trigger expected in the Automate payload.
* @type {z.ZodEnum}
*/
export declare const RenewalPayloadContentSchema: z.ZodUnion<[z.ZodEnum<["renew"]>, z.ZodString]>;
/**
* Define a validation schema for environment variables.
* @type {z.ZodObject}
*/
export declare const EnvSchema: z.ZodObject<{
IP_RENEWAL_SECRET: z.ZodString;
IP_RENEWAL_EMAIL: z.ZodString;
IP_RENEWAL_PRIORITY: z.ZodDefault<z.ZodEnum<["normal", "high"]>>;
IP_RENEWAL_PAYLOAD_CONTENT: z.ZodDefault<z.ZodUnion<[z.ZodEnum<["renew"]>, z.ZodString]>>;
IP_RENEWAL_MAX_ATTEMPTS: z.ZodDefault<z.ZodNumber>;
IP_RENEWAL_DELAY: z.ZodDefault<z.ZodNumber>;
POLL_ATTEMPTS: z.ZodDefault<z.ZodNumber>;
POLL_TIMEOUT: z.ZodDefault<z.ZodNumber>;
TOGGLE_DELAY: z.ZodDefault<z.ZodNumber>;
IPDATA_API_KEY: z.ZodDefault<z.ZodString>;
}, "strip", z.ZodTypeAny, {
IP_RENEWAL_SECRET: string;
IP_RENEWAL_EMAIL: string;
IP_RENEWAL_PRIORITY: "normal" | "high";
IP_RENEWAL_PAYLOAD_CONTENT: string;
IP_RENEWAL_MAX_ATTEMPTS: number;
IP_RENEWAL_DELAY: number;
POLL_ATTEMPTS: number;
POLL_TIMEOUT: number;
TOGGLE_DELAY: number;
IPDATA_API_KEY: string;
}, {
IP_RENEWAL_PRIORITY?: "normal" | "high" | undefined;
IP_RENEWAL_PAYLOAD_CONTENT?: string | undefined;
IP_RENEWAL_MAX_ATTEMPTS?: number | undefined;
IP_RENEWAL_DELAY?: number | undefined;
POLL_ATTEMPTS?: number | undefined;
POLL_TIMEOUT?: number | undefined;
TOGGLE_DELAY?: number | undefined;
IPDATA_API_KEY?: string | undefined;
IP_RENEWAL_SECRET: string;
IP_RENEWAL_EMAIL: string;
}>;
/**
* Exports a typed env file.
* @type {RouterEnv}
*/
export declare const env: z.infer<typeof EnvSchema>;
/**
* Define a validation schema for the request sent to the Automate endpoint.
* @type {z.ZodObject}
*/
export declare const AutomatePayloadSchema: z.ZodObject<{
secret: z.ZodDefault<z.ZodString>;
to: z.ZodDefault<z.ZodString>;
priority: z.ZodDefault<z.ZodEnum<["normal", "high"]>>;
device: z.ZodOptional<z.ZodString>;
payload: z.ZodDefault<z.ZodUnion<[z.ZodEnum<["renew"]>, z.ZodString]>>;
}, "strip", z.ZodTypeAny, {
device?: string | undefined;
secret: string;
to: string;
priority: "normal" | "high";
payload: string;
}, {
secret?: string | undefined;
to?: string | undefined;
priority?: "normal" | "high" | undefined;
device?: string | undefined;
payload?: string | undefined;
}>;
/**
* Define the possible values for IPData field selection.
* @type {z.ZodArray}
*/
export declare const IpDataFieldsSchema: z.ZodArray<z.ZodEnum<["ip", "city", "region", "region_code", "postal", "country_name", "country_code", "asn", "carrier", "time_zone", "threat"]>, "many">;
/**
* Define validation schema for IPData vendor config.
* @type {z.ZodObject}
*/
export declare const IpDataConfigSchema: z.ZodObject<{
key: z.ZodDefault<z.ZodString>;
fields: z.ZodDefault<z.ZodArray<z.ZodEnum<["ip", "city", "region", "region_code", "postal", "country_name", "country_code", "asn", "carrier", "time_zone", "threat"]>, "many">>;
}, "strip", z.ZodTypeAny, {
key: string;
fields: ("ip" | "city" | "region" | "region_code" | "postal" | "country_name" | "country_code" | "asn" | "carrier" | "time_zone" | "threat")[];
}, {
key?: string | undefined;
fields?: ("ip" | "city" | "region" | "region_code" | "postal" | "country_name" | "country_code" | "asn" | "carrier" | "time_zone" | "threat")[] | undefined;
}>;
/**
* Define a validation schema for top level router config which extends the Automate schema.
* @type {z.ZodObject}
*/
export declare const RouterConfigSchema: z.ZodObject<z.extendShape<{
secret: z.ZodDefault<z.ZodString>;
to: z.ZodDefault<z.ZodString>;
priority: z.ZodDefault<z.ZodEnum<["normal", "high"]>>;
device: z.ZodOptional<z.ZodString>;
payload: z.ZodDefault<z.ZodUnion<[z.ZodEnum<["renew"]>, z.ZodString]>>;
}, {
maxAttempts: z.ZodDefault<z.ZodNumber>;
delay: z.ZodDefault<z.ZodNumber>;
ipdata: z.ZodDefault<z.ZodObject<{
key: z.ZodDefault<z.ZodString>;
fields: z.ZodDefault<z.ZodArray<z.ZodEnum<["ip", "city", "region", "region_code", "postal", "country_name", "country_code", "asn", "carrier", "time_zone", "threat"]>, "many">>;
}, "strip", z.ZodTypeAny, {
key: string;
fields: ("ip" | "city" | "region" | "region_code" | "postal" | "country_name" | "country_code" | "asn" | "carrier" | "time_zone" | "threat")[];
}, {
key?: string | undefined;
fields?: ("ip" | "city" | "region" | "region_code" | "postal" | "country_name" | "country_code" | "asn" | "carrier" | "time_zone" | "threat")[] | undefined;
}>>;
}>, "strip", z.ZodTypeAny, {
device?: string | undefined;
secret: string;
to: string;
priority: "normal" | "high";
payload: string;
maxAttempts: number;
delay: number;
ipdata: {
key: string;
fields: ("ip" | "city" | "region" | "region_code" | "postal" | "country_name" | "country_code" | "asn" | "carrier" | "time_zone" | "threat")[];
};
}, {
secret?: string | undefined;
to?: string | undefined;
priority?: "normal" | "high" | undefined;
device?: string | undefined;
payload?: string | undefined;
maxAttempts?: number | undefined;
delay?: number | undefined;
ipdata?: {
key?: string | undefined;
fields?: ("ip" | "city" | "region" | "region_code" | "postal" | "country_name" | "country_code" | "asn" | "carrier" | "time_zone" | "threat")[] | undefined;
} | undefined;
}>;
/**
* Define a partial of the base router config to allow passing incomplete configs.
* @type {z.ZodObject}
*/
export declare const PartialRouterConfigSchema: z.ZodObject<{
secret: z.ZodOptional<z.ZodDefault<z.ZodString>>;
to: z.ZodOptional<z.ZodDefault<z.ZodString>>;
priority: z.ZodOptional<z.ZodDefault<z.ZodEnum<["normal", "high"]>>>;
device: z.ZodOptional<z.ZodOptional<z.ZodString>>;
payload: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodEnum<["renew"]>, z.ZodString]>>>;
maxAttempts: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
delay: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
ipdata: z.ZodOptional<z.ZodDefault<z.ZodObject<{
key: z.ZodDefault<z.ZodString>;
fields: z.ZodDefault<z.ZodArray<z.ZodEnum<["ip", "city", "region", "region_code", "postal", "country_name", "country_code", "asn", "carrier", "time_zone", "threat"]>, "many">>;
}, "strip", z.ZodTypeAny, {
key: string;
fields: ("ip" | "city" | "region" | "region_code" | "postal" | "country_name" | "country_code" | "asn" | "carrier" | "time_zone" | "threat")[];
}, {
key?: string | undefined;
fields?: ("ip" | "city" | "region" | "region_code" | "postal" | "country_name" | "country_code" | "asn" | "carrier" | "time_zone" | "threat")[] | undefined;
}>>>;
}, "strip", z.ZodTypeAny, {
secret?: string | undefined;
to?: string | undefined;
priority?: "normal" | "high" | undefined;
device?: string | undefined;
payload?: string | undefined;
maxAttempts?: number | undefined;
delay?: number | undefined;
ipdata?: {
key: string;
fields: ("ip" | "city" | "region" | "region_code" | "postal" | "country_name" | "country_code" | "asn" | "carrier" | "time_zone" | "threat")[];
} | undefined;
}, {
secret?: string | undefined;
to?: string | undefined;
priority?: "normal" | "high" | undefined;
device?: string | undefined;
payload?: string | undefined;
maxAttempts?: number | undefined;
delay?: number | undefined;
ipdata?: {
key?: string | undefined;
fields?: ("ip" | "city" | "region" | "region_code" | "postal" | "country_name" | "country_code" | "asn" | "carrier" | "time_zone" | "threat")[] | undefined;
} | undefined;
}>;
/**
* Define the schema for an expected response from the IPData vendor service.
* @type {z.ZodObject}
*/
export declare const IpDataResponseSchema: z.ZodObject<{
ip: z.ZodString;
city: z.ZodOptional<z.ZodString>;
region: z.ZodOptional<z.ZodString>;
region_code: z.ZodOptional<z.ZodString>;
country_name: z.ZodOptional<z.ZodString>;
country_code: z.ZodOptional<z.ZodString>;
postal: z.ZodOptional<z.ZodString>;
time_zone: z.ZodOptional<z.ZodObject<{
name: z.ZodString;
abbr: z.ZodString;
offset: z.ZodString;
is_dst: z.ZodBoolean;
current_time: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
abbr: string;
offset: string;
is_dst: boolean;
current_time: string;
}, {
name: string;
abbr: string;
offset: string;
is_dst: boolean;
current_time: string;
}>>;
threat: z.ZodOptional<z.ZodObject<{
is_tor: z.ZodBoolean;
is_proxy: z.ZodBoolean;
is_anonymous: z.ZodBoolean;
is_known_attacker: z.ZodBoolean;
is_known_abuser: z.ZodBoolean;
is_threat: z.ZodBoolean;
is_bogon: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
is_tor: boolean;
is_proxy: boolean;
is_anonymous: boolean;
is_known_attacker: boolean;
is_known_abuser: boolean;
is_threat: boolean;
is_bogon: boolean;
}, {
is_tor: boolean;
is_proxy: boolean;
is_anonymous: boolean;
is_known_attacker: boolean;
is_known_abuser: boolean;
is_threat: boolean;
is_bogon: boolean;
}>>;
statusCode: z.ZodOptional<z.ZodNumber>;
statusMessage: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
city?: string | undefined;
region?: string | undefined;
region_code?: string | undefined;
postal?: string | undefined;
country_name?: string | undefined;
country_code?: string | undefined;
time_zone?: {
name: string;
abbr: string;
offset: string;
is_dst: boolean;
current_time: string;
} | undefined;
threat?: {
is_tor: boolean;
is_proxy: boolean;
is_anonymous: boolean;
is_known_attacker: boolean;
is_known_abuser: boolean;
is_threat: boolean;
is_bogon: boolean;
} | undefined;
statusCode?: number | undefined;
statusMessage?: string | undefined;
ip: string;
}, {
city?: string | undefined;
region?: string | undefined;
region_code?: string | undefined;
postal?: string | undefined;
country_name?: string | undefined;
country_code?: string | undefined;
time_zone?: {
name: string;
abbr: string;
offset: string;
is_dst: boolean;
current_time: string;
} | undefined;
threat?: {
is_tor: boolean;
is_proxy: boolean;
is_anonymous: boolean;
is_known_attacker: boolean;
is_known_abuser: boolean;
is_threat: boolean;
is_bogon: boolean;
} | undefined;
statusCode?: number | undefined;
statusMessage?: string | undefined;
ip: string;
}>;
/**
* Define the shape of IP history records.
* @type {z.ZodObject}
*/
export declare const IpHistorySchema: z.ZodObject<z.extendShape<{
ip: z.ZodString;
city: z.ZodOptional<z.ZodString>;
region: z.ZodOptional<z.ZodString>;
region_code: z.ZodOptional<z.ZodString>;
country_name: z.ZodOptional<z.ZodString>;
country_code: z.ZodOptional<z.ZodString>;
postal: z.ZodOptional<z.ZodString>;
time_zone: z.ZodOptional<z.ZodObject<{
name: z.ZodString;
abbr: z.ZodString;
offset: z.ZodString;
is_dst: z.ZodBoolean;
current_time: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
abbr: string;
offset: string;
is_dst: boolean;
current_time: string;
}, {
name: string;
abbr: string;
offset: string;
is_dst: boolean;
current_time: string;
}>>;
threat: z.ZodOptional<z.ZodObject<{
is_tor: z.ZodBoolean;
is_proxy: z.ZodBoolean;
is_anonymous: z.ZodBoolean;
is_known_attacker: z.ZodBoolean;
is_known_abuser: z.ZodBoolean;
is_threat: z.ZodBoolean;
is_bogon: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
is_tor: boolean;
is_proxy: boolean;
is_anonymous: boolean;
is_known_attacker: boolean;
is_known_abuser: boolean;
is_threat: boolean;
is_bogon: boolean;
}, {
is_tor: boolean;
is_proxy: boolean;
is_anonymous: boolean;
is_known_attacker: boolean;
is_known_abuser: boolean;
is_threat: boolean;
is_bogon: boolean;
}>>;
statusCode: z.ZodOptional<z.ZodNumber>;
statusMessage: z.ZodOptional<z.ZodString>;
}, {
ip: z.ZodString;
timestamp: z.ZodNumber;
}>, "strip", z.ZodTypeAny, {
city?: string | undefined;
region?: string | undefined;
region_code?: string | undefined;
postal?: string | undefined;
country_name?: string | undefined;
country_code?: string | undefined;
time_zone?: {
name: string;
abbr: string;
offset: string;
is_dst: boolean;
current_time: string;
} | undefined;
threat?: {
is_tor: boolean;
is_proxy: boolean;
is_anonymous: boolean;
is_known_attacker: boolean;
is_known_abuser: boolean;
is_threat: boolean;
is_bogon: boolean;
} | undefined;
statusCode?: number | undefined;
statusMessage?: string | undefined;
ip: string;
timestamp: number;
}, {
city?: string | undefined;
region?: string | undefined;
region_code?: string | undefined;
postal?: string | undefined;
country_name?: string | undefined;
country_code?: string | undefined;
time_zone?: {
name: string;
abbr: string;
offset: string;
is_dst: boolean;
current_time: string;
} | undefined;
threat?: {
is_tor: boolean;
is_proxy: boolean;
is_anonymous: boolean;
is_known_attacker: boolean;
is_known_abuser: boolean;
is_threat: boolean;
is_bogon: boolean;
} | undefined;
statusCode?: number | undefined;
statusMessage?: string | undefined;
ip: string;
timestamp: number;
}>;
//# sourceMappingURL=schemas.d.ts.map