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

21.8.0

Diff

Changelog

Source

v21.8.0

  • Deprecating jsonEndpoints from the code generated by Integration:
    • Use the content-type header of an actual response instead, example.
robintail
published 21.7.0 •

Changelog

Source

v21.7.0

  • Feature: introducing EncodedResponse public interface in the code generated by Integration:
    • The new entity should enable making custom clients having response type awereness based on the status code;
    • The difference between Response and EndcodedResponse is the second hierarchical level.
import { EncodedResponse } from "./generated.ts";

type UsageExample = EncodedResponse["get /v1/user/retrieve"][200];
robintail
published 21.7.0-beta.1 •

robintail
published 21.6.1 •

Changelog

Source

v21.6.1

  • node-mocks-http version is ^1.16.2;
  • Fixed possible duplicates in the Path type generated by Integration:
    • Duplicates used to be possible when using DependsOnMethod instance within specified routing.
robintail
published 21.6.0 •

Changelog

Source

v21.6.0

  • Supporting the following z.string() formats by the Documentation generator:
    • base64 (as byte), date, time, duration, nanoid;
    • And new formats introduced by Zod 3.24: jwt, base64url, cidr;
  • Fixed missing minLength and maxLength properties when depicting z.string().length() (fixed length strings).
robintail
published 21.5.0 •

Changelog

Source

v21.5.0

  • Feat: Introducing Server-Sent Events:
    • Basic implementation of the event streams feature is now available using EventStreamFactory class;
    • The new factory is similar to EndpointsFactory including the middlewares support;
    • Client application can subscribe to the event stream using EventSource class instance;
    • Documentation and Integration do not have yet a special depiction of such endpoints;
    • This feature is a lightweight alternative to Zod Sockets.
import { z } from "zod";
import { EventStreamFactory } from "express-zod-api";
import { setTimeout } from "node:timers/promises";

const subscriptionEndpoint = EventStreamFactory({
  events: { time: z.number().int().positive() },
}).buildVoid({
  input: z.object({}), // optional input schema
  handler: async ({ options: { emit, isClosed } }) => {
    while (!isClosed()) {
      emit("time", Date.now());
      await setTimeout(1000);
    }
  },
});
const source = new EventSource("https://example.com/api/v1/time");
source.addEventListener("time", (event) => {
  const data = JSON.parse(event.data); // number
});
robintail
published 21.4.0 •

Changelog

Source

v21.4.0

  • Return type of public methods getTags() and getScopes() of Endpoint corrected to ReadyonlyArray<string>;
  • Featuring EndpointsFactory::buildVoid() method:
    • It's a shorthand for returning {} while having output schema z.object({});
    • When using this method, handler may return void while retaining the object-based operation internally.
- factory.build({
+ factory.buildVoid({
-   output: z.object({}),
    handler: async () => {
-     return {};
    },
  });
robintail
published 21.3.0 •

Changelog

Source

v21.3.0

  • Fixed provide() method usage example in the code of the generated client;
  • Always splitting the response in the generated client:
    • This will print the positive and negative response types separately;
    • The splitResponse property on the Integration class constructor argument is deprecated.
robintail
published 21.3.0-beta.0 •

robintail
published 21.2.0 •

Changelog

Source

v21.2.0

  • Minor performance adjustments;
  • Introducing stricter overload for the generated ExpressZodAPIClient::provide() method:
    • The method can now also accept two arguments: space-separated method with path and parameters;
    • Using this overload provides strict constraints on the first argument so that undeclared routes can not be used;
    • This design is inspired by the OctoKit and aims to prevent the misuse by throwing a Typescript error.
  • Using ExpressZodAPIClient::provide() with three arguments is deprecated:
    • The return type when using undeclared routes corrected to unknown.
  • The Provider type of the generated client is deprecated;
  • The type of the following generated client entities is corrected so that it became limited to the listed routes:
    • Input, Response, PositiveResponse, NegativeResponse, MethodPath.
- client.provide("get", "/v1/user/retrieve", { id: "10" }); // deprecated
+ client.provide("get /v1/user/retrieve", { id: "10" }); // featured
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