Skip to content

fix(crudx): export CrudBaseInterceptor from package root - #13

Merged
tonydspaniard merged 1 commit into
mainfrom
fix/crudx-export-crud-base-interceptor
Jun 17, 2026
Merged

tonydspaniard merged 1 commit into
mainfrom
fix/crudx-export-crud-base-interceptor

Conversation

@tonydspaniard

Copy link
Copy Markdown
Member

Summary

Closes #12.

packages/crudx/src/interceptors/index.ts re-exported crud-request and crud-response but not crud-base, so CrudBaseInterceptor was unreachable from the package root. Consumers were forced into the fragile deep import:

import { CrudBaseInterceptor } from '@2amtech/crudx/src/interceptors/crud-base.interceptor';

This adds the missing re-export so it works from the root, matching its siblings:

import { CrudBaseInterceptor } from '@2amtech/crudx';

Why CrudBaseInterceptor specifically (not CrudRequestInterceptor)

CrudBaseInterceptor is the intended base for interceptors that only need getCrudInfo() and provide their own intercept(). It is not substitutable by the already-exported CrudRequestInterceptor: that class declares a concrete intercept(context, next): Observable<any>, so a consumer with an async interceptor (async intercept(...): Promise<Observable<R>>) cannot extend it — TypeScript rejects the override (TS2416, return type can't widen to a Promise). CrudBaseInterceptor has no intercept, leaving the method free.

Change

One line in the interceptors barrel:

export * from "./crud-base.interceptor";   // added
export * from "./crud-request.interceptor";
export * from "./crud-response.interceptor";

Context

Surfaced while migrating 2am.to off @dataui/crud to @2amtech/crudx (NestJS 11). Its relationships-normalizer.interceptor.ts extends CrudBaseInterceptor; once this ships, that file drops the /src/... deep import for a clean root import.

Test plan

  • CrudBaseInterceptor is exported from crud-base.interceptor.ts and now re-exported via the barrel → reachable from the package root
  • CI build (nx run-many -t build-npm) green

The interceptors barrel re-exported crud-request and crud-response but not
crud-base, so CrudBaseInterceptor was unreachable from '@2amtech/crudx' and
consumers had to deep-import '@2amtech/crudx/src/interceptors/crud-base.interceptor'.

CrudBaseInterceptor is the intended base for interceptors that only need
getCrudInfo() and supply their own intercept() (incl. async ones) — and it is
NOT substitutable by CrudRequestInterceptor (whose concrete intercept(): Observable
signature rejects an async Promise override). Re-export it from the barrel so it is
available on the package root, matching crud-request/crud-response.
@codacy-production

codacy-production Bot commented Jun 17, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

🟢 Coverage 100.00% diff coverage

Metric Results
Coverage variation Report missing for 6306d361
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (6306d36) Report Missing Report Missing Report Missing
Head commit (2ebea17) 1320 1275 96.59%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#13) 1 1 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@tonydspaniard tonydspaniard self-assigned this Jun 17, 2026
@tonydspaniard
tonydspaniard merged commit d8c058e into main Jun 17, 2026
3 checks passed
@tonydspaniard
tonydspaniard deleted the fix/crudx-export-crud-base-interceptor branch June 17, 2026 21:06
@tonydspaniard tonydspaniard mentioned this pull request Jun 17, 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.

crudx: export CrudBaseInterceptor (and extendable base classes) from package root

1 participant