fix(crudx): export CrudBaseInterceptor from package root - #13
Conversation
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.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
🟢 Coverage 100.00% diff coverage
Metric Results Coverage variation Report missing for 6306d361 Diff coverage ✅ 100.00% diff coverage 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.
Summary
Closes #12.
packages/crudx/src/interceptors/index.tsre-exportedcrud-requestandcrud-responsebut notcrud-base, soCrudBaseInterceptorwas unreachable from the package root. Consumers were forced into the fragile deep import:This adds the missing re-export so it works from the root, matching its siblings:
Why CrudBaseInterceptor specifically (not CrudRequestInterceptor)
CrudBaseInterceptoris the intended base for interceptors that only needgetCrudInfo()and provide their ownintercept(). It is not substitutable by the already-exportedCrudRequestInterceptor: that class declares a concreteintercept(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 aPromise).CrudBaseInterceptorhas nointercept, leaving the method free.Change
One line in the interceptors barrel:
Context
Surfaced while migrating 2am.to off
@dataui/crudto@2amtech/crudx(NestJS 11). Itsrelationships-normalizer.interceptor.tsextendsCrudBaseInterceptor; once this ships, that file drops the/src/...deep import for a clean root import.Test plan
CrudBaseInterceptoris exported fromcrud-base.interceptor.tsand now re-exported via the barrel → reachable from the package rootnx run-many -t build-npm) green