Skip to content

Releases: mathematic-inc/ts-japi

v1.12.3

11 Mar 05:09
e5a9738

Choose a tag to compare

ts-japi v1.12.3

ts-japi v1.12.3 ships a long-awaited correctness fix that brings the library into full compliance with the JSON:API spec — relator fields no longer leak into attributes — plus a Node.js 24 LTS upgrade that keeps the project on the latest and greatest runtime. It's a focused, high-quality release that makes your JSON:API responses cleaner with zero extra effort on your part.


🐛 Bug Fixes

Relator fields are now automatically excluded from attributes (#114, closes #77)

The JSON:API specification is clear: a field that is expressed as a relationship must not also appear as an attribute. Previously, if you defined a Relator for a field (e.g. articles on a User), that raw field value would still show up in the serialized attributes object — producing invalid output and causing headaches with compliant clients.

Starting in v1.12.3, ts-japi automatically excludes any field covered by a Relator from the default null projection. No configuration changes needed — it just works.

Before (broken output):

{
  "data": {
    "id": "1",
    "type": "User",
    "attributes": {
      "name": "Foo",
      "articles": [{ "id": "1", "title": "Article 1" }]
    },
    "relationships": {
      "Article": { "data": [{ "id": "1", "type": "Article" }] }
    }
  }
}

After (correct output):

{
  "data": {
    "id": "1",
    "type": "User",
    "attributes": {
      "name": "Foo"
    },
    "relationships": {
      "Article": { "data": [{ "id": "1", "type": "Article" }] }
    }
  }
}

Example — nothing to change, the fix is automatic:

import { Relator, Serializer } from "ts-japi";

interface Article { id: string; title: string; }
interface User    { id: string; name: string; articles: Article[]; }

const ArticleSerializer = new Serializer<Article>("Article");

const UserArticleRelator = new Relator<User, Article>(
  async (user) => user.articles,
  ArticleSerializer,
);

const UserSerializer = new Serializer<User>("User", {
  relators: [UserArticleRelator],
});

const doc = await UserSerializer.serialize({
  id: "1",
  name: "Foo",
  articles: [{ id: "1", title: "Article 1" }],
});

// doc.data.attributes → { name: "Foo" }        ✅  no `articles` field
// doc.data.relationships → { Article: { ... } } ✅  relationship present

⚡ Improvements

Node.js 24 LTS + dependency updates (#112)

The project's CI and engine target have been bumped to Node.js 24 LTS, ensuring ts-japi is tested and verified against the latest stable runtime. All dependencies have been refreshed to their newest compatible versions as well.


Installation

# npm
npm install ts-japi

# pnpm
pnpm add ts-japi

Full changelog: v1.12.2...v1.12.3

v1.12.2

11 Mar 00:56
e130360

Choose a tag to compare

ts-japi v1.12.2

We're shipping a focused tooling overhaul that makes contributing to ts-japi faster, leaner, and more consistent than ever before. While the public API is completely unchanged, this release replaces the entire developer toolchain under the hood — swapping out slower, heavier tools for a modern, blazing-fast stack — so every contributor gets a snappier experience from first clone to merged PR.

⚡ Improvements

Modern toolchain: Biome + pnpm + Lefthook

The dev toolchain has been fully modernized:

Before After
ESLint + Prettier Biome (via Ultracite)
Yarn pnpm
Husky Lefthook

Biome replaces both ESLint and Prettier with a single, Rust-powered tool that lints and formats in milliseconds. It's configured in biome.json and exposed through two simple scripts:

pnpm lint   # check for issues
pnpm format # fix issues automatically

pnpm replaces Yarn for dependency management, bringing faster installs, a content-addressable store, and a pnpm-lock.yaml that is far easier for tools and humans to read.

Lefthook replaces Husky for Git hooks — it's faster, zero-dependency, and skips hook installation automatically in CI environments (test -n "$CI" || lefthook install).

Refreshed CI/CD pipelines

The GitHub Actions workflows have been rebuilt from scratch:

  • CI (ci.yml) — streamlined lint → build → test pipeline with pnpm caching and concurrency cancellation on re-push.
  • Release (release.yml) — end-to-end release automation: build, pack, artifact upload, attestation, npm publish, and GitHub Release creation, all triggered by a version tag.
  • Release Notes (release-notes.yml) — automated release body generation wired into the release flow.

Updated dependencies

All dev dependencies have been bumped to their latest major versions, including Babel, Jest, TypeScript, and the full @microsoft/api-extractor toolchain.

License updated to Apache-2.0

The project license has been updated from MIT to Apache-2.0, and the author field updated to Mathematic Inc.


No breaking changes

The public API — Serializer, ErrorSerializer, Relator, Linker, Paginator, Metaizer, Cache, PolymorphicSerializer, and all exported types — is completely unchanged. Drop in this update with confidence.


Get it now

# npm
npm install ts-japi@1.12.2

# pnpm
pnpm add ts-japi@1.12.2

# yarn
yarn add ts-japi@1.12.2

Full changelog: v1.12.1...v1.12.2

v1.12.1

05 Nov 14:59
636bcd2

Choose a tag to compare

1.12.1 (2025-11-05)

Bug Fixes

  • issue #104 by using the serializers 'idKey' field as the cache key, instead of hardcoding id (#105) (1464c06)

v1.12.0

11 Jun 13:11
718c93b

Choose a tag to compare

1.12.0 (2025-06-10)

Features

v1.11.5

14 Jan 17:27
b0a39b9

Choose a tag to compare

1.11.5 (2025-01-14)

Bug Fixes

  • issue #98 by improving performance of recurseRelators (#99) (e92de4d)

v1.11.4

13 May 17:47
ff0460a

Choose a tag to compare

1.11.4 (2024-05-13)

Bug Fixes

v1.11.3

19 Apr 11:02
ec9b41b

Choose a tag to compare

1.11.3 (2024-04-19)

Bug Fixes

  • issue 89: conditional logic handling links (#90) (a13aff9)

v1.11.2

18 Apr 08:46
4fec402

Choose a tag to compare

1.11.2 (2024-04-18)

Bug Fixes

  • better support for polymorphic inputs (#87) (f29f835)

v1.11.1

17 Apr 07:27
534c01d

Choose a tag to compare

1.11.1 (2024-04-17)

Bug Fixes

  • correctly serialize input array as array (#84) (37becd6)

v1.11.0

08 Apr 16:37
064ead8

Choose a tag to compare

1.11.0 (2024-04-08)

Features