From dce1f18cfa771cc1bf119c5acf7dbc11a821a980 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 25 Jul 2023 21:04:13 +0200 Subject: [PATCH] move back to internal + types export --- src/types.ts | 5 +++++ src/utils/body.ts | 2 +- src/utils/index.ts | 2 -- src/utils/{ => internal}/validate.ts | 2 +- src/utils/request.ts | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) rename src/utils/{ => internal}/validate.ts (94%) diff --git a/src/types.ts b/src/types.ts index c3fe7450..83466801 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,6 +1,11 @@ import type { H3Event } from "./event"; import { Session } from "./utils/session"; +export type { + ValidateFunction, + ValidateResult, +} from "./utils/internal/validate"; + // https://www.rfc-editor.org/rfc/rfc7231#section-4.1 export type HTTPMethod = | "GET" diff --git a/src/utils/body.ts b/src/utils/body.ts index 631cdf05..513af1fe 100644 --- a/src/utils/body.ts +++ b/src/utils/body.ts @@ -5,7 +5,7 @@ import type { H3Event } from "../event"; import { createError } from "../error"; import { parse as parseMultipartData } from "./internal/multipart"; import { assertMethod, getRequestHeader } from "./request"; -import { ValidateFunction, validateData } from "./validate"; +import { ValidateFunction, validateData } from "./internal/validate"; export type { MultiPartData } from "./internal/multipart"; diff --git a/src/utils/index.ts b/src/utils/index.ts index f6a82c2d..35d6efbc 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -9,5 +9,3 @@ export * from "./response"; export * from "./session"; export * from "./cors"; export * from "./sanitize"; - -export { ValidateFunction, ValidateResult } from "./validate"; diff --git a/src/utils/validate.ts b/src/utils/internal/validate.ts similarity index 94% rename from src/utils/validate.ts rename to src/utils/internal/validate.ts index 2eb6f19f..5de25dce 100644 --- a/src/utils/validate.ts +++ b/src/utils/internal/validate.ts @@ -1,4 +1,4 @@ -import { createError } from "../error"; +import { createError } from "../../error"; // TODO: Consider using similar method of typeschema for external library compatibility // https://github.com/decs/typeschema/blob/v0.1.3/src/assert.ts diff --git a/src/utils/request.ts b/src/utils/request.ts index da221ad6..4c2178f9 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -2,7 +2,7 @@ import { getQuery as _getQuery } from "ufo"; import { createError } from "../error"; import type { HTTPMethod, RequestHeaders } from "../types"; import type { H3Event } from "../event"; -import { validateData, ValidateFunction } from "./validate"; +import { validateData, ValidateFunction } from "./internal/validate"; export function getQuery(event: H3Event) { return _getQuery(event.path || "");