Skip to content

fix(json-api-nestjs-sdk): take the meta symbols from the global registry and export the readers for Angular - #129

Merged
klerick merged 1 commit into
masterfrom
fix/sdk-meta-review
Oct 10, 2026
Merged

klerick merged 1 commit into
masterfrom
fix/sdk-meta-review

Conversation

@klerick

@klerick klerick commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Three things review caught in 10.1.0.

The symbols were module-local

const RESOURCE_META = Symbol('json-api-resource-meta');

The package ships two entry points and nothing promises a bundler gives them the
same copy of resource-meta: cjs and mjs can resolve apart, or one can be
inlined while the other stays external. Two copies would write under one
symbol and read under another
, and getResourceMeta would answer undefined
with no error to show for it.

Symbol.for keys them in the global registry instead, scoped by package name:

Symbol.for('@klerick/json-api-nestjs-sdk/resource-meta')
Symbol.for('@klerick/json-api-nestjs-sdk/document-meta')

Both entry points lead to one file today, so this never showed — which is also
why it would have been hard to find later. The test reads the property through
Symbol.for(...) directly rather than through the exported reader, so it pins
the key being global rather than merely that the reader works.

The readers were missing from ./ngModule

getResourceMeta, getDocumentMeta and ResourceMeta reached only the root
entry point, while an Angular consumer takes JsonApiUtilsService and
JsonApiSdkService from ./ngModule and would have needed a second import path
just for these. Verified present in the built .js and .d.ts.

Two leftover casts

(dataItem as { meta?: unknown }).meta and the same for body.meta predate
meta being added to ResourceData in the very same change, and were never
cleaned up. The build confirms they were redundant.

Verification

Unit across 9 projects, ts-test, e2e 137/137 on both MikroORM and TypeORM.
json-api-front:build:production fails on a CSS budget, as on master.

🤖 Generated with Claude Code

…try and export the readers for Angular

Three things review caught in 10.1.0.

The symbols were module-local. The package ships two entry points and nothing
promises a bundler gives them the same copy of resource-meta: cjs and mjs can
resolve apart, or one can be inlined while the other stays external. Two copies
would write under one symbol and read under another, and getResourceMeta would
answer undefined with no error to show for it. Symbol.for keys them in the
global registry instead, scoped by package name so they cannot collide. Both
entry points lead to one file today, so this never showed -- which is also why
it would have been hard to find later.

getResourceMeta, getDocumentMeta and ResourceMeta reached only the root entry
point, while an Angular consumer takes its services from ./ngModule and would
have needed a second import path for them. They are exported there too.

The casts reading dataItem.meta and body.meta predate the field being added to
ResourceData in the same change, and were never cleaned up. The build confirms
they were redundant.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@nx-cloud

nx-cloud Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit c1064ac

Command Status Duration Result
nx affected --target=build --parallel=3 --exclu... ✅ Succeeded 1s View ↗
nx run json-api-server-e2e:e2e-micro --parallel=1 ✅ Succeeded 1m 52s View ↗
nx run json-api-server-e2e:e2e --parallel=1 ✅ Succeeded 1m 50s View ↗
nx run json-api-server:build:development ✅ Succeeded 7s View ↗
nx affected --target=ts-test --parallel=3 --pas... ✅ Succeeded <1s View ↗
nx affected --target=test --parallel=3 --passWi... ✅ Succeeded 2s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-10 13:35:33 UTC

@klerick
klerick merged commit 97a21c6 into master Oct 10, 2026
4 checks passed
@klerick
klerick deleted the fix/sdk-meta-review branch October 10, 2026 13:36
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.

1 participant