diff --git a/compat-test/quick-start.spec.ts b/compat-test/quick-start.spec.ts index e172c4a333..c226f52d64 100644 --- a/compat-test/quick-start.spec.ts +++ b/compat-test/quick-start.spec.ts @@ -8,7 +8,7 @@ import { expect, test, } from "vitest"; -import { givePort } from "../tools/ports.ts"; +import { givePort } from "../tools/ports"; describe("ESM Test", async () => { let out = ""; diff --git a/esm-test/quick-start.spec.ts b/esm-test/quick-start.spec.ts index c05fbfe14d..fd102c884b 100644 --- a/esm-test/quick-start.spec.ts +++ b/esm-test/quick-start.spec.ts @@ -1,5 +1,5 @@ import { spawn } from "node:child_process"; -import { givePort } from "../tools/ports.ts"; +import { givePort } from "../tools/ports"; describe("ESM Test", async () => { let out = ""; diff --git a/example/config.ts b/example/config.ts index 1f9eb6f797..f91c7ea2f9 100644 --- a/example/config.ts +++ b/example/config.ts @@ -1,7 +1,7 @@ import { BuiltinLogger, createConfig } from "express-zod-api"; import ui from "swagger-ui-express"; import createHttpError from "http-errors"; -import { givePort } from "../tools/ports.ts"; +import { givePort } from "../tools/ports"; import qs from "qs"; export const config = createConfig({ diff --git a/example/endpoints/create-user.ts b/example/endpoints/create-user.ts index b7b6f44cfd..0cbbba7893 100644 --- a/example/endpoints/create-user.ts +++ b/example/endpoints/create-user.ts @@ -1,7 +1,7 @@ import createHttpError from "http-errors"; import assert from "node:assert/strict"; import { z } from "zod"; -import { statusDependingFactory } from "../factories.ts"; +import { statusDependingFactory } from "../factories"; const namePart = z.string().regex(/^\w+$/); diff --git a/example/endpoints/delete-user.ts b/example/endpoints/delete-user.ts index eb521ba951..e655a3e4ae 100644 --- a/example/endpoints/delete-user.ts +++ b/example/endpoints/delete-user.ts @@ -1,7 +1,7 @@ import createHttpError from "http-errors"; import assert from "node:assert/strict"; import { z } from "zod"; -import { noContentFactory } from "../factories.ts"; +import { noContentFactory } from "../factories"; /** @desc The endpoint demonstrates no content response established by its factory */ export const deleteUserEndpoint = noContentFactory.buildVoid({ diff --git a/example/endpoints/list-users.ts b/example/endpoints/list-users.ts index c5e919ef27..b9844dfa3a 100644 --- a/example/endpoints/list-users.ts +++ b/example/endpoints/list-users.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { arrayRespondingFactory } from "../factories.ts"; +import { arrayRespondingFactory } from "../factories"; const roleSchema = z.enum(["manager", "operator", "admin"]); diff --git a/example/endpoints/retrieve-user.ts b/example/endpoints/retrieve-user.ts index 20e6bfd429..1c3c9f327a 100644 --- a/example/endpoints/retrieve-user.ts +++ b/example/endpoints/retrieve-user.ts @@ -2,7 +2,7 @@ import createHttpError from "http-errors"; import assert from "node:assert/strict"; import { z } from "zod"; import { defaultEndpointsFactory } from "express-zod-api"; -import { methodProviderMiddleware } from "../middlewares.ts"; +import { methodProviderMiddleware } from "../middlewares"; // Demonstrating circular schemas using z.object() const feature = z.object({ diff --git a/example/endpoints/send-avatar.ts b/example/endpoints/send-avatar.ts index 4ba078d78d..9bc91b442d 100644 --- a/example/endpoints/send-avatar.ts +++ b/example/endpoints/send-avatar.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { fileSendingEndpointsFactory } from "../factories.ts"; +import { fileSendingEndpointsFactory } from "../factories"; import { readFile } from "node:fs/promises"; export const sendAvatarEndpoint = fileSendingEndpointsFactory.build({ diff --git a/example/endpoints/stream-avatar.ts b/example/endpoints/stream-avatar.ts index 8c567313a4..677edc57b6 100644 --- a/example/endpoints/stream-avatar.ts +++ b/example/endpoints/stream-avatar.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { fileStreamingEndpointsFactory } from "../factories.ts"; +import { fileStreamingEndpointsFactory } from "../factories"; export const streamAvatarEndpoint = fileStreamingEndpointsFactory.build({ shortDescription: "Streams a file content.", diff --git a/example/endpoints/time-subscription.ts b/example/endpoints/time-subscription.ts index 5a2b98a5b2..ca8625630d 100644 --- a/example/endpoints/time-subscription.ts +++ b/example/endpoints/time-subscription.ts @@ -1,6 +1,6 @@ import { z } from "zod"; import { setTimeout } from "node:timers/promises"; -import { eventsFactory } from "../factories.ts"; +import { eventsFactory } from "../factories"; /** @desc The endpoint demonstrates emitting server-sent events (SSE) */ export const subscriptionEndpoint = eventsFactory.buildVoid({ diff --git a/example/endpoints/update-user.ts b/example/endpoints/update-user.ts index 56ca40dd84..2aedbf4f67 100644 --- a/example/endpoints/update-user.ts +++ b/example/endpoints/update-user.ts @@ -2,7 +2,7 @@ import createHttpError from "http-errors"; import assert from "node:assert/strict"; import { z } from "zod"; import { ez } from "express-zod-api"; -import { keyAndTokenAuthenticatedEndpointsFactory } from "../factories.ts"; +import { keyAndTokenAuthenticatedEndpointsFactory } from "../factories"; export const updateUserEndpoint = keyAndTokenAuthenticatedEndpointsFactory.build({ diff --git a/example/factories.ts b/example/factories.ts index e637820165..3486217b94 100644 --- a/example/factories.ts +++ b/example/factories.ts @@ -7,7 +7,7 @@ import { EventStreamFactory, defaultEndpointsFactory, } from "express-zod-api"; -import { authMiddleware } from "./middlewares.ts"; +import { authMiddleware } from "./middlewares"; import { createReadStream } from "node:fs"; import { z } from "zod"; import { stat } from "node:fs/promises"; diff --git a/example/generate-client.ts b/example/generate-client.ts index d96aec4d61..0578e18b1d 100644 --- a/example/generate-client.ts +++ b/example/generate-client.ts @@ -1,7 +1,7 @@ import { writeFile } from "node:fs/promises"; import { Integration } from "express-zod-api"; -import { routing } from "./routing.ts"; -import { config } from "./config.ts"; +import { routing } from "./routing"; +import { config } from "./config"; await writeFile( "example.client.ts", diff --git a/example/generate-documentation.ts b/example/generate-documentation.ts index badba033ca..82f70845a1 100644 --- a/example/generate-documentation.ts +++ b/example/generate-documentation.ts @@ -1,8 +1,8 @@ import { writeFile } from "node:fs/promises"; import { Documentation } from "express-zod-api"; -import { config } from "./config.ts"; -import { routing } from "./routing.ts"; -import manifest from "./package.json" with { type: "json" }; +import { config } from "./config"; +import { routing } from "./routing"; +import manifest from "./package.json"; await writeFile( "example.documentation.yaml", diff --git a/example/index.spec.ts b/example/index.spec.ts index 2f7b40b92e..2a8255abfe 100644 --- a/example/index.spec.ts +++ b/example/index.spec.ts @@ -1,8 +1,8 @@ import assert from "node:assert/strict"; import { spawn } from "node:child_process"; import { createReadStream, readFileSync } from "node:fs"; -import { Client, Subscription } from "./example.client.ts"; -import { givePort } from "../tools/ports.ts"; +import { Client, Subscription } from "./example.client"; +import { givePort } from "../tools/ports"; import { createHash } from "node:crypto"; import { readFile } from "node:fs/promises"; import { fail } from "node:assert"; diff --git a/example/index.ts b/example/index.ts index 3292f7dfcf..9f62dc28d3 100644 --- a/example/index.ts +++ b/example/index.ts @@ -1,6 +1,6 @@ import { createServer } from "express-zod-api"; -import { config } from "./config.ts"; -import { routing } from "./routing.ts"; +import { config } from "./config"; +import { routing } from "./routing"; /** * "await" is only needed for using entities returned from this method. diff --git a/example/routing.ts b/example/routing.ts index 0d9ef98a73..a57865a501 100644 --- a/example/routing.ts +++ b/example/routing.ts @@ -1,15 +1,15 @@ import { DependsOnMethod, Routing, ServeStatic } from "express-zod-api"; -import { rawAcceptingEndpoint } from "./endpoints/accept-raw.ts"; -import { createUserEndpoint } from "./endpoints/create-user.ts"; -import { deleteUserEndpoint } from "./endpoints/delete-user.ts"; -import { listUsersEndpoint } from "./endpoints/list-users.ts"; -import { submitFeedbackEndpoint } from "./endpoints/submit-feedback.ts"; -import { subscriptionEndpoint } from "./endpoints/time-subscription.ts"; -import { uploadAvatarEndpoint } from "./endpoints/upload-avatar.ts"; -import { retrieveUserEndpoint } from "./endpoints/retrieve-user.ts"; -import { sendAvatarEndpoint } from "./endpoints/send-avatar.ts"; -import { updateUserEndpoint } from "./endpoints/update-user.ts"; -import { streamAvatarEndpoint } from "./endpoints/stream-avatar.ts"; +import { rawAcceptingEndpoint } from "./endpoints/accept-raw"; +import { createUserEndpoint } from "./endpoints/create-user"; +import { deleteUserEndpoint } from "./endpoints/delete-user"; +import { listUsersEndpoint } from "./endpoints/list-users"; +import { submitFeedbackEndpoint } from "./endpoints/submit-feedback"; +import { subscriptionEndpoint } from "./endpoints/time-subscription"; +import { uploadAvatarEndpoint } from "./endpoints/upload-avatar"; +import { retrieveUserEndpoint } from "./endpoints/retrieve-user"; +import { sendAvatarEndpoint } from "./endpoints/send-avatar"; +import { updateUserEndpoint } from "./endpoints/update-user"; +import { streamAvatarEndpoint } from "./endpoints/stream-avatar"; export const routing: Routing = { v1: { diff --git a/express-zod-api/src/builtin-logger.ts b/express-zod-api/src/builtin-logger.ts index c2de347319..1008bff276 100644 --- a/express-zod-api/src/builtin-logger.ts +++ b/express-zod-api/src/builtin-logger.ts @@ -1,14 +1,14 @@ import ansis from "ansis"; import { inspect } from "node:util"; import { performance } from "node:perf_hooks"; -import { FlatObject, isProduction } from "./common-helpers.ts"; +import { FlatObject, isProduction } from "./common-helpers"; import { AbstractLogger, formatDuration, isHidden, Severity, styles, -} from "./logger-helpers.ts"; +} from "./logger-helpers"; interface Context extends FlatObject { requestId?: string; diff --git a/express-zod-api/src/common-helpers.ts b/express-zod-api/src/common-helpers.ts index 96c2e3eceb..d727e4cc04 100644 --- a/express-zod-api/src/common-helpers.ts +++ b/express-zod-api/src/common-helpers.ts @@ -1,16 +1,16 @@ import { Request } from "express"; import * as R from "ramda"; import { z } from "zod"; -import { CommonConfig, InputSource, InputSources } from "./config-type.ts"; -import { contentTypes } from "./content-type.ts"; +import { CommonConfig, InputSource, InputSources } from "./config-type"; +import { contentTypes } from "./content-type"; import { ClientMethod, SomeMethod, isMethod, Method, CORSMethod, -} from "./method.ts"; -import { NormalizedResponse } from "./api-response.ts"; +} from "./method"; +import { NormalizedResponse } from "./api-response"; /** @since zod 3.25.61 output type fixed */ export const emptySchema = z.object({}); diff --git a/express-zod-api/src/config-type.ts b/express-zod-api/src/config-type.ts index 959e3541e3..d91cee73f0 100644 --- a/express-zod-api/src/config-type.ts +++ b/express-zod-api/src/config-type.ts @@ -2,13 +2,13 @@ import type compression from "compression"; import { IRouter, Request, RequestHandler } from "express"; import type fileUpload from "express-fileupload"; import { ServerOptions } from "node:https"; -import { BuiltinLoggerConfig } from "./builtin-logger.ts"; -import { AbstractEndpoint } from "./endpoint.ts"; -import { AbstractLogger, ActualLogger } from "./logger-helpers.ts"; -import { Method } from "./method.ts"; -import { AbstractResultHandler } from "./result-handler.ts"; +import { BuiltinLoggerConfig } from "./builtin-logger"; +import { AbstractEndpoint } from "./endpoint"; +import { AbstractLogger, ActualLogger } from "./logger-helpers"; +import { Method } from "./method"; +import { AbstractResultHandler } from "./result-handler"; import { ListenOptions } from "node:net"; -import { GetLogger } from "./server-helpers.ts"; +import { GetLogger } from "./server-helpers"; export type InputSource = keyof Pick< Request, diff --git a/express-zod-api/src/deep-checks.ts b/express-zod-api/src/deep-checks.ts index a5417f22b4..0b167ad15d 100644 --- a/express-zod-api/src/deep-checks.ts +++ b/express-zod-api/src/deep-checks.ts @@ -1,15 +1,15 @@ import * as R from "ramda"; import { z } from "zod"; -import { ezBufferBrand } from "./buffer-schema.ts"; -import { ezDateInBrand } from "./date-in-schema.ts"; -import { ezDateOutBrand } from "./date-out-schema.ts"; -import { DeepCheckError } from "./errors.ts"; -import { ezFormBrand } from "./form-schema.ts"; -import { IOSchema } from "./io-schema.ts"; +import { ezBufferBrand } from "./buffer-schema"; +import { ezDateInBrand } from "./date-in-schema"; +import { ezDateOutBrand } from "./date-out-schema"; +import { DeepCheckError } from "./errors"; +import { ezFormBrand } from "./form-schema"; +import { IOSchema } from "./io-schema"; import { getBrand } from "@express-zod-api/zod-plugin"; -import { FirstPartyKind } from "./schema-walker.ts"; -import { ezUploadBrand } from "./upload-schema.ts"; -import { ezRawBrand } from "./raw-schema.ts"; +import { FirstPartyKind } from "./schema-walker"; +import { ezUploadBrand } from "./upload-schema"; +import { ezRawBrand } from "./raw-schema"; interface NestedSchemaLookupProps { io: "input" | "output"; diff --git a/express-zod-api/src/depends-on-method.ts b/express-zod-api/src/depends-on-method.ts index 191d8c132c..39f8237ff7 100644 --- a/express-zod-api/src/depends-on-method.ts +++ b/express-zod-api/src/depends-on-method.ts @@ -1,7 +1,7 @@ import * as R from "ramda"; -import { AbstractEndpoint } from "./endpoint.ts"; -import { Method } from "./method.ts"; -import { Routable } from "./routable.ts"; +import { AbstractEndpoint } from "./endpoint"; +import { Method } from "./method"; +import { Routable } from "./routable"; export class DependsOnMethod extends Routable { readonly #endpoints: ConstructorParameters[0]; diff --git a/express-zod-api/src/diagnostics.ts b/express-zod-api/src/diagnostics.ts index bc69fb6064..024f4ffcfc 100644 --- a/express-zod-api/src/diagnostics.ts +++ b/express-zod-api/src/diagnostics.ts @@ -1,11 +1,11 @@ import { z } from "zod"; -import { responseVariants } from "./api-response.ts"; -import { FlatObject, getRoutePathParams } from "./common-helpers.ts"; -import { contentTypes } from "./content-type.ts"; -import { findJsonIncompatible } from "./deep-checks.ts"; -import { AbstractEndpoint } from "./endpoint.ts"; -import { flattenIO } from "./json-schema-helpers.ts"; -import { ActualLogger } from "./logger-helpers.ts"; +import { responseVariants } from "./api-response"; +import { FlatObject, getRoutePathParams } from "./common-helpers"; +import { contentTypes } from "./content-type"; +import { findJsonIncompatible } from "./deep-checks"; +import { AbstractEndpoint } from "./endpoint"; +import { flattenIO } from "./json-schema-helpers"; +import { ActualLogger } from "./logger-helpers"; export class Diagnostics { #verifiedEndpoints = new WeakSet(); diff --git a/express-zod-api/src/documentation-helpers.ts b/express-zod-api/src/documentation-helpers.ts index be2ceeca8b..43431cb140 100644 --- a/express-zod-api/src/documentation-helpers.ts +++ b/express-zod-api/src/documentation-helpers.ts @@ -16,8 +16,8 @@ import { } from "openapi3-ts/oas31"; import * as R from "ramda"; import { z } from "zod"; -import { NormalizedResponse, ResponseVariant } from "./api-response.ts"; -import { ezBufferBrand } from "./buffer-schema.ts"; +import { NormalizedResponse, ResponseVariant } from "./api-response"; +import { ezBufferBrand } from "./buffer-schema"; import { shouldHaveContent, FlatObject, @@ -29,23 +29,23 @@ import { routePathParamsRegex, Tag, ucFirst, -} from "./common-helpers.ts"; -import { InputSource } from "./config-type.ts"; -import { contentTypes } from "./content-type.ts"; -import { ezDateInBrand } from "./date-in-schema.ts"; -import { ezDateOutBrand } from "./date-out-schema.ts"; -import { DocumentationError } from "./errors.ts"; -import { IOSchema } from "./io-schema.ts"; -import { flattenIO } from "./json-schema-helpers.ts"; -import { Alternatives } from "./logical-container.ts"; +} from "./common-helpers"; +import { InputSource } from "./config-type"; +import { contentTypes } from "./content-type"; +import { ezDateInBrand } from "./date-in-schema"; +import { ezDateOutBrand } from "./date-out-schema"; +import { DocumentationError } from "./errors"; +import { IOSchema } from "./io-schema"; +import { flattenIO } from "./json-schema-helpers"; +import { Alternatives } from "./logical-container"; import { getBrand } from "@express-zod-api/zod-plugin"; -import { ClientMethod } from "./method.ts"; -import { ProprietaryBrand } from "./proprietary-schemas.ts"; -import { ezRawBrand } from "./raw-schema.ts"; -import { FirstPartyKind } from "./schema-walker.ts"; -import { Security } from "./security.ts"; -import { ezUploadBrand } from "./upload-schema.ts"; -import wellKnownHeaders from "./well-known-headers.ts"; +import { ClientMethod } from "./method"; +import { ProprietaryBrand } from "./proprietary-schemas"; +import { ezRawBrand } from "./raw-schema"; +import { FirstPartyKind } from "./schema-walker"; +import { Security } from "./security"; +import { ezUploadBrand } from "./upload-schema"; +import wellKnownHeaders from "./well-known-headers"; interface ReqResCommons { makeRef: ( diff --git a/express-zod-api/src/documentation.ts b/express-zod-api/src/documentation.ts index 4454bdfccf..987f82acc8 100644 --- a/express-zod-api/src/documentation.ts +++ b/express-zod-api/src/documentation.ts @@ -8,13 +8,13 @@ import { SecuritySchemeType, } from "openapi3-ts/oas31"; import * as R from "ramda"; -import { responseVariants } from "./api-response.ts"; -import { contentTypes } from "./content-type.ts"; -import { DocumentationError } from "./errors.ts"; -import { getInputSources, makeCleanId } from "./common-helpers.ts"; -import { CommonConfig } from "./config-type.ts"; -import { processContainers } from "./logical-container.ts"; -import { ClientMethod } from "./method.ts"; +import { responseVariants } from "./api-response"; +import { contentTypes } from "./content-type"; +import { DocumentationError } from "./errors"; +import { getInputSources, makeCleanId } from "./common-helpers"; +import { CommonConfig } from "./config-type"; +import { processContainers } from "./logical-container"; +import { ClientMethod } from "./method"; import { depictBody, depictRequestParams, @@ -28,9 +28,9 @@ import { nonEmpty, BrandHandling, depictRequest, -} from "./documentation-helpers.ts"; -import { Routing } from "./routing.ts"; -import { OnEndpoint, walkRouting, withHead } from "./routing-walker.ts"; +} from "./documentation-helpers"; +import { Routing } from "./routing"; +import { OnEndpoint, walkRouting, withHead } from "./routing-walker"; type Component = | "positiveResponse" diff --git a/express-zod-api/src/endpoint.ts b/express-zod-api/src/endpoint.ts index 535a6fef89..b21dd45abd 100644 --- a/express-zod-api/src/endpoint.ts +++ b/express-zod-api/src/endpoint.ts @@ -1,36 +1,36 @@ import { Request, Response } from "express"; import * as R from "ramda"; import { z, globalRegistry } from "zod"; -import { NormalizedResponse, ResponseVariant } from "./api-response.ts"; -import { findRequestTypeDefiningSchema } from "./deep-checks.ts"; +import { NormalizedResponse, ResponseVariant } from "./api-response"; +import { findRequestTypeDefiningSchema } from "./deep-checks"; import { FlatObject, getActualMethod, getInput, ensureError, isSchema, -} from "./common-helpers.ts"; -import { CommonConfig } from "./config-type.ts"; +} from "./common-helpers"; +import { CommonConfig } from "./config-type"; import { InputValidationError, OutputValidationError, ResultHandlerError, -} from "./errors.ts"; -import { ezFormBrand } from "./form-schema.ts"; -import { IOSchema } from "./io-schema.ts"; -import { lastResortHandler } from "./last-resort.ts"; -import { ActualLogger } from "./logger-helpers.ts"; -import { LogicalContainer } from "./logical-container.ts"; +} from "./errors"; +import { ezFormBrand } from "./form-schema"; +import { IOSchema } from "./io-schema"; +import { lastResortHandler } from "./last-resort"; +import { ActualLogger } from "./logger-helpers"; +import { LogicalContainer } from "./logical-container"; import { getBrand } from "@express-zod-api/zod-plugin"; -import { ClientMethod, CORSMethod, Method, SomeMethod } from "./method.ts"; -import { AbstractMiddleware, ExpressMiddleware } from "./middleware.ts"; -import { ContentType } from "./content-type.ts"; -import { ezRawBrand } from "./raw-schema.ts"; -import { DiscriminatedResult, pullResponseExamples } from "./result-helpers.ts"; -import { Routable } from "./routable.ts"; -import { AbstractResultHandler } from "./result-handler.ts"; -import { Security } from "./security.ts"; -import { ezUploadBrand } from "./upload-schema.ts"; +import { ClientMethod, CORSMethod, Method, SomeMethod } from "./method"; +import { AbstractMiddleware, ExpressMiddleware } from "./middleware"; +import { ContentType } from "./content-type"; +import { ezRawBrand } from "./raw-schema"; +import { DiscriminatedResult, pullResponseExamples } from "./result-helpers"; +import { Routable } from "./routable"; +import { AbstractResultHandler } from "./result-handler"; +import { Security } from "./security"; +import { ezUploadBrand } from "./upload-schema"; export type Handler = (params: { /** @desc The inputs from the enabled input sources validated against the final input schema (incl. Middlewares) */ diff --git a/express-zod-api/src/endpoints-factory.ts b/express-zod-api/src/endpoints-factory.ts index eebbc6385b..a76c8fa052 100644 --- a/express-zod-api/src/endpoints-factory.ts +++ b/express-zod-api/src/endpoints-factory.ts @@ -6,26 +6,26 @@ import { EmptySchema, FlatObject, Tag, -} from "./common-helpers.ts"; -import { Endpoint, Handler } from "./endpoint.ts"; +} from "./common-helpers"; +import { Endpoint, Handler } from "./endpoint"; import { IOSchema, FinalInputSchema, Extension, ensureExtension, makeFinalInputSchema, -} from "./io-schema.ts"; -import { ClientMethod, Method } from "./method.ts"; +} from "./io-schema"; +import { ClientMethod, Method } from "./method"; import { AbstractMiddleware, ExpressMiddleware, Middleware, -} from "./middleware.ts"; +} from "./middleware"; import { AbstractResultHandler, arrayResultHandler, defaultResultHandler, -} from "./result-handler.ts"; +} from "./result-handler"; interface BuildProps< IN extends IOSchema, diff --git a/express-zod-api/src/errors.ts b/express-zod-api/src/errors.ts index 5bd0947b3f..3da95acea6 100644 --- a/express-zod-api/src/errors.ts +++ b/express-zod-api/src/errors.ts @@ -1,7 +1,7 @@ import { z } from "zod"; -import { getMessageFromError } from "./common-helpers.ts"; -import { OpenAPIContext } from "./documentation-helpers.ts"; -import type { Method } from "./method.ts"; +import { getMessageFromError } from "./common-helpers"; +import { OpenAPIContext } from "./documentation-helpers"; +import type { Method } from "./method"; /** @desc An error related to the wrong Routing declaration */ export class RoutingError extends Error { diff --git a/express-zod-api/src/graceful-shutdown.ts b/express-zod-api/src/graceful-shutdown.ts index 268c0767d2..bb3762e954 100644 --- a/express-zod-api/src/graceful-shutdown.ts +++ b/express-zod-api/src/graceful-shutdown.ts @@ -2,14 +2,14 @@ import http from "node:http"; import https from "node:https"; import { setInterval } from "node:timers/promises"; import type { Socket } from "node:net"; -import type { ActualLogger } from "./logger-helpers.ts"; +import type { ActualLogger } from "./logger-helpers"; import { closeAsync, hasHttpServer, hasResponse, isEncrypted, weAreClosed, -} from "./graceful-helpers.ts"; +} from "./graceful-helpers"; export const monitor = ( servers: Array, diff --git a/express-zod-api/src/index.ts b/express-zod-api/src/index.ts index 6bbd6ccdec..a97563aee9 100644 --- a/express-zod-api/src/index.ts +++ b/express-zod-api/src/index.ts @@ -1,52 +1,52 @@ import "@express-zod-api/zod-plugin"; // side effects here -export { createConfig } from "./config-type.ts"; +export { createConfig } from "./config-type"; export { EndpointsFactory, defaultEndpointsFactory, arrayEndpointsFactory, -} from "./endpoints-factory.ts"; -export { getMessageFromError } from "./common-helpers.ts"; -export { ensureHttpError } from "./result-helpers.ts"; -export { BuiltinLogger } from "./builtin-logger.ts"; -export { Middleware } from "./middleware.ts"; +} from "./endpoints-factory"; +export { getMessageFromError } from "./common-helpers"; +export { ensureHttpError } from "./result-helpers"; +export { BuiltinLogger } from "./builtin-logger"; +export { Middleware } from "./middleware"; export { ResultHandler, defaultResultHandler, arrayResultHandler, -} from "./result-handler.ts"; -export { DependsOnMethod } from "./depends-on-method.ts"; -export { ServeStatic } from "./serve-static.ts"; -export { createServer, attachRouting } from "./server.ts"; -export { Documentation } from "./documentation.ts"; +} from "./result-handler"; +export { DependsOnMethod } from "./depends-on-method"; +export { ServeStatic } from "./serve-static"; +export { createServer, attachRouting } from "./server"; +export { Documentation } from "./documentation"; export { DocumentationError, RoutingError, OutputValidationError, InputValidationError, MissingPeerError, -} from "./errors.ts"; -export { testEndpoint, testMiddleware } from "./testing.ts"; -export { Integration } from "./integration.ts"; -export { EventStreamFactory } from "./sse.ts"; +} from "./errors"; +export { testEndpoint, testMiddleware } from "./testing"; +export { Integration } from "./integration"; +export { EventStreamFactory } from "./sse"; -export { ez } from "./proprietary-schemas.ts"; +export { ez } from "./proprietary-schemas"; // Convenience types -export type { Depicter } from "./documentation-helpers.ts"; -export type { Producer } from "./zts-helpers.ts"; +export type { Depicter } from "./documentation-helpers"; +export type { Producer } from "./zts-helpers"; // Interfaces exposed for augmentation -export type { LoggerOverrides } from "./logger-helpers.ts"; -export type { TagOverrides } from "./common-helpers.ts"; +export type { LoggerOverrides } from "./logger-helpers"; +export type { TagOverrides } from "./common-helpers"; // Issues 952, 1182, 1269: Insufficient exports for consumer's declaration import type {} from "qs"; // fixes TS2742 for attachRouting -export type { Routing } from "./routing.ts"; -export type { FlatObject } from "./common-helpers.ts"; -export type { Method } from "./method.ts"; -export type { IOSchema } from "./io-schema.ts"; -export type { CommonConfig, AppConfig, ServerConfig } from "./config-type.ts"; -export type { ApiResponse } from "./api-response.ts"; +export type { Routing } from "./routing"; +export type { FlatObject } from "./common-helpers"; +export type { Method } from "./method"; +export type { IOSchema } from "./io-schema"; +export type { CommonConfig, AppConfig, ServerConfig } from "./config-type"; +export type { ApiResponse } from "./api-response"; export type { BasicSecurity, BearerSecurity, @@ -55,4 +55,4 @@ export type { InputSecurity, OAuth2Security, OpenIdSecurity, -} from "./security.ts"; +} from "./security"; diff --git a/express-zod-api/src/integration-base.ts b/express-zod-api/src/integration-base.ts index a80453b8ad..c5ae09c388 100644 --- a/express-zod-api/src/integration-base.ts +++ b/express-zod-api/src/integration-base.ts @@ -1,9 +1,9 @@ import * as R from "ramda"; import ts from "typescript"; -import { ResponseVariant } from "./api-response.ts"; -import { contentTypes } from "./content-type.ts"; -import { ClientMethod, clientMethods } from "./method.ts"; -import type { makeEventSchema } from "./sse.ts"; +import { ResponseVariant } from "./api-response"; +import { contentTypes } from "./content-type"; +import { ClientMethod, clientMethods } from "./method"; +import type { makeEventSchema } from "./sse"; import { accessModifiers, ensureTypeNode, @@ -39,7 +39,7 @@ import { makeFnType, makeLiteralType, literally, -} from "./typescript-api.ts"; +} from "./typescript-api"; type IOKind = "input" | "response" | ResponseVariant | "encoded"; type SSEShape = ReturnType["shape"]; diff --git a/express-zod-api/src/integration.ts b/express-zod-api/src/integration.ts index 98fe3cb542..6baa5e7adf 100644 --- a/express-zod-api/src/integration.ts +++ b/express-zod-api/src/integration.ts @@ -1,8 +1,8 @@ import * as R from "ramda"; import ts from "typescript"; import { z } from "zod"; -import { ResponseVariant, responseVariants } from "./api-response.ts"; -import { IntegrationBase } from "./integration-base.ts"; +import { ResponseVariant, responseVariants } from "./api-response"; +import { IntegrationBase } from "./integration-base"; import { f, makeInterfaceProp, @@ -13,16 +13,16 @@ import { makeIndexed, makeLiteralType, makeUnion, -} from "./typescript-api.ts"; -import { shouldHaveContent, makeCleanId } from "./common-helpers.ts"; -import { loadPeer } from "./peer-helpers.ts"; -import { Routing } from "./routing.ts"; -import { OnEndpoint, walkRouting, withHead } from "./routing-walker.ts"; -import { HandlingRules } from "./schema-walker.ts"; -import { zodToTs } from "./zts.ts"; -import { ZTSContext } from "./zts-helpers.ts"; +} from "./typescript-api"; +import { shouldHaveContent, makeCleanId } from "./common-helpers"; +import { loadPeer } from "./peer-helpers"; +import { Routing } from "./routing"; +import { OnEndpoint, walkRouting, withHead } from "./routing-walker"; +import { HandlingRules } from "./schema-walker"; +import { zodToTs } from "./zts"; +import { ZTSContext } from "./zts-helpers"; import type Prettier from "prettier"; -import { ClientMethod } from "./method.ts"; +import { ClientMethod } from "./method"; interface IntegrationParams { routing: Routing; diff --git a/express-zod-api/src/json-schema-helpers.ts b/express-zod-api/src/json-schema-helpers.ts index 4aec0da698..1d96da0daa 100644 --- a/express-zod-api/src/json-schema-helpers.ts +++ b/express-zod-api/src/json-schema-helpers.ts @@ -1,5 +1,5 @@ import * as R from "ramda"; -import { combinations, FlatObject, isObject } from "./common-helpers.ts"; +import { combinations, FlatObject, isObject } from "./common-helpers"; import type { z } from "zod"; const isJsonObjectSchema = ( diff --git a/express-zod-api/src/last-resort.ts b/express-zod-api/src/last-resort.ts index 0270b27d62..a37b81151d 100644 --- a/express-zod-api/src/last-resort.ts +++ b/express-zod-api/src/last-resort.ts @@ -1,8 +1,8 @@ import { Response } from "express"; import createHttpError, { isHttpError } from "http-errors"; -import { ResultHandlerError } from "./errors.ts"; -import { ActualLogger } from "./logger-helpers.ts"; -import { getPublicErrorMessage } from "./result-helpers.ts"; +import { ResultHandlerError } from "./errors"; +import { ActualLogger } from "./logger-helpers"; +import { getPublicErrorMessage } from "./result-helpers"; interface LastResortHandlerParams { error: ResultHandlerError; diff --git a/express-zod-api/src/logger-helpers.ts b/express-zod-api/src/logger-helpers.ts index afb106b993..fffab336fb 100644 --- a/express-zod-api/src/logger-helpers.ts +++ b/express-zod-api/src/logger-helpers.ts @@ -1,6 +1,6 @@ import { Ansis, blue, green, hex, red, cyanBright } from "ansis"; import * as R from "ramda"; -import { isObject } from "./common-helpers.ts"; +import { isObject } from "./common-helpers"; export const styles = { debug: blue, diff --git a/express-zod-api/src/logical-container.ts b/express-zod-api/src/logical-container.ts index 07b0438836..5880113711 100644 --- a/express-zod-api/src/logical-container.ts +++ b/express-zod-api/src/logical-container.ts @@ -1,5 +1,5 @@ import * as R from "ramda"; -import { combinations, isObject } from "./common-helpers.ts"; +import { combinations, isObject } from "./common-helpers"; type LogicalOr = { or: T[] }; type LogicalAnd = { and: T[] }; diff --git a/express-zod-api/src/middleware.ts b/express-zod-api/src/middleware.ts index e620344628..47035c4149 100644 --- a/express-zod-api/src/middleware.ts +++ b/express-zod-api/src/middleware.ts @@ -1,11 +1,11 @@ import { NextFunction, Request, Response } from "express"; import { z } from "zod"; -import { emptySchema, FlatObject } from "./common-helpers.ts"; -import { InputValidationError } from "./errors.ts"; -import { IOSchema } from "./io-schema.ts"; -import { LogicalContainer } from "./logical-container.ts"; -import { Security } from "./security.ts"; -import { ActualLogger } from "./logger-helpers.ts"; +import { emptySchema, FlatObject } from "./common-helpers"; +import { InputValidationError } from "./errors"; +import { IOSchema } from "./io-schema"; +import { LogicalContainer } from "./logical-container"; +import { Security } from "./security"; +import { ActualLogger } from "./logger-helpers"; type Handler = (params: { /** @desc The inputs from the enabled input sources validated against the input schema of the Middleware */ diff --git a/express-zod-api/src/peer-helpers.ts b/express-zod-api/src/peer-helpers.ts index 254377befe..952e10592b 100644 --- a/express-zod-api/src/peer-helpers.ts +++ b/express-zod-api/src/peer-helpers.ts @@ -1,4 +1,4 @@ -import { MissingPeerError } from "./errors.ts"; +import { MissingPeerError } from "./errors"; export const loadPeer = async ( moduleName: string, diff --git a/express-zod-api/src/proprietary-schemas.ts b/express-zod-api/src/proprietary-schemas.ts index e710b4de5c..c6c740746a 100644 --- a/express-zod-api/src/proprietary-schemas.ts +++ b/express-zod-api/src/proprietary-schemas.ts @@ -1,9 +1,9 @@ -import { buffer, type ezBufferBrand } from "./buffer-schema.ts"; -import { dateIn, type ezDateInBrand } from "./date-in-schema.ts"; -import { dateOut, type ezDateOutBrand } from "./date-out-schema.ts"; -import { form, type ezFormBrand } from "./form-schema.ts"; -import { raw, type ezRawBrand } from "./raw-schema.ts"; -import { upload, type ezUploadBrand } from "./upload-schema.ts"; +import { buffer, type ezBufferBrand } from "./buffer-schema"; +import { dateIn, type ezDateInBrand } from "./date-in-schema"; +import { dateOut, type ezDateOutBrand } from "./date-out-schema"; +import { form, type ezFormBrand } from "./form-schema"; +import { raw, type ezRawBrand } from "./raw-schema"; +import { upload, type ezUploadBrand } from "./upload-schema"; export const ez = { dateIn, dateOut, form, upload, raw, buffer }; diff --git a/express-zod-api/src/raw-schema.ts b/express-zod-api/src/raw-schema.ts index 0ca1a9af87..d779b85b81 100644 --- a/express-zod-api/src/raw-schema.ts +++ b/express-zod-api/src/raw-schema.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { buffer } from "./buffer-schema.ts"; +import { buffer } from "./buffer-schema"; export const ezRawBrand = Symbol("Raw"); diff --git a/express-zod-api/src/result-handler.ts b/express-zod-api/src/result-handler.ts index a41cf18b87..e788af6425 100644 --- a/express-zod-api/src/result-handler.ts +++ b/express-zod-api/src/result-handler.ts @@ -4,11 +4,11 @@ import { ApiResponse, defaultStatusCodes, NormalizedResponse, -} from "./api-response.ts"; -import { FlatObject, isObject } from "./common-helpers.ts"; -import { contentTypes } from "./content-type.ts"; -import { IOSchema } from "./io-schema.ts"; -import { ActualLogger } from "./logger-helpers.ts"; +} from "./api-response"; +import { FlatObject, isObject } from "./common-helpers"; +import { contentTypes } from "./content-type"; +import { IOSchema } from "./io-schema"; +import { ActualLogger } from "./logger-helpers"; import { DiscriminatedResult, ensureHttpError, @@ -16,7 +16,7 @@ import { logServerError, normalize, ResultSchema, -} from "./result-helpers.ts"; +} from "./result-helpers"; type Handler = ( params: DiscriminatedResult & { diff --git a/express-zod-api/src/result-helpers.ts b/express-zod-api/src/result-helpers.ts index ba31af0160..0f7cd11627 100644 --- a/express-zod-api/src/result-helpers.ts +++ b/express-zod-api/src/result-helpers.ts @@ -2,16 +2,16 @@ import { Request } from "express"; import createHttpError, { HttpError, isHttpError } from "http-errors"; import * as R from "ramda"; import { globalRegistry, z } from "zod"; -import { NormalizedResponse, ResponseVariant } from "./api-response.ts"; +import { NormalizedResponse, ResponseVariant } from "./api-response"; import { combinations, FlatObject, getMessageFromError, isProduction, -} from "./common-helpers.ts"; -import { InputValidationError, ResultHandlerError } from "./errors.ts"; -import { ActualLogger } from "./logger-helpers.ts"; -import type { LazyResult, Result } from "./result-handler.ts"; +} from "./common-helpers"; +import { InputValidationError, ResultHandlerError } from "./errors"; +import { ActualLogger } from "./logger-helpers"; +import type { LazyResult, Result } from "./result-handler"; export type ResultSchema = R extends Result ? S : never; diff --git a/express-zod-api/src/routable.ts b/express-zod-api/src/routable.ts index 8800157df7..707645af7d 100644 --- a/express-zod-api/src/routable.ts +++ b/express-zod-api/src/routable.ts @@ -1,4 +1,4 @@ -import { Routing } from "./routing.ts"; +import { Routing } from "./routing"; export abstract class Routable { /** @desc Marks the route as deprecated (makes a copy of the endpoint) */ diff --git a/express-zod-api/src/routing-walker.ts b/express-zod-api/src/routing-walker.ts index 906f93721f..a4313a30fb 100644 --- a/express-zod-api/src/routing-walker.ts +++ b/express-zod-api/src/routing-walker.ts @@ -1,9 +1,9 @@ -import { DependsOnMethod } from "./depends-on-method.ts"; -import { AbstractEndpoint } from "./endpoint.ts"; -import { RoutingError } from "./errors.ts"; -import { ClientMethod, isMethod, Method } from "./method.ts"; -import { Routing } from "./routing.ts"; -import { ServeStatic, StaticHandler } from "./serve-static.ts"; +import { DependsOnMethod } from "./depends-on-method"; +import { AbstractEndpoint } from "./endpoint"; +import { RoutingError } from "./errors"; +import { ClientMethod, isMethod, Method } from "./method"; +import { Routing } from "./routing"; +import { ServeStatic, StaticHandler } from "./serve-static"; export type OnEndpoint = ( method: M, diff --git a/express-zod-api/src/routing.ts b/express-zod-api/src/routing.ts index 6c85de88c7..360d53b4d1 100644 --- a/express-zod-api/src/routing.ts +++ b/express-zod-api/src/routing.ts @@ -1,15 +1,15 @@ import { IRouter, RequestHandler } from "express"; import createHttpError from "http-errors"; -import { isProduction } from "./common-helpers.ts"; -import { CommonConfig } from "./config-type.ts"; -import { ContentType } from "./content-type.ts"; -import { DependsOnMethod } from "./depends-on-method.ts"; -import { Diagnostics } from "./diagnostics.ts"; -import { AbstractEndpoint } from "./endpoint.ts"; -import { CORSMethod, isMethod } from "./method.ts"; -import { OnEndpoint, walkRouting } from "./routing-walker.ts"; -import { ServeStatic } from "./serve-static.ts"; -import { GetLogger } from "./server-helpers.ts"; +import { isProduction } from "./common-helpers"; +import { CommonConfig } from "./config-type"; +import { ContentType } from "./content-type"; +import { DependsOnMethod } from "./depends-on-method"; +import { Diagnostics } from "./diagnostics"; +import { AbstractEndpoint } from "./endpoint"; +import { CORSMethod, isMethod } from "./method"; +import { OnEndpoint, walkRouting } from "./routing-walker"; +import { ServeStatic } from "./serve-static"; +import { GetLogger } from "./server-helpers"; import * as R from "ramda"; /** diff --git a/express-zod-api/src/schema-walker.ts b/express-zod-api/src/schema-walker.ts index 0cce7e5fd4..be458eb19d 100644 --- a/express-zod-api/src/schema-walker.ts +++ b/express-zod-api/src/schema-walker.ts @@ -1,4 +1,4 @@ -import type { EmptyObject, FlatObject } from "./common-helpers.ts"; +import type { EmptyObject, FlatObject } from "./common-helpers"; import { getBrand } from "@express-zod-api/zod-plugin"; import type { z } from "zod"; diff --git a/express-zod-api/src/server-helpers.ts b/express-zod-api/src/server-helpers.ts index 1db70773c3..4989c866f1 100644 --- a/express-zod-api/src/server-helpers.ts +++ b/express-zod-api/src/server-helpers.ts @@ -1,14 +1,14 @@ import type fileUpload from "express-fileupload"; -import { loadPeer } from "./peer-helpers.ts"; -import { AbstractResultHandler } from "./result-handler.ts"; -import { ActualLogger } from "./logger-helpers.ts"; -import { CommonConfig, ServerConfig } from "./config-type.ts"; +import { loadPeer } from "./peer-helpers"; +import { AbstractResultHandler } from "./result-handler"; +import { ActualLogger } from "./logger-helpers"; +import { CommonConfig, ServerConfig } from "./config-type"; import { ErrorRequestHandler, RequestHandler, Request } from "express"; import createHttpError from "http-errors"; -import { lastResortHandler } from "./last-resort.ts"; -import { ResultHandlerError } from "./errors.ts"; -import { ensureError } from "./common-helpers.ts"; -import { monitor } from "./graceful-shutdown.ts"; +import { lastResortHandler } from "./last-resort"; +import { ResultHandlerError } from "./errors"; +import { ensureError } from "./common-helpers"; +import { monitor } from "./graceful-shutdown"; // eslint-disable-next-line no-restricted-syntax -- substituted by TSDOWN export const localsID = Symbol.for(process.env.TSDOWN_SELF!); diff --git a/express-zod-api/src/server.ts b/express-zod-api/src/server.ts index 97ef3cf223..76ad38959d 100644 --- a/express-zod-api/src/server.ts +++ b/express-zod-api/src/server.ts @@ -2,17 +2,17 @@ import express from "express"; import type compression from "compression"; import http from "node:http"; import https from "node:https"; -import { BuiltinLogger } from "./builtin-logger.ts"; +import { BuiltinLogger } from "./builtin-logger"; import { AppConfig, CommonConfig, HttpConfig, ServerConfig, -} from "./config-type.ts"; -import { isLoggerInstance } from "./logger-helpers.ts"; -import { loadPeer } from "./peer-helpers.ts"; -import { defaultResultHandler } from "./result-handler.ts"; -import { Parsers, Routing, initRouting } from "./routing.ts"; +} from "./config-type"; +import { isLoggerInstance } from "./logger-helpers"; +import { loadPeer } from "./peer-helpers"; +import { defaultResultHandler } from "./result-handler"; +import { Parsers, Routing, initRouting } from "./routing"; import { createLoggingMiddleware, createNotFoundHandler, @@ -22,8 +22,8 @@ import { installDeprecationListener, moveRaw, installTerminationListener, -} from "./server-helpers.ts"; -import { printStartupLogo } from "./startup-logo.ts"; +} from "./server-helpers"; +import { printStartupLogo } from "./startup-logo"; const makeCommonEntities = (config: CommonConfig) => { if (config.startupLogo !== false) printStartupLogo(process.stdout); diff --git a/express-zod-api/src/sse.ts b/express-zod-api/src/sse.ts index ab067bf5da..273e12fc0b 100644 --- a/express-zod-api/src/sse.ts +++ b/express-zod-api/src/sse.ts @@ -1,15 +1,15 @@ import { Response } from "express"; import { z } from "zod"; -import { FlatObject } from "./common-helpers.ts"; -import { contentTypes } from "./content-type.ts"; -import { EndpointsFactory } from "./endpoints-factory.ts"; -import { Middleware } from "./middleware.ts"; -import { ResultHandler } from "./result-handler.ts"; +import { FlatObject } from "./common-helpers"; +import { contentTypes } from "./content-type"; +import { EndpointsFactory } from "./endpoints-factory"; +import { Middleware } from "./middleware"; +import { ResultHandler } from "./result-handler"; import { ensureHttpError, getPublicErrorMessage, logServerError, -} from "./result-helpers.ts"; +} from "./result-helpers"; type EventsMap = Record; diff --git a/express-zod-api/src/testing.ts b/express-zod-api/src/testing.ts index 6ca2177a37..dc161ea7cd 100644 --- a/express-zod-api/src/testing.ts +++ b/express-zod-api/src/testing.ts @@ -1,22 +1,22 @@ import { Request, Response } from "express"; -import { ensureError, FlatObject, getInput } from "./common-helpers.ts"; -import { CommonConfig } from "./config-type.ts"; -import { AbstractEndpoint } from "./endpoint.ts"; +import { ensureError, FlatObject, getInput } from "./common-helpers"; +import { CommonConfig } from "./config-type"; +import { AbstractEndpoint } from "./endpoint"; import { AbstractLogger, ActualLogger, isSeverity, Severity, -} from "./logger-helpers.ts"; -import { contentTypes } from "./content-type.ts"; +} from "./logger-helpers"; +import { contentTypes } from "./content-type"; import { createRequest, RequestOptions, createResponse, ResponseOptions, } from "node-mocks-http"; -import { AbstractMiddleware } from "./middleware.ts"; -import { defaultResultHandler } from "./result-handler.ts"; +import { AbstractMiddleware } from "./middleware"; +import { defaultResultHandler } from "./result-handler"; export const makeRequestMock = (props?: REQ) => createRequest({ diff --git a/express-zod-api/src/zts-helpers.ts b/express-zod-api/src/zts-helpers.ts index 9db9a7f234..484c68fb0f 100644 --- a/express-zod-api/src/zts-helpers.ts +++ b/express-zod-api/src/zts-helpers.ts @@ -1,6 +1,6 @@ import type ts from "typescript"; -import { FlatObject } from "./common-helpers.ts"; -import { SchemaHandler } from "./schema-walker.ts"; +import { FlatObject } from "./common-helpers"; +import { SchemaHandler } from "./schema-walker"; export interface ZTSContext extends FlatObject { isResponse: boolean; diff --git a/express-zod-api/src/zts.ts b/express-zod-api/src/zts.ts index b860ae38e1..681920a2e6 100644 --- a/express-zod-api/src/zts.ts +++ b/express-zod-api/src/zts.ts @@ -1,21 +1,21 @@ import * as R from "ramda"; import ts from "typescript"; import { globalRegistry, z } from "zod"; -import { ezBufferBrand } from "./buffer-schema.ts"; -import { getTransformedType, isSchema } from "./common-helpers.ts"; -import { ezDateInBrand } from "./date-in-schema.ts"; -import { ezDateOutBrand } from "./date-out-schema.ts"; -import { hasCycle } from "./deep-checks.ts"; -import { ProprietaryBrand } from "./proprietary-schemas.ts"; -import { ezRawBrand, RawSchema } from "./raw-schema.ts"; -import { FirstPartyKind, HandlingRules, walkSchema } from "./schema-walker.ts"; +import { ezBufferBrand } from "./buffer-schema"; +import { getTransformedType, isSchema } from "./common-helpers"; +import { ezDateInBrand } from "./date-in-schema"; +import { ezDateOutBrand } from "./date-out-schema"; +import { hasCycle } from "./deep-checks"; +import { ProprietaryBrand } from "./proprietary-schemas"; +import { ezRawBrand, RawSchema } from "./raw-schema"; +import { FirstPartyKind, HandlingRules, walkSchema } from "./schema-walker"; import { ensureTypeNode, makeInterfaceProp, makeLiteralType, makeUnion, -} from "./typescript-api.ts"; -import { Producer, ZTSContext } from "./zts-helpers.ts"; +} from "./typescript-api"; +import { Producer, ZTSContext } from "./zts-helpers"; const { factory: f } = ts; diff --git a/express-zod-api/tests/api-response.spec.ts b/express-zod-api/tests/api-response.spec.ts index 573bb423de..f619c2f9d0 100644 --- a/express-zod-api/tests/api-response.spec.ts +++ b/express-zod-api/tests/api-response.spec.ts @@ -1,4 +1,4 @@ -import { defaultStatusCodes, responseVariants } from "../src/api-response.ts"; +import { defaultStatusCodes, responseVariants } from "../src/api-response"; describe("ApiResponse", () => { describe("defaultStatusCodes", () => { diff --git a/express-zod-api/tests/buffer-schema.spec.ts b/express-zod-api/tests/buffer-schema.spec.ts index 10e3b09938..cdb8bcaf93 100644 --- a/express-zod-api/tests/buffer-schema.spec.ts +++ b/express-zod-api/tests/buffer-schema.spec.ts @@ -1,6 +1,6 @@ import { readFile } from "node:fs/promises"; import { z, $brand } from "zod"; -import { ez } from "../src/index.ts"; +import { ez } from "../src"; describe("ez.buffer()", () => { describe("creation", () => { diff --git a/express-zod-api/tests/builtin-logger.spec.ts b/express-zod-api/tests/builtin-logger.spec.ts index bb34e1d520..92a7b8520d 100644 --- a/express-zod-api/tests/builtin-logger.spec.ts +++ b/express-zod-api/tests/builtin-logger.spec.ts @@ -1,5 +1,5 @@ import { performance } from "node:perf_hooks"; -import { BuiltinLogger, BuiltinLoggerConfig } from "../src/builtin-logger.ts"; +import { BuiltinLogger, BuiltinLoggerConfig } from "../src/builtin-logger"; describe("BuiltinLogger", () => { beforeEach(() => { diff --git a/express-zod-api/tests/common-helpers.spec.ts b/express-zod-api/tests/common-helpers.spec.ts index 15061b97c0..6dc939c0ab 100644 --- a/express-zod-api/tests/common-helpers.spec.ts +++ b/express-zod-api/tests/common-helpers.spec.ts @@ -12,11 +12,11 @@ import { emptySchema, EmptySchema, EmptyObject, -} from "../src/common-helpers.ts"; +} from "../src/common-helpers"; import { z } from "zod"; -import { makeRequestMock } from "../src/testing.ts"; -import { methods } from "../src/method.ts"; -import { CommonConfig, InputSources } from "../src/config-type.ts"; +import { makeRequestMock } from "../src/testing"; +import { methods } from "../src/method"; +import { CommonConfig, InputSources } from "../src/config-type"; describe("Common Helpers", () => { describe("emptySchema", () => { diff --git a/express-zod-api/tests/config-type.spec.ts b/express-zod-api/tests/config-type.spec.ts index 6dd62d4677..ed45f6d90c 100644 --- a/express-zod-api/tests/config-type.spec.ts +++ b/express-zod-api/tests/config-type.spec.ts @@ -1,5 +1,5 @@ import { Express, IRouter } from "express"; -import { createConfig } from "../src/index.ts"; +import { createConfig } from "../src"; describe("ConfigType", () => { describe("createConfig()", () => { diff --git a/express-zod-api/tests/content-type.spec.ts b/express-zod-api/tests/content-type.spec.ts index f379e862e2..3e7415c1e5 100644 --- a/express-zod-api/tests/content-type.spec.ts +++ b/express-zod-api/tests/content-type.spec.ts @@ -1,4 +1,4 @@ -import { contentTypes } from "../src/content-type.ts"; +import { contentTypes } from "../src/content-type"; describe("contentTypes", () => { test("should has predefined properties", () => { diff --git a/express-zod-api/tests/date-in-schema.spec.ts b/express-zod-api/tests/date-in-schema.spec.ts index 7bb64e2f9a..57d0d8dac4 100644 --- a/express-zod-api/tests/date-in-schema.spec.ts +++ b/express-zod-api/tests/date-in-schema.spec.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { ezDateInBrand } from "../src/date-in-schema.ts"; -import { ez } from "../src/index.ts"; +import { ezDateInBrand } from "../src/date-in-schema"; +import { ez } from "../src"; import { getBrand } from "@express-zod-api/zod-plugin"; describe("ez.dateIn()", () => { diff --git a/express-zod-api/tests/date-out-schema.spec.ts b/express-zod-api/tests/date-out-schema.spec.ts index 85f7223443..fab72dc78f 100644 --- a/express-zod-api/tests/date-out-schema.spec.ts +++ b/express-zod-api/tests/date-out-schema.spec.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { ezDateOutBrand } from "../src/date-out-schema.ts"; -import { ez } from "../src/index.ts"; +import { ezDateOutBrand } from "../src/date-out-schema"; +import { ez } from "../src"; import { getBrand } from "@express-zod-api/zod-plugin"; describe("ez.dateOut()", () => { diff --git a/express-zod-api/tests/deep-checks.spec.ts b/express-zod-api/tests/deep-checks.spec.ts index 19d3f9ed6a..8308daf0b1 100644 --- a/express-zod-api/tests/deep-checks.spec.ts +++ b/express-zod-api/tests/deep-checks.spec.ts @@ -1,9 +1,9 @@ import { UploadedFile } from "express-fileupload"; import { z } from "zod"; -import { ez } from "../src/index.ts"; -import { findNestedSchema, hasCycle } from "../src/deep-checks.ts"; +import { ez } from "../src"; +import { findNestedSchema, hasCycle } from "../src/deep-checks"; import { getBrand } from "@express-zod-api/zod-plugin"; -import { ezUploadBrand } from "../src/upload-schema.ts"; +import { ezUploadBrand } from "../src/upload-schema"; describe("Checks", () => { describe("findNestedSchema()", () => { diff --git a/express-zod-api/tests/depends-on-method.spec.ts b/express-zod-api/tests/depends-on-method.spec.ts index 6eb6c8d69b..0b1f862a7a 100644 --- a/express-zod-api/tests/depends-on-method.spec.ts +++ b/express-zod-api/tests/depends-on-method.spec.ts @@ -3,8 +3,8 @@ import { DependsOnMethod, EndpointsFactory, defaultResultHandler, -} from "../src/index.ts"; -import { AbstractEndpoint } from "../src/endpoint.ts"; +} from "../src"; +import { AbstractEndpoint } from "../src/endpoint"; describe("DependsOnMethod", () => { test("should accept empty object", () => { diff --git a/express-zod-api/tests/documentation-helpers.spec.ts b/express-zod-api/tests/documentation-helpers.spec.ts index 6806914483..9f5d45d373 100644 --- a/express-zod-api/tests/documentation-helpers.spec.ts +++ b/express-zod-api/tests/documentation-helpers.spec.ts @@ -1,7 +1,7 @@ import { SchemaObject } from "openapi3-ts/oas31"; import * as R from "ramda"; import { z } from "zod"; -import { ez } from "../src/index.ts"; +import { ez } from "../src"; import { OpenAPIContext, depictRequestParams, @@ -25,7 +25,7 @@ import { depictDateOut, depictBody, depictRequest, -} from "../src/documentation-helpers.ts"; +} from "../src/documentation-helpers"; describe("Documentation helpers", () => { const makeRefMock = vi.fn(); diff --git a/express-zod-api/tests/documentation.spec.ts b/express-zod-api/tests/documentation.spec.ts index d33cb97104..09c8caf1f6 100644 --- a/express-zod-api/tests/documentation.spec.ts +++ b/express-zod-api/tests/documentation.spec.ts @@ -11,10 +11,10 @@ import { ResultHandler, Depicter, Method, -} from "../src/index.ts"; -import { contentTypes } from "../src/content-type.ts"; +} from "../src"; +import { contentTypes } from "../src/content-type"; import { z } from "zod"; -import { givePort } from "../../tools/ports.ts"; +import { givePort } from "../../tools/ports"; import * as R from "ramda"; describe("Documentation", () => { diff --git a/express-zod-api/tests/endpoint.spec.ts b/express-zod-api/tests/endpoint.spec.ts index 99252021e5..18488e110b 100644 --- a/express-zod-api/tests/endpoint.spec.ts +++ b/express-zod-api/tests/endpoint.spec.ts @@ -7,8 +7,8 @@ import { ez, testEndpoint, ResultHandler, -} from "../src/index.ts"; -import { Endpoint } from "../src/endpoint.ts"; +} from "../src"; +import { Endpoint } from "../src/endpoint"; describe("Endpoint", () => { describe(".methods", () => { diff --git a/express-zod-api/tests/endpoints-factory.spec.ts b/express-zod-api/tests/endpoints-factory.spec.ts index 27b12ecb03..0b7b8f9536 100644 --- a/express-zod-api/tests/endpoints-factory.spec.ts +++ b/express-zod-api/tests/endpoints-factory.spec.ts @@ -7,9 +7,9 @@ import { defaultEndpointsFactory, ResultHandler, testMiddleware, -} from "../src/index.ts"; -import { EmptyObject } from "../src/common-helpers.ts"; -import { Endpoint } from "../src/endpoint.ts"; +} from "../src"; +import { EmptyObject } from "../src/common-helpers"; +import { Endpoint } from "../src/endpoint"; import { z } from "zod"; describe("EndpointsFactory", () => { diff --git a/express-zod-api/tests/errors.spec.ts b/express-zod-api/tests/errors.spec.ts index 1bb94b2502..1f7f911a92 100644 --- a/express-zod-api/tests/errors.spec.ts +++ b/express-zod-api/tests/errors.spec.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { DocumentationError, RoutingError } from "../src/index.ts"; +import { DocumentationError, RoutingError } from "../src"; import { IOSchemaError, InputValidationError, @@ -7,7 +7,7 @@ import { OutputValidationError, ResultHandlerError, DeepCheckError, -} from "../src/errors.ts"; +} from "../src/errors"; describe("Errors", () => { const zodError = new z.ZodError([ diff --git a/express-zod-api/tests/form-schema.spec.ts b/express-zod-api/tests/form-schema.spec.ts index 4a7897b28a..fe4ac34fbd 100644 --- a/express-zod-api/tests/form-schema.spec.ts +++ b/express-zod-api/tests/form-schema.spec.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { ez } from "../src/index.ts"; -import { ezFormBrand } from "../src/form-schema.ts"; +import { ez } from "../src"; +import { ezFormBrand } from "../src/form-schema"; import { getBrand } from "@express-zod-api/zod-plugin"; describe("ez.form()", () => { diff --git a/express-zod-api/tests/graceful-helpers.spec.ts b/express-zod-api/tests/graceful-helpers.spec.ts index f7db985eca..c75cbba955 100644 --- a/express-zod-api/tests/graceful-helpers.spec.ts +++ b/express-zod-api/tests/graceful-helpers.spec.ts @@ -4,9 +4,9 @@ import { closeAsync, weAreClosed, isEncrypted, -} from "../src/graceful-helpers.ts"; +} from "../src/graceful-helpers"; import http from "node:http"; -import { makeRequestMock } from "../src/testing.ts"; +import { makeRequestMock } from "../src/testing"; import { Socket } from "node:net"; describe("Graceful helpers", () => { diff --git a/express-zod-api/tests/graceful-shutdown.spec.ts b/express-zod-api/tests/graceful-shutdown.spec.ts index d24b31a0db..e8824f2a9c 100644 --- a/express-zod-api/tests/graceful-shutdown.spec.ts +++ b/express-zod-api/tests/graceful-shutdown.spec.ts @@ -3,9 +3,9 @@ import http from "node:http"; import https from "node:https"; import { Agent, fetch } from "undici"; import { setTimeout } from "node:timers/promises"; -import { monitor } from "../src/graceful-shutdown.ts"; -import { givePort } from "../../tools/ports.ts"; -import { signCert } from "./ssl-helpers.ts"; +import { monitor } from "../src/graceful-shutdown"; +import { givePort } from "../../tools/ports"; +import { signCert } from "./ssl-helpers"; describe("monitor()", () => { const makeHttpServer = (handler: http.RequestListener) => diff --git a/express-zod-api/tests/index.spec.ts b/express-zod-api/tests/index.spec.ts index c27db2249e..0ebd4cba06 100644 --- a/express-zod-api/tests/index.spec.ts +++ b/express-zod-api/tests/index.spec.ts @@ -1,7 +1,7 @@ import { IRouter } from "express"; import ts from "typescript"; import { z } from "zod"; -import * as entrypoint from "../src/index.ts"; +import * as entrypoint from "../src"; import { ApiResponse, AppConfig, @@ -21,7 +21,7 @@ import { Producer, Routing, ServerConfig, -} from "../src/index.ts"; +} from "../src"; describe("Index Entrypoint", () => { describe("exports", () => { diff --git a/express-zod-api/tests/integration.spec.ts b/express-zod-api/tests/integration.spec.ts index dcc267e8ec..eb44ed47c3 100644 --- a/express-zod-api/tests/integration.spec.ts +++ b/express-zod-api/tests/integration.spec.ts @@ -6,7 +6,7 @@ import { Producer, defaultEndpointsFactory, ResultHandler, -} from "../src/index.ts"; +} from "../src"; describe("Integration", () => { const recursive1: z.ZodType = z.lazy(() => diff --git a/express-zod-api/tests/io-schema.spec.ts b/express-zod-api/tests/io-schema.spec.ts index ed68a59191..dde7e5600b 100644 --- a/express-zod-api/tests/io-schema.spec.ts +++ b/express-zod-api/tests/io-schema.spec.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { IOSchema, ez } from "../src/index.ts"; -import { makeFinalInputSchema, ensureExtension } from "../src/io-schema.ts"; +import { IOSchema, ez } from "../src"; +import { makeFinalInputSchema, ensureExtension } from "../src/io-schema"; describe("I/O Schema and related helpers", () => { describe("IOSchema", () => { diff --git a/express-zod-api/tests/json-schema-helpers.spec.ts b/express-zod-api/tests/json-schema-helpers.spec.ts index 10aa00ba60..2821dc9d2c 100644 --- a/express-zod-api/tests/json-schema-helpers.spec.ts +++ b/express-zod-api/tests/json-schema-helpers.spec.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { flattenIO } from "../src/json-schema-helpers.ts"; +import { flattenIO } from "../src/json-schema-helpers"; describe("JSON Schema helpers", () => { describe("flattenIO()", () => { diff --git a/express-zod-api/tests/last-resort.spec.ts b/express-zod-api/tests/last-resort.spec.ts index 5ce53f3d6e..5057b27f16 100644 --- a/express-zod-api/tests/last-resort.spec.ts +++ b/express-zod-api/tests/last-resort.spec.ts @@ -1,7 +1,7 @@ import createHttpError, { HttpError } from "http-errors"; -import { ResultHandlerError } from "../src/errors.ts"; -import { lastResortHandler } from "../src/last-resort.ts"; -import { makeLoggerMock, makeResponseMock } from "../src/testing.ts"; +import { ResultHandlerError } from "../src/errors"; +import { lastResortHandler } from "../src/last-resort"; +import { makeLoggerMock, makeResponseMock } from "../src/testing"; describe("Last Resort Handler", () => { test("should be a function", () => { diff --git a/express-zod-api/tests/logger-helpers.spec.ts b/express-zod-api/tests/logger-helpers.spec.ts index 889af56a94..4529f2cb56 100644 --- a/express-zod-api/tests/logger-helpers.spec.ts +++ b/express-zod-api/tests/logger-helpers.spec.ts @@ -1,5 +1,5 @@ -import { BuiltinLogger } from "../src/index.ts"; -import { BuiltinLoggerConfig } from "../src/builtin-logger.ts"; +import { BuiltinLogger } from "../src"; +import { BuiltinLoggerConfig } from "../src/builtin-logger"; import { AbstractLogger, isLoggerInstance, @@ -7,7 +7,7 @@ import { isHidden, makeNumberFormat, formatDuration, -} from "../src/logger-helpers.ts"; +} from "../src/logger-helpers"; describe("Logger helpers", () => { describe("isSeverity()", () => { diff --git a/express-zod-api/tests/logical-container.spec.ts b/express-zod-api/tests/logical-container.spec.ts index 01e50d2ca0..c39b1e6027 100644 --- a/express-zod-api/tests/logical-container.spec.ts +++ b/express-zod-api/tests/logical-container.spec.ts @@ -1,4 +1,4 @@ -import { processContainers } from "../src/logical-container.ts"; +import { processContainers } from "../src/logical-container"; describe("LogicalContainer", () => { describe("processContainers()", () => { diff --git a/express-zod-api/tests/method.spec.ts b/express-zod-api/tests/method.spec.ts index e100423567..7bab93da7a 100644 --- a/express-zod-api/tests/method.spec.ts +++ b/express-zod-api/tests/method.spec.ts @@ -7,7 +7,7 @@ import { ClientMethod, SomeMethod, CORSMethod, -} from "../src/method.ts"; +} from "../src/method"; describe("Method", () => { describe("SomeMethod type", () => { diff --git a/express-zod-api/tests/middleware.spec.ts b/express-zod-api/tests/middleware.spec.ts index f25b58d9dd..87b510ab5c 100644 --- a/express-zod-api/tests/middleware.spec.ts +++ b/express-zod-api/tests/middleware.spec.ts @@ -1,11 +1,11 @@ import { z } from "zod"; -import { InputValidationError, Middleware } from "../src/index.ts"; -import { AbstractMiddleware, ExpressMiddleware } from "../src/middleware.ts"; +import { InputValidationError, Middleware } from "../src"; +import { AbstractMiddleware, ExpressMiddleware } from "../src/middleware"; import { makeLoggerMock, makeRequestMock, makeResponseMock, -} from "../src/testing.ts"; +} from "../src/testing"; describe("Middleware", () => { describe("constructor()", () => { diff --git a/express-zod-api/tests/peer-helpers.spec.ts b/express-zod-api/tests/peer-helpers.spec.ts index ac5b5af5ed..11d6f87f07 100644 --- a/express-zod-api/tests/peer-helpers.spec.ts +++ b/express-zod-api/tests/peer-helpers.spec.ts @@ -1,5 +1,5 @@ -import { MissingPeerError } from "../src/index.ts"; -import { loadPeer } from "../src/peer-helpers.ts"; +import { MissingPeerError } from "../src"; +import { loadPeer } from "../src/peer-helpers"; describe("Peer loading helpers", () => { describe("loadPeer()", () => { diff --git a/express-zod-api/tests/raw-schema.spec.ts b/express-zod-api/tests/raw-schema.spec.ts index 547fced305..f0104ffad4 100644 --- a/express-zod-api/tests/raw-schema.spec.ts +++ b/express-zod-api/tests/raw-schema.spec.ts @@ -1,7 +1,7 @@ import { z } from "zod"; -import { ez } from "../src/index.ts"; +import { ez } from "../src"; import { getBrand } from "@express-zod-api/zod-plugin"; -import { ezRawBrand } from "../src/raw-schema.ts"; +import { ezRawBrand } from "../src/raw-schema"; describe("ez.raw()", () => { describe("creation", () => { diff --git a/express-zod-api/tests/result-handler.spec.ts b/express-zod-api/tests/result-handler.spec.ts index 7d9fa6802b..7fd87bb440 100644 --- a/express-zod-api/tests/result-handler.spec.ts +++ b/express-zod-api/tests/result-handler.spec.ts @@ -6,14 +6,14 @@ import { arrayResultHandler, defaultResultHandler, ResultHandler, -} from "../src/index.ts"; -import { ResultHandlerError } from "../src/errors.ts"; -import { AbstractResultHandler, Result } from "../src/result-handler.ts"; +} from "../src"; +import { ResultHandlerError } from "../src/errors"; +import { AbstractResultHandler, Result } from "../src/result-handler"; import { makeLoggerMock, makeRequestMock, makeResponseMock, -} from "../src/testing.ts"; +} from "../src/testing"; describe("ResultHandler", () => { describe("constructor()", () => { diff --git a/express-zod-api/tests/result-helpers.spec.ts b/express-zod-api/tests/result-helpers.spec.ts index 3837d8733f..50526c067d 100644 --- a/express-zod-api/tests/result-helpers.spec.ts +++ b/express-zod-api/tests/result-helpers.spec.ts @@ -1,14 +1,14 @@ import createHttpError from "http-errors"; import { z } from "zod"; -import { InputValidationError, OutputValidationError } from "../src/index.ts"; +import { InputValidationError, OutputValidationError } from "../src"; import { ensureHttpError, getPublicErrorMessage, logServerError, normalize, pullResponseExamples, -} from "../src/result-helpers.ts"; -import { makeLoggerMock, makeRequestMock } from "../src/testing.ts"; +} from "../src/result-helpers"; +import { makeLoggerMock, makeRequestMock } from "../src/testing"; describe("Result helpers", () => { describe("normalize()", () => { diff --git a/express-zod-api/tests/routable.spec.ts b/express-zod-api/tests/routable.spec.ts index 6573fff4df..ac14ac4570 100644 --- a/express-zod-api/tests/routable.spec.ts +++ b/express-zod-api/tests/routable.spec.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { defaultEndpointsFactory, DependsOnMethod } from "../src/index.ts"; +import { defaultEndpointsFactory, DependsOnMethod } from "../src"; const endpoint = defaultEndpointsFactory.build({ output: z.object({}), diff --git a/express-zod-api/tests/routing.spec.ts b/express-zod-api/tests/routing.spec.ts index 21ed597a13..a37574bada 100644 --- a/express-zod-api/tests/routing.spec.ts +++ b/express-zod-api/tests/routing.spec.ts @@ -3,7 +3,7 @@ import { expressMock, staticHandler, staticMock, -} from "./express-mock.ts"; +} from "./express-mock"; import { z } from "zod"; import { DependsOnMethod, @@ -12,13 +12,13 @@ import { ServeStatic, defaultResultHandler, ez, -} from "../src/index.ts"; +} from "../src"; import { makeLoggerMock, makeRequestMock, makeResponseMock, -} from "../src/testing.ts"; -import { createWrongMethodHandler, initRouting } from "../src/routing.ts"; +} from "../src/testing"; +import { createWrongMethodHandler, initRouting } from "../src/routing"; import type { IRouter, RequestHandler } from "express"; import createHttpError from "http-errors"; diff --git a/express-zod-api/tests/serve-static.spec.ts b/express-zod-api/tests/serve-static.spec.ts index 1b6bb18a49..bd75e24f0a 100644 --- a/express-zod-api/tests/serve-static.spec.ts +++ b/express-zod-api/tests/serve-static.spec.ts @@ -1,5 +1,5 @@ -import { staticMock, staticHandler } from "./express-mock.ts"; -import { ServeStatic } from "../src/index.ts"; +import { staticMock, staticHandler } from "./express-mock"; +import { ServeStatic } from "../src"; describe("ServeStatic", () => { describe("constructor()", () => { diff --git a/express-zod-api/tests/server-helpers.spec.ts b/express-zod-api/tests/server-helpers.spec.ts index 529e6f1039..4beda60abc 100644 --- a/express-zod-api/tests/server-helpers.spec.ts +++ b/express-zod-api/tests/server-helpers.spec.ts @@ -1,5 +1,5 @@ import { fail } from "node:assert/strict"; -import { fileUploadMock } from "./express-mock.ts"; +import { fileUploadMock } from "./express-mock"; import { createLoggingMiddleware, createNotFoundHandler, @@ -12,18 +12,14 @@ import { installDeprecationListener, installTerminationListener, localsID, -} from "../src/server-helpers.ts"; -import { - CommonConfig, - defaultResultHandler, - ResultHandler, -} from "../src/index.ts"; +} from "../src/server-helpers"; +import { CommonConfig, defaultResultHandler, ResultHandler } from "../src"; import { Request } from "express"; import { makeLoggerMock, makeRequestMock, makeResponseMock, -} from "../src/testing.ts"; +} from "../src/testing"; import createHttpError from "http-errors"; describe("Server helpers", () => { diff --git a/express-zod-api/tests/server.spec.ts b/express-zod-api/tests/server.spec.ts index 61d1d88a4b..72494eb662 100644 --- a/express-zod-api/tests/server.spec.ts +++ b/express-zod-api/tests/server.spec.ts @@ -1,5 +1,5 @@ -import { moveRaw } from "../src/server-helpers.ts"; -import { givePort } from "../../tools/ports.ts"; +import { moveRaw } from "../src/server-helpers"; +import { givePort } from "../../tools/ports"; import { appMock, compressionMock, @@ -7,12 +7,12 @@ import { expressUrlencodedMock, expressMock, expressRawMock, -} from "./express-mock.ts"; +} from "./express-mock"; import { createHttpsServerSpy, httpListenSpy, httpsListenSpy, -} from "./http-mock.ts"; +} from "./http-mock"; import { z } from "zod"; import { AppConfig, @@ -23,7 +23,7 @@ import { createServer, defaultResultHandler, ez, -} from "../src/index.ts"; +} from "../src"; import express from "express"; describe("Server", () => { diff --git a/express-zod-api/tests/sse.spec.ts b/express-zod-api/tests/sse.spec.ts index 5260defb11..b3d805212e 100644 --- a/express-zod-api/tests/sse.spec.ts +++ b/express-zod-api/tests/sse.spec.ts @@ -7,7 +7,7 @@ import { testMiddleware, EventStreamFactory, EndpointsFactory, -} from "../src/index.ts"; +} from "../src"; import { Emitter, ensureStream, @@ -15,13 +15,13 @@ import { makeEventSchema, makeMiddleware, makeResultHandler, -} from "../src/sse.ts"; +} from "../src/sse"; import { makeLoggerMock, makeRequestMock, makeResponseMock, -} from "../src/testing.ts"; -import { AbstractEndpoint } from "../src/endpoint.ts"; +} from "../src/testing"; +import { AbstractEndpoint } from "../src/endpoint"; describe("SSE", () => { describe("makeEventSchema()", () => { diff --git a/express-zod-api/tests/startup-logo.spec.ts b/express-zod-api/tests/startup-logo.spec.ts index 140c4b1a54..7c795ffc56 100644 --- a/express-zod-api/tests/startup-logo.spec.ts +++ b/express-zod-api/tests/startup-logo.spec.ts @@ -1,5 +1,5 @@ import { WriteStream } from "node:tty"; -import { printStartupLogo } from "../src/startup-logo.ts"; +import { printStartupLogo } from "../src/startup-logo"; describe("Startup logo", () => { describe("printStartupLogo()", () => { diff --git a/express-zod-api/tests/system.spec.ts b/express-zod-api/tests/system.spec.ts index 7b76d19edd..b53dd86e21 100644 --- a/express-zod-api/tests/system.spec.ts +++ b/express-zod-api/tests/system.spec.ts @@ -13,8 +13,8 @@ import { BuiltinLogger, Middleware, ez, -} from "../src/index.ts"; -import { givePort } from "../../tools/ports.ts"; +} from "../src"; +import { givePort } from "../../tools/ports"; import { setTimeout } from "node:timers/promises"; describe("App in production mode", async () => { diff --git a/express-zod-api/tests/testing.spec.ts b/express-zod-api/tests/testing.spec.ts index 65b9e48418..41e96b6ba8 100644 --- a/express-zod-api/tests/testing.spec.ts +++ b/express-zod-api/tests/testing.spec.ts @@ -6,7 +6,7 @@ import { ResultHandler, testEndpoint, testMiddleware, -} from "../src/index.ts"; +} from "../src"; import type { Mock } from "vitest"; describe("Testing", () => { diff --git a/express-zod-api/tests/upload-schema.spec.ts b/express-zod-api/tests/upload-schema.spec.ts index 2223cd22bb..d6c4f671ad 100644 --- a/express-zod-api/tests/upload-schema.spec.ts +++ b/express-zod-api/tests/upload-schema.spec.ts @@ -1,7 +1,7 @@ import { z } from "zod"; -import { ez } from "../src/index.ts"; +import { ez } from "../src"; import { getBrand } from "@express-zod-api/zod-plugin"; -import { ezUploadBrand } from "../src/upload-schema.ts"; +import { ezUploadBrand } from "../src/upload-schema"; describe("ez.upload()", () => { describe("creation", () => { diff --git a/express-zod-api/tests/zts.spec.ts b/express-zod-api/tests/zts.spec.ts index 63fa4bbc80..218aeab24a 100644 --- a/express-zod-api/tests/zts.spec.ts +++ b/express-zod-api/tests/zts.spec.ts @@ -1,9 +1,9 @@ import ts from "typescript"; import { z } from "zod"; -import { ez } from "../src/index.ts"; -import { f, printNode } from "../src/typescript-api.ts"; -import { zodToTs } from "../src/zts.ts"; -import { ZTSContext } from "../src/zts-helpers.ts"; +import { ez } from "../src"; +import { f, printNode } from "../src/typescript-api"; +import { zodToTs } from "../src/zts"; +import { ZTSContext } from "../src/zts-helpers"; describe("zod-to-ts", () => { const printNodeTest = (node: ts.Node) => diff --git a/express-zod-api/vitest.setup.ts b/express-zod-api/vitest.setup.ts index 68c6ecc4bc..c0bb84b39e 100644 --- a/express-zod-api/vitest.setup.ts +++ b/express-zod-api/vitest.setup.ts @@ -1,7 +1,7 @@ import { getBrand } from "@express-zod-api/zod-plugin"; import type { NewPlugin } from "@vitest/pretty-format"; import { z } from "zod"; -import { ResultHandlerError } from "./src/errors.ts"; +import { ResultHandlerError } from "./src/errors"; /** Takes cause and certain props of custom errors into account */ const errorSerializer: NewPlugin = { diff --git a/migration/index.spec.ts b/migration/index.spec.ts index ed36ad3237..be8662ee6b 100644 --- a/migration/index.spec.ts +++ b/migration/index.spec.ts @@ -1,6 +1,6 @@ import { RuleTester } from "@typescript-eslint/rule-tester"; import parser from "@typescript-eslint/parser"; -import manifest from "./package.json" with { type: "json" }; +import manifest from "./package.json"; RuleTester.afterAll = afterAll; RuleTester.describe = describe; @@ -12,7 +12,7 @@ const tester = new RuleTester({ describe("Migration", async () => { vi.stubEnv("TSDOWN_VERSION", manifest.version); - const { default: migration } = await import("./index.ts"); + const { default: migration } = await import("./"); const ruleName = `v${manifest.version.split(".")[0]}`; const theRule = migration.rules[ruleName as keyof typeof migration.rules]; diff --git a/tools/license.ts b/tools/license.ts index e264b388c0..857db55fd8 100644 --- a/tools/license.ts +++ b/tools/license.ts @@ -1,5 +1,5 @@ import { writeFile } from "node:fs/promises"; -import manifest from "../express-zod-api/package.json" with { type: "json" }; +import manifest from "../express-zod-api/package.json"; const text = ` MIT License diff --git a/tools/make-tests.ts b/tools/make-tests.ts index 99cbd8eb33..3a65a1d3af 100644 --- a/tools/make-tests.ts +++ b/tools/make-tests.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import { readFile, writeFile } from "node:fs/promises"; -import { givePort } from "./ports.ts"; +import { givePort } from "./ports"; const extractQuickStartFromReadme = async () => { const readme = await readFile("README.md", "utf-8"); @@ -16,7 +16,7 @@ const extractQuickStartFromReadme = async () => { const quickStart = await extractQuickStartFromReadme(); const program = ` -import { givePort } from "../tools/ports.ts"; +import { givePort } from "../tools/ports"; ${quickStart} `; diff --git a/tsconfig.json b/tsconfig.json index 82820a1270..111e60ef4a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,9 @@ { "extends": "@tsconfig/node20/tsconfig.json", "compilerOptions": { - "module": "node20", - "target": "es2023", + "module": "preserve", + "moduleResolution": "bundler", + "target": "esnext", "noEmit": true, "allowImportingTsExtensions": true, "noImplicitAny": true, diff --git a/zod-plugin/src/augmentation.ts b/zod-plugin/src/augmentation.ts index 9b3b79de19..2bd82ee972 100644 --- a/zod-plugin/src/augmentation.ts +++ b/zod-plugin/src/augmentation.ts @@ -1,5 +1,5 @@ import type { z } from "zod"; -import type { Intact, Remap } from "./remap.ts"; +import type { Intact, Remap } from "./remap"; declare module "zod/v4/core" { interface GlobalMeta { diff --git a/zod-plugin/src/brand.ts b/zod-plugin/src/brand.ts index 3ba85fdc43..ba72d325f4 100644 --- a/zod-plugin/src/brand.ts +++ b/zod-plugin/src/brand.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { pack, unpack } from "./packer.ts"; +import { pack, unpack } from "./packer"; /** The property within schema._zod.bag where we store the brand */ export const brandProperty = "brand" as const; diff --git a/zod-plugin/src/index.ts b/zod-plugin/src/index.ts index 26e46215cd..057940f970 100644 --- a/zod-plugin/src/index.ts +++ b/zod-plugin/src/index.ts @@ -1,3 +1,3 @@ -import "./runtime.ts"; // side effects here -export { pack, unpack } from "./packer.ts"; -export { getBrand } from "./brand.ts"; +import "./runtime"; // side effects here +export { pack, unpack } from "./packer"; +export { getBrand } from "./brand"; diff --git a/zod-plugin/src/runtime.ts b/zod-plugin/src/runtime.ts index 11dd57c64d..a568967763 100644 --- a/zod-plugin/src/runtime.ts +++ b/zod-plugin/src/runtime.ts @@ -1,6 +1,6 @@ import { globalRegistry, z } from "zod"; -import { setBrand } from "./brand.ts"; -import { remap } from "./remap.ts"; +import { setBrand } from "./brand"; +import { remap } from "./remap"; const exampleSetter = function (this: z.ZodType, value: z.output) { const examples = globalRegistry.get(this)?.examples?.slice() || []; diff --git a/zod-plugin/tests/brand.spec.ts b/zod-plugin/tests/brand.spec.ts index 123fd2d59d..362a97bf58 100644 --- a/zod-plugin/tests/brand.spec.ts +++ b/zod-plugin/tests/brand.spec.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -import { brandProperty, getBrand, setBrand } from "../src/brand.ts"; -import * as packer from "../src/packer.ts"; +import { brandProperty, getBrand, setBrand } from "../src/brand"; +import * as packer from "../src/packer"; describe("Brand", () => { describe("brandProperty", () => { diff --git a/zod-plugin/tests/index.spec.ts b/zod-plugin/tests/index.spec.ts index bb7ef7e4be..90bb50e9a4 100644 --- a/zod-plugin/tests/index.spec.ts +++ b/zod-plugin/tests/index.spec.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import * as entrypoint from "../src/index.ts"; +import * as entrypoint from "../src"; describe("Entrypoint", () => { test("Augmentation", () => { diff --git a/zod-plugin/tests/packer.spec.ts b/zod-plugin/tests/packer.spec.ts index 518762345b..0fce7ebcaf 100644 --- a/zod-plugin/tests/packer.spec.ts +++ b/zod-plugin/tests/packer.spec.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { pack, unpack } from "../src/index.ts"; +import { pack, unpack } from "../src"; describe("Packer", () => { describe("pack()", () => { diff --git a/zod-plugin/tests/runtime.spec.ts b/zod-plugin/tests/runtime.spec.ts index 4527702173..c6cca98817 100644 --- a/zod-plugin/tests/runtime.spec.ts +++ b/zod-plugin/tests/runtime.spec.ts @@ -1,6 +1,6 @@ import camelize from "camelize-ts"; import { z } from "zod"; -import { getBrand } from "../src/index.ts"; +import { getBrand } from "../src"; describe("Zod Runtime Plugin", () => { describe(".example()", () => { diff --git a/zod-plugin/vitest.setup.ts b/zod-plugin/vitest.setup.ts index cef815f1f2..7276f4cab6 100644 --- a/zod-plugin/vitest.setup.ts +++ b/zod-plugin/vitest.setup.ts @@ -1 +1 @@ -import "./src/runtime.ts"; +import "./src/runtime";