diff --git a/src/__tests__/asn-helpers.test.ts b/src/__tests__/asn.test.ts similarity index 100% rename from src/__tests__/asn-helpers.test.ts rename to src/__tests__/asn.test.ts diff --git a/src/__tests__/network-helpers.test.ts b/src/__tests__/ip.test.ts similarity index 100% rename from src/__tests__/network-helpers.test.ts rename to src/__tests__/ip.test.ts diff --git a/src/rdap/__tests__/contact-parser.test.ts b/src/__tests__/rdap/contact-parser.test.ts similarity index 100% rename from src/rdap/__tests__/contact-parser.test.ts rename to src/__tests__/rdap/contact-parser.test.ts diff --git a/src/__tests__/rdap-integration.test.ts b/src/__tests__/rdap/integration.test.ts similarity index 100% rename from src/__tests__/rdap-integration.test.ts rename to src/__tests__/rdap/integration.test.ts diff --git a/src/__tests__/rdap-utils.test.ts b/src/__tests__/rdap/type-detection.test.ts similarity index 100% rename from src/__tests__/rdap-utils.test.ts rename to src/__tests__/rdap/type-detection.test.ts diff --git a/src/lib/url-utils.test.ts b/src/__tests__/url.test.ts similarity index 99% rename from src/lib/url-utils.test.ts rename to src/__tests__/url.test.ts index 1adc49e..4f33d30 100644 --- a/src/lib/url-utils.test.ts +++ b/src/__tests__/url.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from "vitest"; -import { serializeQueryToUrl, deserializeUrlToQuery, buildShareableUrl } from "@/lib/url-utils"; +import { serializeQueryToUrl, deserializeUrlToQuery, buildShareableUrl } from "@/lib/urls"; describe("URL Utilities", () => { describe("serializeQueryToUrl", () => { diff --git a/src/components/AbstractCard.tsx b/src/components/AbstractCard.tsx index 8b56b56..9c2cc47 100644 --- a/src/components/AbstractCard.tsx +++ b/src/components/AbstractCard.tsx @@ -4,8 +4,8 @@ import { useBoolean } from "usehooks-ts"; import { Link2Icon, CodeIcon, DownloadIcon } from "@radix-ui/react-icons"; import { Card, Flex, Box, IconButton, Code, Tooltip } from "@radix-ui/themes"; import { OverlayScrollbarsComponent } from "overlayscrollbars-react"; -import type { ParsedGeneric } from "@/rdap/components/Generic"; -import { generateDownloadFilename } from "@/utils/generateFilename"; +import type { ParsedGeneric } from "@/rdap/components/RdapObjectRouter"; +import { generateDownloadFilename } from "@/lib/filename"; import CopyButton from "@/components/CopyButton"; type AbstractCardProps = { diff --git a/src/utils/generateFilename.ts b/src/lib/filename.ts similarity index 98% rename from src/utils/generateFilename.ts rename to src/lib/filename.ts index 2fe31b6..8aa4003 100644 --- a/src/utils/generateFilename.ts +++ b/src/lib/filename.ts @@ -1,4 +1,4 @@ -import type { ParsedGeneric } from "@/rdap/components/Generic"; +import type { ParsedGeneric } from "@/rdap/components/RdapObjectRouter"; /** * Attempts to convert an IP range to CIDR notation diff --git a/src/lib/utils.ts b/src/lib/misc.ts similarity index 100% rename from src/lib/utils.ts rename to src/lib/misc.ts diff --git a/src/lib/url-utils.ts b/src/lib/urls.ts similarity index 100% rename from src/lib/url-utils.ts rename to src/lib/urls.ts diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 741d452..dc9aacb 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -2,7 +2,7 @@ import { type NextPage } from "next"; import Head from "next/head"; import { useState, useEffect, useCallback } from "react"; import { useRouter } from "next/router"; -import Generic from "@/rdap/components/Generic"; +import RdapObjectRouter from "@/rdap/components/RdapObjectRouter"; import type { MetaParsedGeneric } from "@/rdap/hooks/useLookup"; import useLookup from "@/rdap/hooks/useLookup"; import LookupInput from "@/rdap/components/LookupInput"; @@ -12,7 +12,7 @@ import { Maybe } from "true-myth"; import { Flex, Container, Section, Text, Link, IconButton } from "@radix-ui/themes"; import { GitHubLogoIcon } from "@radix-ui/react-icons"; import { OverlayScrollbarsComponent } from "overlayscrollbars-react"; -import { serializeQueryToUrl, deserializeUrlToQuery, buildShareableUrl } from "@/lib/url-utils"; +import { serializeQueryToUrl, deserializeUrlToQuery, buildShareableUrl } from "@/lib/urls"; import type { TargetType } from "@/rdap/schemas"; const Index: NextPage = () => { @@ -172,7 +172,7 @@ const Index: NextPage = () => { /> ) : null} {response.isJust ? ( - = ({ data, url, queryTimestamp }: ObjectProps) => { +const RdapObjectRouter: FunctionComponent = ({ + data, + url, + queryTimestamp, +}: ObjectProps) => { const objectClassName = data.objectClassName; switch (objectClassName) { @@ -38,4 +42,4 @@ const Generic: FunctionComponent = ({ data, url, queryTimestamp }: } }; -export default Generic; +export default RdapObjectRouter; diff --git a/src/rdap/hooks/useLookup.tsx b/src/rdap/hooks/useLookup.tsx index a5c427a..533d4cb 100644 --- a/src/rdap/hooks/useLookup.tsx +++ b/src/rdap/hooks/useLookup.tsx @@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { useDebouncedValue } from "@mantine/hooks"; import type { SubmitProps, TargetType } from "@/rdap/schemas"; import { RootRegistryEnum } from "@/rdap/schemas"; -import type { ParsedGeneric } from "@/rdap/components/Generic"; +import type { ParsedGeneric } from "@/rdap/components/RdapObjectRouter"; import { Maybe, Result } from "true-myth"; import { loadBootstrap, getRegistry } from "@/rdap/services/registry"; import { @@ -11,7 +11,7 @@ import { generateValidationWarning, generateBootstrapWarning, } from "@/rdap/services/type-detection"; -import { executeRdapQuery, HttpSecurityError } from "@/rdap/services/rdap-query"; +import { executeRdapQuery, HttpSecurityError } from "@/rdap/services/query"; export type WarningHandler = (warning: { message: string }) => void; export type UrlUpdateHandler = (target: string, manuallySelectedType: TargetType | null) => void; diff --git a/src/rdap/services/rdap-api.ts b/src/rdap/services/api.ts similarity index 100% rename from src/rdap/services/rdap-api.ts rename to src/rdap/services/api.ts diff --git a/src/rdap/services/rdap-query.ts b/src/rdap/services/query.ts similarity index 97% rename from src/rdap/services/rdap-query.ts rename to src/rdap/services/query.ts index 1ed1b7e..46b40ad 100644 --- a/src/rdap/services/rdap-query.ts +++ b/src/rdap/services/query.ts @@ -7,9 +7,9 @@ import { } from "@/rdap/schemas"; import { Result } from "true-myth"; import { loadBootstrap } from "@/rdap/services/registry"; -import { getRegistryURL } from "@/rdap/services/url-resolver"; -import { getAndParse } from "@/rdap/services/rdap-api"; -import type { ParsedGeneric } from "@/rdap/components/Generic"; +import { getRegistryURL } from "@/rdap/services/resolver"; +import { getAndParse } from "@/rdap/services/api"; +import type { ParsedGeneric } from "@/rdap/components/RdapObjectRouter"; // An array of schemas to try and parse unknown JSON data with. const schemas = [DomainSchema, AutonomousNumberSchema, IpNetworkSchema, EntitySchema]; diff --git a/src/rdap/services/url-resolver.ts b/src/rdap/services/resolver.ts similarity index 100% rename from src/rdap/services/url-resolver.ts rename to src/rdap/services/resolver.ts diff --git a/src/rdap/services/type-detection.ts b/src/rdap/services/type-detection.ts index bb7bec2..2c35748 100644 --- a/src/rdap/services/type-detection.ts +++ b/src/rdap/services/type-detection.ts @@ -1,7 +1,7 @@ import type { Register, RootRegistryType, TargetType } from "@/rdap/schemas"; import { getType, validateInputForType } from "@/rdap/utils"; import type { Result } from "true-myth"; -import { truncated } from "@/lib/utils"; +import { truncated } from "@/lib/misc"; /** * Detect the target type for a given input string.