Release v2.2.5 - #26
Merged
Merged
Conversation
- Three it() blocks covering: (a) custom-name compiles, (b) default form assignable bidirectionally with CrudController<T>, (c) broken pattern still raises TS2559 via @ts-expect-error - RED state: TS2724 — CrudControllerFor not yet exported from interfaces
…weak-type error Controllers using serviceProperty: 'x' and implements CrudController<T> trigger TS2559 because all-optional interfaces produce a weak type — a class that shares zero property names is rejected even if structurally compatible. The new CrudControllerFor<T, P> helper maps the service field under the caller-supplied name P, resolving the no-common-properties check without touching the existing CrudController<T> interface. - No barrel changes needed: interfaces/index.ts already re-exports crud-controller.interface, so CrudControllerFor is immediately importable from @nestjs-crud/core - Zero runtime emit change — types-only alias - CrudController<T> is byte-for-byte unchanged
- Add optional `softDelete = false` param to operationsMap signature - getManyBase/getOneBase spread includeDeleted sentence only when softDelete true - deleteOneBase soft-deletes vs permanently removes based on softDelete flag - recoverOneBase drops tautological "Available only when" sentence - createOneBase/createManyBase/updateOneBase remove validation-group prose - replaceOneBase drops false upsert conditional - Factory call site passes this.options.query.softDelete === true
- softDelete OFF: no description (except recoverOneBase) mentions includeDeleted or soft-del - softDelete ON: getManyBase and getOneBase contain includeDeleted; deleteOneBase does not - recoverOneBase excluded from OFF check (only registers when softDelete enabled; description correctly uses "soft-deleted" as noun modifier) - No-swagger sentinel passes (209 tests)
…ippet - Expand the serviceProperty section with a #### TS2559 subsection - Explain TypeScript's weak-type rule (all-optional interface, no discriminant) - Show Option 1: implements CrudControllerFor<User, 'usersService'> pattern - Show Option 2: drop implements entirely (NestJS does not require it)
…2.2.5 - Root CHANGELOG [2.2.3]: add qs direct-dependency fix entry (parity with core CHANGELOG line 24 — clears the carried docs follow-up) - Root CHANGELOG: add [Unreleased] section with CrudControllerFor (Added) and soft-delete-truthful descriptions (Changed) - packages/core CHANGELOG: add [Unreleased] section mirroring both changes
…d specs - getOne soft-delete note now renders as its own paragraph (parity with getMany) - wiki: correct v1-style @crud(Hero) shorthand to @crud({ model: { type: Hero } }) - root CHANGELOG: add [Unreleased] compare link - compile spec imports via @nestjs-crud/core root to assert the public export chain - assert deleteOne description states soft-delete behavior when enabled
|
Packages with version v2.2.5 have been released |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Patch release — adds a type helper for controllers that rename their service field via serviceProperty, and corrects the generated OpenAPI descriptions to be truthful about soft-delete configuration.
Added
CrudControllerFor<Entity, 'fieldName'>type helper — when a controller uses@Crud({ serviceProperty: 'myService' })and declares onlymyService, writingimplements CrudController<Entity>raises TypeScript TS2559 ("has no properties in common") because the all-optional interface has no discriminant to match.CrudControllerFor<T, P>resolves this by naming the service fieldPin the resulting type. Alternatively, dropimplementsentirely — NestJS does not require it for routing. Available from@nestjs-crud/core.Changed
includeDeletedanywhere in their descriptions. Resources with soft delete enabled carry theincludeDeletednote only on the endpoints that honour it (getMany,getOne). Library-internal validation prose has been removed from all generated descriptions.