Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compat-test/quick-start.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down
2 changes: 1 addition & 1 deletion esm-test/quick-start.spec.ts
Original file line number Diff line number Diff line change
@@ -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 = "";
Expand Down
2 changes: 1 addition & 1 deletion example/config.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
2 changes: 1 addition & 1 deletion example/endpoints/create-user.ts
Original file line number Diff line number Diff line change
@@ -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+$/);

Expand Down
2 changes: 1 addition & 1 deletion example/endpoints/delete-user.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
2 changes: 1 addition & 1 deletion example/endpoints/list-users.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from "zod";
import { arrayRespondingFactory } from "../factories.ts";
import { arrayRespondingFactory } from "../factories";

const roleSchema = z.enum(["manager", "operator", "admin"]);

Expand Down
2 changes: 1 addition & 1 deletion example/endpoints/retrieve-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion example/endpoints/send-avatar.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
2 changes: 1 addition & 1 deletion example/endpoints/stream-avatar.ts
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion example/endpoints/time-subscription.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand Down
2 changes: 1 addition & 1 deletion example/endpoints/update-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion example/factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions example/generate-client.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 3 additions & 3 deletions example/generate-documentation.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions example/index.spec.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
4 changes: 2 additions & 2 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
22 changes: 11 additions & 11 deletions example/routing.ts
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions express-zod-api/src/builtin-logger.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
8 changes: 4 additions & 4 deletions express-zod-api/src/common-helpers.ts
Original file line number Diff line number Diff line change
@@ -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({});
Expand Down
12 changes: 6 additions & 6 deletions express-zod-api/src/config-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 9 additions & 9 deletions express-zod-api/src/deep-checks.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
6 changes: 3 additions & 3 deletions express-zod-api/src/depends-on-method.ts
Original file line number Diff line number Diff line change
@@ -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<typeof DependsOnMethod>[0];
Expand Down
14 changes: 7 additions & 7 deletions express-zod-api/src/diagnostics.ts
Original file line number Diff line number Diff line change
@@ -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<AbstractEndpoint>();
Expand Down
36 changes: 18 additions & 18 deletions express-zod-api/src/documentation-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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: (
Expand Down
20 changes: 10 additions & 10 deletions express-zod-api/src/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"
Expand Down
Loading