@bymax-one/nest-core 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -1
- package/README.md +92 -43
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,53 @@ heading here.
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [1.6.5] - 2026-10-31
|
|
15
|
+
|
|
16
|
+
A documentation release. The compiled JavaScript is byte-identical to `1.6.4`: what changes in the
|
|
17
|
+
package is the README and comments in the type declarations.
|
|
18
|
+
|
|
19
|
+
**Apply to a derived backend:** `pnpm up @bymax-one/nest-core`. No code change is needed.
|
|
20
|
+
|
|
21
|
+
### Documentation
|
|
22
|
+
|
|
23
|
+
- **README snippets are corrected so they compile.** The metrics `authToken` example no longer passes
|
|
24
|
+
`string | undefined` where `exactOptionalPropertyTypes` requires `string`; the `environment` example
|
|
25
|
+
reads the validated value with `getOrThrow`; the contributor example imports `Injectable`; and the
|
|
26
|
+
`authOperationSecurity` example is a complete function and a complete `forRoot` call.
|
|
27
|
+
- **The README lists every error-code constant and the OpenAPI contract version.** Each code is in a
|
|
28
|
+
catalog beside the status it maps from, and `BYMAX_OPENAPI_CONTRACT_VERSION` is documented and used
|
|
29
|
+
by the contributor example instead of a literal `1`.
|
|
30
|
+
- **The README says this package mints no request id.** `correlationId` is whatever the bound
|
|
31
|
+
`BYMAX_CORRELATION_PROVIDER` returns, and the id comes from what the application binds, such as the
|
|
32
|
+
`@bymax-one/nest-logger` request-id middleware.
|
|
33
|
+
- **The README explains why `TimingInterceptor` is deprecated.** It records a second sample for every
|
|
34
|
+
request that reaches a handler when wired next to the middleware, and it never saw a request a guard
|
|
35
|
+
rejected.
|
|
36
|
+
- **The `TimingOptions` declarations name the middleware.** `timing.enabled` registers
|
|
37
|
+
`BymaxTimingMiddleware`, not an interceptor.
|
|
38
|
+
- **The README's `RequestTimingSample` snippet lists the two optional trace fields.** The interface
|
|
39
|
+
carries `traceId?` and `spanId?`, present when telemetry is enabled and a span was recording.
|
|
40
|
+
|
|
41
|
+
### Tests
|
|
42
|
+
|
|
43
|
+
- **`pnpm check:published` compiles every README snippet through the TypeScript API.** Syntax and type
|
|
44
|
+
errors are reported together, snippets that do not import the package are checked too, a relative
|
|
45
|
+
import resolves to the snippet that exports the name, and the names a snippet takes from its prose
|
|
46
|
+
are typed in `scripts/readme-prelude.d.ts`, so a wrong method, option or field fails the gate
|
|
47
|
+
instead of resolving to `any`. An option misspelled in a `forRootAsync` factory fails too.
|
|
48
|
+
- **`pnpm check:published` fails on three more kinds of README defect.** A syntax error in a snippet,
|
|
49
|
+
a prelude import that stopped resolving, and a snippet that restates a shipped interface with a
|
|
50
|
+
member added, dropped or retyped.
|
|
51
|
+
- **The README snippet gate no longer exempts a type error on an imported type or a union.** The
|
|
52
|
+
exemption for an abbreviated local class now reads only the snippet's own declarations, accepts a
|
|
53
|
+
plain identifier only, and handles a `$` in a class name.
|
|
54
|
+
- **The README's error-code catalog and contract version are pinned to the code.** A spec fails when an
|
|
55
|
+
exported code constant has no row, a row names a status `codeForStatus` does not map to it, or the
|
|
56
|
+
README states a contract version other than `BYMAX_OPENAPI_CONTRACT_VERSION`.
|
|
57
|
+
- **The README's option tables are pinned to the resolved defaults.** A spec parses every table under
|
|
58
|
+
the Configuration section and fails when a documented default, or a documented option, differs from
|
|
59
|
+
`DEFAULT_CORE_OPTIONS`, or when a resolved option has no row.
|
|
60
|
+
|
|
14
61
|
## [1.6.4] - 2026-10-30
|
|
15
62
|
|
|
16
63
|
A 5xx envelope no longer carries `details` unless `envelope.exposeInternals` is on, and the
|
|
@@ -1266,4 +1313,5 @@ have regressed from. They are kept because the reasoning is worth having.
|
|
|
1266
1313
|
[1.6.2]: https://github.com/bymaxone/nest-core/compare/v1.6.1...v1.6.2
|
|
1267
1314
|
[1.6.3]: https://github.com/bymaxone/nest-core/compare/v1.6.2...v1.6.3
|
|
1268
1315
|
[1.6.4]: https://github.com/bymaxone/nest-core/compare/v1.6.3...v1.6.4
|
|
1269
|
-
[
|
|
1316
|
+
[1.6.5]: https://github.com/bymaxone/nest-core/compare/v1.6.4...v1.6.5
|
|
1317
|
+
[Unreleased]: https://github.com/bymaxone/nest-core/compare/v1.6.5...HEAD
|
package/README.md
CHANGED
|
@@ -273,8 +273,9 @@ is rejected at boot rather than silently ignored, so a mistyped secret fails lou
|
|
|
273
273
|
instead of leaving the endpoint open:
|
|
274
274
|
|
|
275
275
|
```ts
|
|
276
|
+
const token = process.env.METRICS_TOKEN
|
|
276
277
|
BymaxCoreModule.forRoot({
|
|
277
|
-
metrics: { enabled: true, authToken:
|
|
278
|
+
metrics: { enabled: true, ...(token === undefined ? {} : { authToken: token }) }
|
|
278
279
|
})
|
|
279
280
|
// Scrape: curl -H "Authorization: Bearer $METRICS_TOKEN" http://host/metrics
|
|
280
281
|
```
|
|
@@ -356,10 +357,14 @@ place that knows it:
|
|
|
356
357
|
|
|
357
358
|
```ts
|
|
358
359
|
// in the library
|
|
359
|
-
export function authOperationSecurity(prefix = ''): OperationSecurityMap {
|
|
360
|
+
export function authOperationSecurity(prefix = ''): OperationSecurityMap {
|
|
361
|
+
return {} /* … */
|
|
362
|
+
}
|
|
360
363
|
|
|
361
364
|
// in the application
|
|
362
|
-
|
|
365
|
+
BymaxCoreModule.forRoot({
|
|
366
|
+
openapi: { operationSecurity: { ...authOperationSecurity('api'), ...myOwnOverrides } }
|
|
367
|
+
})
|
|
363
368
|
```
|
|
364
369
|
|
|
365
370
|
A requirement naming a scheme that is not declared **fails the document build**
|
|
@@ -569,6 +574,13 @@ follows this exact, versioned shape:
|
|
|
569
574
|
| `timestamp` | string (ISO 8601) | always | Time the error was formatted. |
|
|
570
575
|
| `path` | string | always | Request URL path, never the query string. The router's own 404 `message` names the same path. |
|
|
571
576
|
|
|
577
|
+
**This package mints no request id.** `correlationId` is whatever the bound
|
|
578
|
+
`ICorrelationIdProvider` (`BYMAX_CORRELATION_PROVIDER`) returns: the filter only
|
|
579
|
+
reads it, and with no provider bound the field is absent. The id has to come from
|
|
580
|
+
something you bind. With `@bymax-one/nest-logger` that is its request-id
|
|
581
|
+
middleware; see
|
|
582
|
+
[Integration with `@bymax-one/nest-logger`](#-integration-with-bymax-onenest-logger).
|
|
583
|
+
|
|
572
584
|
**A server error carries no `details` by default.** For a status of 500 or above, the filter omits `details`
|
|
573
585
|
from the body, whichever library threw the `HttpException` and whether it wrote them flat or
|
|
574
586
|
under `error`; the `code` and `message` stay, because they are text the thrower chose for the
|
|
@@ -595,6 +607,29 @@ import { BadRequestException } from '@nestjs/common'
|
|
|
595
607
|
throw new BadRequestException({ code: 'INVOICE_OVERDUE', message: 'Invoice is overdue' })
|
|
596
608
|
```
|
|
597
609
|
|
|
610
|
+
Every code the package assigns is exported from `@bymax-one/nest-core` as a constant:
|
|
611
|
+
|
|
612
|
+
| Code | Status | When |
|
|
613
|
+
| ------------------------------ | --------- | -------------------------------------------------------- |
|
|
614
|
+
| `BYMAX_BAD_REQUEST` | 400 | A bad request that is not a validation failure. |
|
|
615
|
+
| `BYMAX_VALIDATION_FAILED` | 400 | The shape a validation pipe produces. |
|
|
616
|
+
| `BYMAX_UNAUTHORIZED` | 401 | No or invalid credentials. |
|
|
617
|
+
| `BYMAX_FORBIDDEN` | 403 | Authenticated, but not allowed. |
|
|
618
|
+
| `BYMAX_NOT_FOUND` | 404 | Unknown resource, including a route no handler matched. |
|
|
619
|
+
| `BYMAX_CONFLICT` | 409 | A state conflict. |
|
|
620
|
+
| `BYMAX_PAYLOAD_TOO_LARGE` | 413 | A body over the size limit. |
|
|
621
|
+
| `BYMAX_UNSUPPORTED_MEDIA_TYPE` | 415 | A content type the route does not accept. |
|
|
622
|
+
| `BYMAX_UNPROCESSABLE_ENTITY` | 422 | A well-formed body that is semantically invalid. |
|
|
623
|
+
| `BYMAX_TOO_MANY_REQUESTS` | 429 | A rate limit. |
|
|
624
|
+
| `BYMAX_CLIENT_ERROR` | other 4xx | A client error with no code of its own. |
|
|
625
|
+
| `BYMAX_INTERNAL_ERROR` | 500 | An unknown error, and any non-4xx status without a code. |
|
|
626
|
+
| `BYMAX_NOT_IMPLEMENTED` | 501 | A handler that is not implemented. |
|
|
627
|
+
| `BYMAX_BAD_GATEWAY` | 502 | A failure of an upstream service. |
|
|
628
|
+
| `BYMAX_SERVICE_UNAVAILABLE` | 503 | Temporary unavailability. |
|
|
629
|
+
| `BYMAX_GATEWAY_TIMEOUT` | 504 | An upstream service that did not answer in time. |
|
|
630
|
+
|
|
631
|
+
`codeForStatus(status)` returns the code for a status.
|
|
632
|
+
|
|
598
633
|
### What the filter classifies from, and what it cannot
|
|
599
634
|
|
|
600
635
|
An error raised before any handler ran — a malformed JSON body, a payload over
|
|
@@ -753,9 +788,17 @@ export interface RequestTimingSample {
|
|
|
753
788
|
statusCode: number
|
|
754
789
|
durationMs: number
|
|
755
790
|
slow: boolean
|
|
791
|
+
traceId?: string
|
|
792
|
+
spanId?: string
|
|
756
793
|
}
|
|
757
794
|
```
|
|
758
795
|
|
|
796
|
+
`TimingInterceptor` is still exported and is **deprecated**: nothing registers it. It
|
|
797
|
+
was the recorder until `BymaxTimingMiddleware` replaced it, because guards run
|
|
798
|
+
before interceptors and a request a guard rejected never reached it. Registering it
|
|
799
|
+
as well records a second sample for every request that reaches a handler, so leave
|
|
800
|
+
it out.
|
|
801
|
+
|
|
759
802
|
### Rejected requests are counted too
|
|
760
803
|
|
|
761
804
|
The recorder is middleware (`BymaxTimingMiddleware`), applied to every route by
|
|
@@ -1296,7 +1339,7 @@ BymaxCoreModule.forRootAsync({
|
|
|
1296
1339
|
inject: [ConfigService],
|
|
1297
1340
|
useFactory: (config: ConfigService) => ({
|
|
1298
1341
|
// Your validated value, not a second copy of NODE_ENV.
|
|
1299
|
-
environment: config.
|
|
1342
|
+
environment: config.getOrThrow<string>('APP_ENV'),
|
|
1300
1343
|
openapi: { enabled: true }
|
|
1301
1344
|
})
|
|
1302
1345
|
})
|
|
@@ -1399,7 +1442,11 @@ So a library marks a provider and returns fragments keyed by **handler
|
|
|
1399
1442
|
identity**, which survives every prefix, version and mount point:
|
|
1400
1443
|
|
|
1401
1444
|
```ts
|
|
1402
|
-
import {
|
|
1445
|
+
import { Injectable } from '@nestjs/common'
|
|
1446
|
+
import {
|
|
1447
|
+
BymaxOpenApiContributor,
|
|
1448
|
+
BYMAX_OPENAPI_CONTRACT_VERSION
|
|
1449
|
+
} from '@bymax-one/nest-core/openapi'
|
|
1403
1450
|
import type { IOpenApiContributor, OpenApiFragment } from '@bymax-one/nest-core/openapi'
|
|
1404
1451
|
|
|
1405
1452
|
@BymaxOpenApiContributor()
|
|
@@ -1412,7 +1459,7 @@ export class AuthOpenApi implements IOpenApiContributor {
|
|
|
1412
1459
|
// Required, and declared rather than inferred: a fragment crosses a
|
|
1413
1460
|
// boundary between independently released packages, where each side
|
|
1414
1461
|
// type-checked against its own copy.
|
|
1415
|
-
contractVersion:
|
|
1462
|
+
contractVersion: BYMAX_OPENAPI_CONTRACT_VERSION,
|
|
1416
1463
|
components: {
|
|
1417
1464
|
securitySchemes: {
|
|
1418
1465
|
// Derived from resolved options — which is why this cannot be a
|
|
@@ -1441,14 +1488,15 @@ library that is never imported contributes nothing.
|
|
|
1441
1488
|
|
|
1442
1489
|
#### What the merge guarantees
|
|
1443
1490
|
|
|
1444
|
-
| Rule | Behavior
|
|
1445
|
-
| --------------------- |
|
|
1446
|
-
| Marked, not shaped | Only providers carrying the marker are called. A class that merely exposes `contributeOpenApi` is never touched.
|
|
1447
|
-
| Called once | While the document is built, after options resolve — so a contributor may derive its contribution from its own configuration.
|
|
1448
|
-
| Stable order | Contributors run sorted by class name, so two libraries describing the same operation resolve the same way on every boot.
|
|
1449
|
-
| Data, not mutation | A contributor returns fragments; this package decides what to write. That is what makes precedence enforceable.
|
|
1450
|
-
| Named failures | A marked class that cannot contribute, one that throws, or a fragment addressing a handler the application does not have all fail the document build naming the contributor.
|
|
1451
|
-
|
|
|
1491
|
+
| Rule | Behavior |
|
|
1492
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1493
|
+
| Marked, not shaped | Only providers carrying the marker are called. A class that merely exposes `contributeOpenApi` is never touched. |
|
|
1494
|
+
| Called once | While the document is built, after options resolve — so a contributor may derive its contribution from its own configuration. |
|
|
1495
|
+
| Stable order | Contributors run sorted by class name, so two libraries describing the same operation resolve the same way on every boot. |
|
|
1496
|
+
| Data, not mutation | A contributor returns fragments; this package decides what to write. That is what makes precedence enforceable. |
|
|
1497
|
+
| Named failures | A marked class that cannot contribute, one that throws, or a fragment addressing a handler the application does not have all fail the document build naming the contributor. |
|
|
1498
|
+
| Versioned contract | A fragment declares `contractVersion` as `BYMAX_OPENAPI_CONTRACT_VERSION`, currently `1`. A fragment declaring another version fails the document build, naming both versions. |
|
|
1499
|
+
| Off with the document | With `openapi.enabled` false, no contributor runs. |
|
|
1452
1500
|
|
|
1453
1501
|
**Precedence, weakest first:** what this package infers about its own routes,
|
|
1454
1502
|
then what a library contributed, then what the consumer configured, and above
|
|
@@ -1855,27 +1903,27 @@ in the sections above.
|
|
|
1855
1903
|
|
|
1856
1904
|
### `.` (root)
|
|
1857
1905
|
|
|
1858
|
-
| Export | Kind | Description
|
|
1859
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------- |
|
|
1860
|
-
| `BymaxCoreModule` | class | The dynamic module: `forRoot` and `forRootAsync`.
|
|
1861
|
-
| `BymaxCoreModuleOptions`, `EnvelopeOptions`, `TimingOptions`, `HealthOptions`, `MetricsOptions`, `TelemetryOptions`, `OpenApiOptions`, `OpenApiServerDescriptor`, `OpenApiSecurityScheme`, `ResolvedCoreOptions` | types | The options surface and its resolved shape.
|
|
1862
|
-
| `OpenApiSecurityRequirement`, `OpenApiHttpMethod`, `OpenApiOperationKey`, `OperationSecurityMap` | types | The operation-key contract a sibling library targets to ship its own security map.
|
|
1863
|
-
| `OpenApiOperationIdFactory` | type | Names the operations in the generated document.
|
|
1864
|
-
| `BYMAX_CORE_OPTIONS`, `BYMAX_CORRELATION_PROVIDER`, `BYMAX_TIMING_SINK`, `BYMAX_HEALTH_INDICATORS`, `BYMAX_HEALTH_TRANSITION_SINK`, `BYMAX_UNEXPECTED_ERROR_SINK`, `BYMAX_METRICS_REGISTRY`, `BYMAX_TRACE_CONTEXT` | tokens | The DI tokens; see the [token table](#-di-tokens).
|
|
1865
|
-
| `IHealthTransitionSink`, `HealthTransition`, `HealthTransitionCause` | types | The readiness-transition contract; also on `./health`.
|
|
1866
|
-
| `ICorrelationIdProvider` | type | The correlation-provider contract.
|
|
1867
|
-
| `ITraceContextProvider`, `TraceContext` | types | The trace-context contract and the identifiers it resolves.
|
|
1868
|
-
| `BymaxExceptionFilter` | class | The envelope exception filter.
|
|
1869
|
-
| `FilterErrorContext` | type | The neutral request context passed to the filter's observability seam.
|
|
1870
|
-
| `IUnexpectedErrorSink`, `UnexpectedErrorReport` | types | Receives the cause behind each collapsed `500 BYMAX_INTERNAL_ERROR`; see [Recording the cause of a 500](#recording-the-cause-of-a-500).
|
|
1871
|
-
| `buildErrorEnvelope` | function | Pure builder assembling an `ErrorEnvelope`.
|
|
1872
|
-
| `ErrorEnvelope`, `ErrorDetails`, `BuildErrorEnvelopeInput` | types | The envelope contract and its builder input.
|
|
1873
|
-
| `BymaxTimingMiddleware` | class | The request-timing middleware, applied to every route when timing is enabled.
|
|
1874
|
-
| `UNMATCHED_ROUTE` | constant | The bounded label recorded when a request matched no route (`<unmatched>`).
|
|
1875
|
-
| `TimingInterceptor` | class | Deprecated
|
|
1876
|
-
| `ITimingSink`, `RequestTimingSample` | types | The timing-sink contract and its sample shape.
|
|
1877
|
-
| `BYMAX_BAD_GATEWAY` … `BYMAX_VALIDATION_FAILED` | constants | The full error-code catalog (see [Error envelope](#-error-envelope)).
|
|
1878
|
-
| `codeForStatus` | function | Derives a catalog code from an HTTP status.
|
|
1906
|
+
| Export | Kind | Description |
|
|
1907
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1908
|
+
| `BymaxCoreModule` | class | The dynamic module: `forRoot` and `forRootAsync`. |
|
|
1909
|
+
| `BymaxCoreModuleOptions`, `EnvelopeOptions`, `TimingOptions`, `HealthOptions`, `MetricsOptions`, `TelemetryOptions`, `OpenApiOptions`, `OpenApiServerDescriptor`, `OpenApiSecurityScheme`, `ResolvedCoreOptions` | types | The options surface and its resolved shape. |
|
|
1910
|
+
| `OpenApiSecurityRequirement`, `OpenApiHttpMethod`, `OpenApiOperationKey`, `OperationSecurityMap` | types | The operation-key contract a sibling library targets to ship its own security map. |
|
|
1911
|
+
| `OpenApiOperationIdFactory` | type | Names the operations in the generated document. |
|
|
1912
|
+
| `BYMAX_CORE_OPTIONS`, `BYMAX_CORRELATION_PROVIDER`, `BYMAX_TIMING_SINK`, `BYMAX_HEALTH_INDICATORS`, `BYMAX_HEALTH_TRANSITION_SINK`, `BYMAX_UNEXPECTED_ERROR_SINK`, `BYMAX_METRICS_REGISTRY`, `BYMAX_TRACE_CONTEXT` | tokens | The DI tokens; see the [token table](#-di-tokens). |
|
|
1913
|
+
| `IHealthTransitionSink`, `HealthTransition`, `HealthTransitionCause` | types | The readiness-transition contract; also on `./health`. |
|
|
1914
|
+
| `ICorrelationIdProvider` | type | The correlation-provider contract. |
|
|
1915
|
+
| `ITraceContextProvider`, `TraceContext` | types | The trace-context contract and the identifiers it resolves. |
|
|
1916
|
+
| `BymaxExceptionFilter` | class | The envelope exception filter. |
|
|
1917
|
+
| `FilterErrorContext` | type | The neutral request context passed to the filter's observability seam. |
|
|
1918
|
+
| `IUnexpectedErrorSink`, `UnexpectedErrorReport` | types | Receives the cause behind each collapsed `500 BYMAX_INTERNAL_ERROR`; see [Recording the cause of a 500](#recording-the-cause-of-a-500). |
|
|
1919
|
+
| `buildErrorEnvelope` | function | Pure builder assembling an `ErrorEnvelope`. |
|
|
1920
|
+
| `ErrorEnvelope`, `ErrorDetails`, `BuildErrorEnvelopeInput` | types | The envelope contract and its builder input. |
|
|
1921
|
+
| `BymaxTimingMiddleware` | class | The request-timing middleware, applied to every route when timing is enabled. |
|
|
1922
|
+
| `UNMATCHED_ROUTE` | constant | The bounded label recorded when a request matched no route (`<unmatched>`). |
|
|
1923
|
+
| `TimingInterceptor` | class | **Deprecated, registered nowhere.** `BymaxTimingMiddleware` replaced it as the recorder because guards run before interceptors, so it never saw a request a guard rejected; wiring it by hand next to the middleware records a second sample for every request that reaches a handler. Kept so code that wired it by hand keeps compiling. |
|
|
1924
|
+
| `ITimingSink`, `RequestTimingSample` | types | The timing-sink contract and its sample shape. |
|
|
1925
|
+
| `BYMAX_BAD_GATEWAY` … `BYMAX_VALIDATION_FAILED` | constants | The full error-code catalog (see [Error envelope](#-error-envelope)). |
|
|
1926
|
+
| `codeForStatus` | function | Derives a catalog code from an HTTP status. |
|
|
1879
1927
|
|
|
1880
1928
|
### `./pagination`
|
|
1881
1929
|
|
|
@@ -1911,14 +1959,15 @@ in the sections above.
|
|
|
1911
1959
|
|
|
1912
1960
|
### `./openapi`
|
|
1913
1961
|
|
|
1914
|
-
| Export | Kind | Description
|
|
1915
|
-
| -------------------------------------------------------------------------------------- | ------------------- |
|
|
1916
|
-
| `applyBymaxOpenApi` | function | Builds and mounts the document; call it before `app.listen()`.
|
|
1917
|
-
| `OpenApiMountOutcome` | type | What the helper did: mounted at a path, or skipped with a reason.
|
|
1918
|
-
| `DiscardedComponent` | type | A contributed component entry the document already declared.
|
|
1919
|
-
| `OpenApiSkipReason` | type | Why it was skipped: `'disabled'` or `'production'`.
|
|
1920
|
-
| `BymaxOpenApiContributor`, `BYMAX_OPENAPI_CONTRIBUTOR_METADATA` | decorator, constant | Marks a provider as describing its own routes, and the metadata key behind it.
|
|
1921
|
-
| `
|
|
1962
|
+
| Export | Kind | Description |
|
|
1963
|
+
| -------------------------------------------------------------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------- |
|
|
1964
|
+
| `applyBymaxOpenApi` | function | Builds and mounts the document; call it before `app.listen()`. |
|
|
1965
|
+
| `OpenApiMountOutcome` | type | What the helper did: mounted at a path, or skipped with a reason. |
|
|
1966
|
+
| `DiscardedComponent` | type | A contributed component entry the document already declared. |
|
|
1967
|
+
| `OpenApiSkipReason` | type | Why it was skipped: `'disabled'` or `'production'`. |
|
|
1968
|
+
| `BymaxOpenApiContributor`, `BYMAX_OPENAPI_CONTRIBUTOR_METADATA` | decorator, constant | Marks a provider as describing its own routes, and the metadata key behind it. |
|
|
1969
|
+
| `BYMAX_OPENAPI_CONTRACT_VERSION` | constant | The version of the fragment contract, currently `1`; a fragment declares it as `contractVersion`. |
|
|
1970
|
+
| `IOpenApiContributor`, `OpenApiFragment`, `OpenApiFragmentObject`, `OpenApiHandlerKey` | types | The contributor contract and the shape of what it returns. |
|
|
1922
1971
|
|
|
1923
1972
|
## 🧩 Compatibility
|
|
1924
1973
|
|
package/dist/index.d.cts
CHANGED
|
@@ -15,9 +15,9 @@ interface EnvelopeOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
exposeInternals?: boolean;
|
|
17
17
|
}
|
|
18
|
-
/** Request-timing
|
|
18
|
+
/** Request-timing middleware configuration. */
|
|
19
19
|
interface TimingOptions {
|
|
20
|
-
/** Register the timing
|
|
20
|
+
/** Register the request-timing middleware (`BymaxTimingMiddleware`). Default: `true`. */
|
|
21
21
|
enabled?: boolean;
|
|
22
22
|
/** Samples above this threshold are flagged as slow. No default (unset). */
|
|
23
23
|
slowRequestThresholdMs?: number;
|
|
@@ -265,7 +265,7 @@ interface MetricsOptions {
|
|
|
265
265
|
interface BymaxCoreModuleOptions {
|
|
266
266
|
/** Error-envelope exception filter. Default: enabled. */
|
|
267
267
|
envelope?: EnvelopeOptions;
|
|
268
|
-
/** Request
|
|
268
|
+
/** Request-timing middleware. Default: enabled. */
|
|
269
269
|
timing?: TimingOptions;
|
|
270
270
|
/** Liveness and readiness endpoints. Default: enabled. */
|
|
271
271
|
health?: HealthOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,9 +15,9 @@ interface EnvelopeOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
exposeInternals?: boolean;
|
|
17
17
|
}
|
|
18
|
-
/** Request-timing
|
|
18
|
+
/** Request-timing middleware configuration. */
|
|
19
19
|
interface TimingOptions {
|
|
20
|
-
/** Register the timing
|
|
20
|
+
/** Register the request-timing middleware (`BymaxTimingMiddleware`). Default: `true`. */
|
|
21
21
|
enabled?: boolean;
|
|
22
22
|
/** Samples above this threshold are flagged as slow. No default (unset). */
|
|
23
23
|
slowRequestThresholdMs?: number;
|
|
@@ -265,7 +265,7 @@ interface MetricsOptions {
|
|
|
265
265
|
interface BymaxCoreModuleOptions {
|
|
266
266
|
/** Error-envelope exception filter. Default: enabled. */
|
|
267
267
|
envelope?: EnvelopeOptions;
|
|
268
|
-
/** Request
|
|
268
|
+
/** Request-timing middleware. Default: enabled. */
|
|
269
269
|
timing?: TimingOptions;
|
|
270
270
|
/** Liveness and readiness endpoints. Default: enabled. */
|
|
271
271
|
health?: HealthOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bymax-one/nest-core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"description": "Zero-dependency NestJS 11 application foundation kit: error-envelope exception filter, request-timing middleware, pagination helpers, health endpoints with indicator discovery, an optional Prometheus metrics endpoint with a contribution contract, OpenAPI documents in development, and OpenTelemetry trace correlation.",
|
|
5
5
|
"author": "Bymax One <support@bymax.one>",
|
|
6
6
|
"license": "MIT",
|