mirror of
https://github.com/Xevion/rdap.git
synced 2025-12-10 10:08:21 -06:00
Make proper, cohesive TargetType/SimplifiedTargetType types
why didn't I do this before? maybe i'll find out soon
This commit is contained in:
@@ -1,15 +1,17 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export const ObjectTypeEnum = z.enum([
|
export const TargetTypeEnum = z.enum([
|
||||||
"ip",
|
|
||||||
"autnum",
|
"autnum",
|
||||||
|
"domain",
|
||||||
|
"ip4",
|
||||||
|
"ip6",
|
||||||
"entity",
|
"entity",
|
||||||
"url",
|
"url",
|
||||||
"tld",
|
"tld",
|
||||||
"registrar",
|
"registrar",
|
||||||
"json",
|
"json",
|
||||||
"domain",
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const RootRegistryEnum = z.enum([
|
export const RootRegistryEnum = z.enum([
|
||||||
"autnum",
|
"autnum",
|
||||||
"domain",
|
"domain",
|
||||||
@@ -17,6 +19,7 @@ export const RootRegistryEnum = z.enum([
|
|||||||
"ip6",
|
"ip6",
|
||||||
"entity",
|
"entity",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const StatusEnum = z.enum([
|
export const StatusEnum = z.enum([
|
||||||
"validated",
|
"validated",
|
||||||
"renew prohibited",
|
"renew prohibited",
|
||||||
@@ -63,7 +66,7 @@ export const LinkSchema = z.object({
|
|||||||
|
|
||||||
export const EntitySchema = z.object({
|
export const EntitySchema = z.object({
|
||||||
objectClassName: z.literal("entity"),
|
objectClassName: z.literal("entity"),
|
||||||
handle: z.string(),
|
handle: z.string().optional(),
|
||||||
roles: z.array(z.string()),
|
roles: z.array(z.string()),
|
||||||
publicIds: z
|
publicIds: z
|
||||||
.array(
|
.array(
|
||||||
|
|||||||
11
src/types.ts
11
src/types.ts
@@ -7,15 +7,20 @@ import type {
|
|||||||
IpNetworkSchema,
|
IpNetworkSchema,
|
||||||
LinkSchema,
|
LinkSchema,
|
||||||
NameserverSchema,
|
NameserverSchema,
|
||||||
ObjectTypeEnum,
|
TargetTypeEnum,
|
||||||
RegisterSchema,
|
RegisterSchema,
|
||||||
StatusEnum,
|
StatusEnum,
|
||||||
RootRegistryEnum,
|
RootRegistryEnum,
|
||||||
} from "@/schema";
|
} from "@/schema";
|
||||||
|
|
||||||
export type ObjectType = z.infer<typeof ObjectTypeEnum>;
|
// All precise target types that can be placed in the search bar.
|
||||||
|
export type TargetType = z.infer<typeof TargetTypeEnum>;
|
||||||
|
|
||||||
|
// Target types that can be selected by the user; IPv4 and IPv6 are combined into a single type for simplicity (IP/CIDR)
|
||||||
|
export type SimplifiedTargetType = Exclude<TargetType, "ip4" | "ip6"> | "ip";
|
||||||
|
|
||||||
|
// Root registry types that associate with a bootstrap file provided by the RDAP registry.
|
||||||
export type RootRegistryType = z.infer<typeof RootRegistryEnum>;
|
export type RootRegistryType = z.infer<typeof RootRegistryEnum>;
|
||||||
export type TargetType = Exclude<ObjectType, "ip"> | "ip4" | "ip6";
|
|
||||||
|
|
||||||
export type RdapStatusType = z.infer<typeof StatusEnum>;
|
export type RdapStatusType = z.infer<typeof StatusEnum>;
|
||||||
export type Link = z.infer<typeof LinkSchema>;
|
export type Link = z.infer<typeof LinkSchema>;
|
||||||
|
|||||||
Reference in New Issue
Block a user