Skip to content

Release v2.2.5 - #26

Merged
kodjunkie merged 12 commits into
masterfrom
release/v2.2.5
Jun 11, 2026
Merged

Release v2.2.5#26
kodjunkie merged 12 commits into
masterfrom
release/v2.2.5

Conversation

@kodjunkie

Copy link
Copy Markdown
Owner

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 only myService, writing implements 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 field P in the resulting type. Alternatively, drop implements entirely — NestJS does not require it for routing. Available from @nestjs-crud/core.

Changed

  • Generated OpenAPI descriptions are now soft-delete–truthful. Resources without soft-delete enabled no longer mention includeDeleted anywhere in their descriptions. Resources with soft delete enabled carry the includeDeleted note only on the endpoints that honour it (getMany, getOne). Library-internal validation prose has been removed from all generated descriptions.

kodjunkie added 12 commits June 10, 2026 23:35
- 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
@kodjunkie
kodjunkie merged commit 9d98f37 into master Jun 11, 2026
12 checks passed
@github-actions

Copy link
Copy Markdown

Packages with version v2.2.5 have been released

@kodjunkie
kodjunkie deleted the release/v2.2.5 branch June 11, 2026 12:45
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