@haneinfo/common
Prisma 6 and 7 consumers
PrismaModule without options retains the Prisma 6 behavior. For Prisma 7, import
PrismaModule.forRoot({ adapter }) once in the App's platform composition. The App creates its
own @prisma/adapter-pg adapter and configures the connection string, pool, timeout and TLS.
Remove other bare PrismaModule imports so the configured module owns the single PrismaService.
PRISMA_CLIENT_OPTIONS is an explicit optional injection token; no database configuration is
inferred or read by this package. PrismaService forwards the options to the consumer-CWD-resolved
generated client, and retains connect/disconnect lifecycle hooks.
Publish the compatibility release before upgrading consumer pins. NestJS 11 and Prisma 6 remain supported; the development tree exercises NestJS 12 and Prisma 7. NestJS 12 requires modern Node with require(esm); logger 5 requires Node 22.12+, NestJS 11.0.8+/12.0.2+, Pino 10 and pino-http 11. Prisma 7 still supports the existing prisma-client-js output used by the consumer resolver.
Prisma 7's runtime DMMF omits enums, documentation, field constraints and relation metadata.
Add a second generator to the App's schema folder so prisma:generate preserves the complete
datamodel alongside the default client:
generator haneinfoMetadata {
provider = "node ./node_modules/@haneinfo/common/dist/prisma/prisma-generator.js"
output = "../../node_modules/.prisma/haneinfo-metadata"
}
The provider is relative to the backend working directory; the output is relative to
backend/prisma/schema. PrismaService and the exported Prisma namespace keep using the App's
own generated client. For Prisma 7, common loads this JSON through Node resolution and checks its
schema hash against the client's embedded schema. Missing, stale or compact metadata fails
explicitly. Prisma 6 continues using its original full DMMF. Drift scripts must import Prisma
from @haneinfo/common; importing it directly from @prisma/client still gives compact metadata.
Generate both artifacts again in a deployed dependency tree; do not copy another App's snapshot.
HTTP exception envelope
GlobalExceptionFilter retains statusCode, message, traceId, timestamp, path and the existing
validation-array details behavior. It adds optional code only for a MechanismError-shaped error
or a plain HTTP response with the MechanismError.toJSON() code/message shape. The code must match
^[A-Z][A-Z0-9_]{1,63}$ in its entirety, with no trailing line terminator. Recognition does not
import plugin-api or invoke an exception serializer. Generic errors and arbitrary coded Error
instances do not acquire code. Direct non-HTTP errors retain their existing HTTP 500 handling.
Only the code is projected. Custom exception properties, issues, diagnostic arrays, mechanism details, suggestions and stacks are never copied into the envelope. The existing message and validation-array details contracts are unchanged; UI consumers should translate known codes and display a generic error otherwise, without rendering backend prose. Server-side logging retains its existing behavior.
Apps mounting this filter receive the additive field after upgrading. Custom filters need their own adoption work; plugin-host-nest does not install or duplicate a global exception filter.
Bounded Form validation errors
For INVALID_DATA with HTTP 422, GlobalExceptionFilter projects only details.fieldErrors ({ path, code } entries) from Form diagnostics. JSON Pointers must address /values/, are limited to 300 characters, and the list is limited to 100 entries. Oversized paths or extra entries are dropped and mark details.truncated. Malformed items and codes outside the Form fill allowlist are skipped. Messages, suggestions, values and raw diagnostics are never projected. Other mechanism details retain their existing protection (only revision conflicts and rate limits).
Blocked definition publish
For PUBLISH_BLOCKED with HTTP 409 (@haneinfo/definition-registry), GlobalExceptionFilter projects
details.definitions: one entry per blocked definition with its kind, code and reason (invalid for
a draft being published, affected for a published definition it would break), and each
diagnostic's code and JSON Pointer path only. At most 50 definitions and 100 diagnostics are
projected; paths over 300 characters or extra entries are dropped and mark details.truncated.
Malformed kinds, codes, diagnostic codes and pointers are skipped. Diagnostic messages and
suggestions quote definition content and are never projected.
Pagination query
paginationQuerySchema accepts page from 1 to 10,000, limit from 1 to 100 (default 20) and a
search of at most 200 characters; anything outside is a validation error (HTTP 400 through
ZodValidationPipe).