New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-zod-api

Package Overview
Dependencies
Maintainers
1
Versions
432
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-zod-api - npm Package Versions

1
44

22.0.0

Diff

Changelog

Source

v22.0.0

  • Minimum supported Node versions: 20.9.0 and 22.0.0:
    • Node 18 is no longer supported; its end of life is April 30, 2025.
  • BuiltinLogger::profile() behavior changed for picoseconds: expressing them through nanoseconds;
  • Feature: handling all (not just x- prefixed) headers as an input source (when enabled):
    • Behavior changed for headers inside inputSources config option: all headers are addressed to the input object;
    • This change is motivated by the deprecation of x- prefixed headers;
    • Since the order inside inputSources matters, consider moving headers to the first place to avoid overwrites;
    • The generated Documentation recognizes both x- prefixed inputs and well-known headers listed on IANA.ORG;
    • You can customize that behavior by using the new option isHeader of the Documentation::constructor().
  • The splitResponse property on the Integration::constructor() argument is removed;
  • Changes to the client code generated by Integration:
    • The class name changed from ExpressZodAPIClient to just Client;
    • The overload of the Client::provide() having 3 arguments and the Provider type are removed;
    • The public jsonEndpoints const is removed — use the content-type header of an actual response instead;
    • The public type MethodPath is removed — use the Request type instead.
  • The approach to tagging endpoints changed:
    • The tags property moved from the argument of createConfig() to Documentation::constructor();
    • The overload of EndpointsFactory::constructor() accepting config property is removed;
    • The argument of EventStreamFactory::constructor() is now the events map (formerly assigned to events property);
    • Tags should be declared as the keys of the augmented interface TagOverrides instead;
  • The public method Endpoint::getSecurity() now returns an array;
  • Consider the automated migration using the built-in ESLint rule.
// eslint.config.mjs — minimal ESLint 9 config to apply migrations automatically using "eslint --fix"
import parser from "@typescript-eslint/parser";
import migration from "express-zod-api/migration";

export default [
  { languageOptions: { parser }, plugins: { migration } },
  { files: ["**/*.ts"], rules: { "migration/v22": "error" } },
];
  createConfig({
-   tags: {},
    inputSources: {
-     get: ["query", "headers"] // if you have headers on last place
+     get: ["headers", "query"] // move headers to avoid overwrites
    }
  });

  new Documentation({
+   tags: {},
+   isHeader: (name, method, path) => {} // optional
  });

  new EndpointsFactory(
-   { config, resultHandler: new ResultHandler() }
+   new ResultHandler()
  );

  new EventStreamFactory(
-   { config, events: {} }
+   {} // events map only
  );
// new tagging approach
import { defaultEndpointsFactory, Documentation } from "express-zod-api";

// Add similar declaration once, somewhere in your code, preferably near config
declare module "express-zod-api" {
  interface TagOverrides {
    users: unknown;
    files: unknown;
    subscriptions: unknown;
  }
}

// Add extended description of the tags to Documentation (optional)
new Documentation({
  tags: {
    users: "All about users",
    files: { description: "All about files", url: "https://example.com" },
  },
});

Version 21

robintail
published 22.0.0-beta.5 •

robintail
published 21.11.1 •

Changelog

Source

v21.11.1

  • Common styling methods (coloring) are extracted from the built-in logger instance:
    • This measure is to reduce memory consumption when using a child logger.
robintail
published 22.0.0-beta.4 •

robintail
published 22.0.0-beta.3 •

robintail
published 21.11.0 •

Changelog

Source

v21.11.0

  • New public property ctx is available on instances of BuiltinLogger:
    • When using the built-in logger and childLoggerProvider config option, the ctx property contains the argument that was used for creating the child logger using its .child() method;
    • It can be utilized for accessing its requestId property for purposes other than logging;
    • The default value of ctx is an empty object (when the instance is not a child logger).
import { BuiltinLogger, createConfig, createMiddleware } from "express-zod-api";

// Declaring the logger type in use
declare module "express-zod-api" {
  interface LoggerOverrides extends BuiltinLogger {}
}

// Configuring child logger provider
const config = createConfig({
  childLoggerProvider: ({ parent }) =>
    parent.child({ requestId: randomUUID() }),
});

// Accessing child logger context
createMiddleware({
  handler: async ({ logger }) => {
    doSomething(logger.ctx.requestId); // <—
  },
});
robintail
published 21.10.0 •

Changelog

Source

v21.10.0

  • New Integration option: serverUrl, string, optional, the API URL for the generated client:
    • Currently used for generating example implementation;
    • Default value remains https://example.com;
  • Using new URL() for constructing the final request URL in the example implementation of the generated client:
    • That enables handling serverUrl both with and without trailing slash;
robintail
published 22.0.0-beta.2 •

robintail
published 22.0.0-beta.1 •

robintail
published 21.9.0 •

Changelog

Source

v21.9.0

  • Deprecating MethodPath type in the code generated by Integration:
    • Introducing the Request type to be used instead;
  • Added JSDoc having the request in description for every type and interface generated by Integration;
  • A couple adjustments for consistency and performance.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc