Skip to content

Version Packages#327

Open
github-actions[bot] wants to merge 1 commit intomainfrom
changeset-release/main
Open

Version Packages#327
github-actions[bot] wants to merge 1 commit intomainfrom
changeset-release/main

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Feb 26, 2026

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

chanfana@3.3.0

Minor Changes

  • #316 d30cc36 Thanks @G4brym! - Add customizable pagination and ordering parameter names to ListEndpoint via pageFieldName, perPageFieldName, orderByFieldName, and orderByDirectionFieldName class properties.

    Breaking change for subclasses overriding optionFields: optionFields is now a computed getter derived from the four *FieldName properties. Subclasses that previously overrode optionFields directly should instead override the individual field name properties.

  • #317 39c89d2 Thanks @G4brym! - Add validateResponse router option to validate and sanitize response bodies against their Zod schemas at runtime.

    When enabled, responses are parsed through z.object().parseAsync(), which strips unknown fields and validates required fields/types. This prevents accidental data leaks (e.g., internal fields like passwordHash reaching the client) and catches handler bugs where the response doesn't match the declared schema.

    const router = fromHono(app, { validateResponse: true });

    Behavior:

    • Plain object responses are validated against the 200 response schema
    • Response objects with application/json content are cloned, validated, and reconstructed with corrected headers
    • Non-JSON responses and responses without a matching Zod schema are passed through unchanged
    • Validation failures return 500 Internal Server Error (code 7013) and log the full error via console.error

    New exports:

    • ResponseValidationException — thrown when a handler's response doesn't match its declared schema (status 500, code 7013, isVisible: false)
  • #315 47d304a Thanks @G4brym! - Add SerializerContext parameter to auto endpoint serializer function, providing access to filters and options for context-aware serialization.

    The serializer signature changes from (obj: object) => object to (obj: object, context?: SerializerContext) => object. The SerializerContext type contains:

    • filtersArray<FilterCondition>: the active filter conditions for the current request
    • options — pagination and ordering options (page, per_page, order_by, order_by_direction)

    Context passed per endpoint type:

    Endpoint Context
    ListEndpoint / ReadEndpoint { filters, options }
    UpdateEndpoint / DeleteEndpoint { filters }
    CreateEndpoint { filters: [] }
    const meta = {
      model: {
        schema: UserSchema,
        primaryKeys: ["id"],
        tableName: "users",
        serializer: (obj: any, context?: SerializerContext) => {
          const hasRoleFilter = context?.filters?.some((f) => f.field === "role");
          // Conditionally include fields based on active filters
          return hasRoleFilter ? obj : omit(obj, ["role"]);
        },
      },
    };

    New exports:

    • SerializerContext — type for the serializer's second parameter

Patch Changes

  • #328 662ff72 Thanks @G4brym! - Include CHANGELOG.md in the npm package so AI agents and tools can read the project's change history. Also add a changelog page to the documentation site.

@github-actions github-actions bot requested a review from G4brym as a code owner February 26, 2026 22:59
@github-actions github-actions bot force-pushed the changeset-release/main branch 3 times, most recently from 8593f52 to 410a94e Compare February 27, 2026 11:07
@github-actions github-actions bot force-pushed the changeset-release/main branch from 410a94e to 55c81fb Compare February 27, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants