Skip to content

Conversation

@ntucker
Copy link
Collaborator

@ntucker ntucker commented Jan 19, 2026

Motivation

Previously, schema classes like Union, Collection, Query, etc. could only be imported via the schema namespace:

import { schema } from '@data-client/endpoint';
const myUnion = new schema.Union({ users: User, groups: Group }, 'type');

This adds an extra namespace that isn't necessary and makes imports more verbose. Users requested the ability to import these classes directly for cleaner, more intuitive imports.

Solution

Added direct exports for all schema classes (Union, Invalidate, Collection, Query, Values, All) from @data-client/endpoint. These are now available as named exports alongside the existing schema namespace export, which remains available for backward compatibility.

The change is purely additive - no breaking changes. Users can now choose between:

// New direct import (recommended)
import { Union } from '@data-client/endpoint';
const myUnion = new Union({ users: User, groups: Group }, 'type');

// Legacy namespace import (still works)
import { schema } from '@data-client/endpoint';
const myUnion = new schema.Union({ users: User, groups: Group }, 'type');

Since @data-client/rest re-exports everything from @data-client/endpoint, these direct imports also work from @data-client/rest.

Technical details:

  • Added direct exports in packages/endpoint/src/index.ts for all schema classes except Object and Array (which are type-only)
  • Updated all documentation examples to use the new direct import pattern
  • Updated test files to demonstrate both patterns
  • All packages in the linked group receive minor version bumps

@changeset-bot
Copy link

changeset-bot bot commented Jan 19, 2026

🦋 Changeset detected

Latest commit: 58d33a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@data-client/core Patch
@data-client/endpoint Patch
@data-client/graphql Patch
@data-client/react Patch
@data-client/rest Patch
@data-client/vue Patch
example-benchmark Patch
@data-client/img Patch
normalizr-github-example Patch
normalizr-redux-example Patch
normalizr-relationships Patch
test-bundlesize Patch
coinbase-lite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jan 19, 2026

Size Change: 0 B

Total Size: 79.8 kB

ℹ️ View Unchanged
Filename Size
examples/test-bundlesize/dist/App.js 3.42 kB
examples/test-bundlesize/dist/polyfill.js 308 B
examples/test-bundlesize/dist/rdcClient.js 10.2 kB
examples/test-bundlesize/dist/rdcEndpoint.js 5.84 kB
examples/test-bundlesize/dist/react.js 59.4 kB
examples/test-bundlesize/dist/webpack-runtime.js 726 B

compressed-size-action

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.13%. Comparing base (8f05d08) to head (1975af8).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3706   +/-   ##
=======================================
  Coverage   98.13%   98.13%           
=======================================
  Files         150      150           
  Lines        2735     2736    +1     
  Branches      537      537           
=======================================
+ Hits         2684     2685    +1     
  Misses         11       11           
  Partials       40       40           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Details
Benchmark suite Current: 58d33a9 Previous: 7b4337a Ratio
normalizeLong 444 ops/sec (±0.93%) 447 ops/sec (±1.37%) 1.01
normalizeLong Values 404 ops/sec (±0.14%) 417 ops/sec (±0.20%) 1.03
denormalizeLong 289 ops/sec (±2.92%) 295 ops/sec (±2.23%) 1.02
denormalizeLong Values 267 ops/sec (±2.06%) 269 ops/sec (±2.15%) 1.01
denormalizeLong donotcache 1039 ops/sec (±0.13%) 1026 ops/sec (±0.23%) 0.99
denormalizeLong Values donotcache 777 ops/sec (±0.34%) 766 ops/sec (±0.19%) 0.99
denormalizeShort donotcache 500x 1570 ops/sec (±0.15%) 1596 ops/sec (±0.14%) 1.02
denormalizeShort 500x 858 ops/sec (±2.23%) 872 ops/sec (±1.83%) 1.02
denormalizeShort 500x withCache 6565 ops/sec (±0.18%) 6594 ops/sec (±0.16%) 1.00
queryShort 500x withCache 2763 ops/sec (±0.10%) 2789 ops/sec (±0.09%) 1.01
buildQueryKey All 50899 ops/sec (±0.17%) 52616 ops/sec (±0.16%) 1.03
query All withCache 7341 ops/sec (±0.12%) 7849 ops/sec (±0.25%) 1.07
denormalizeLong with mixin Entity 279 ops/sec (±2.33%) 285 ops/sec (±2.29%) 1.02
denormalizeLong withCache 7044 ops/sec (±0.14%) 7246 ops/sec (±0.19%) 1.03
denormalizeLong Values withCache 5160 ops/sec (±0.12%) 5099 ops/sec (±0.16%) 0.99
denormalizeLong All withCache 7103 ops/sec (±0.12%) 7480 ops/sec (±0.20%) 1.05
denormalizeLong Query-sorted withCache 7343 ops/sec (±0.25%) 7822 ops/sec (±0.38%) 1.07
denormalizeLongAndShort withEntityCacheOnly 1728 ops/sec (±0.27%) 1694 ops/sec (±0.19%) 0.98
getResponse 4782 ops/sec (±0.69%) 4711 ops/sec (±0.73%) 0.99
getResponse (null) 10365358 ops/sec (±1.03%) 10666527 ops/sec (±1.05%) 1.03
getResponse (clear cache) 268 ops/sec (±2.01%) 271 ops/sec (±2.04%) 1.01
getSmallResponse 3378 ops/sec (±0.16%) 3306 ops/sec (±0.21%) 0.98
getSmallInferredResponse 2530 ops/sec (±0.34%) 2551 ops/sec (±0.11%) 1.01
getResponse Collection 4667 ops/sec (±0.53%) 4528 ops/sec (±0.30%) 0.97
get Collection 4649 ops/sec (±0.23%) 4574 ops/sec (±0.52%) 0.98
get Query-sorted 5374 ops/sec (±0.16%) 5296 ops/sec (±0.25%) 0.99
setLong 444 ops/sec (±0.22%) 465 ops/sec (±0.14%) 1.05
setLongWithMerge 256 ops/sec (±0.28%) 261 ops/sec (±0.17%) 1.02
setLongWithSimpleMerge 271 ops/sec (±0.15%) 275 ops/sec (±0.87%) 1.01
setSmallResponse 500x 952 ops/sec (±0.14%) 947 ops/sec (±0.27%) 0.99

This comment was automatically generated by workflow using github-action-benchmark.

@ntucker ntucker force-pushed the schema-namespace branch 2 times, most recently from a77627f to fe7673b Compare January 19, 2026 19:40
@ntucker ntucker merged commit 93ee4da into master Jan 19, 2026
12 of 17 checks passed
@ntucker ntucker deleted the schema-namespace branch January 19, 2026 19:47
@github-actions github-actions bot mentioned this pull request Jan 19, 2026
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.

2 participants