NextDiAdapter · Next.js server API
type NextDiAdapter = object;Next.js server adapter instance created by createNextDi.
Properties
Section titled “Properties”getRootContainer
Section titled “getRootContainer”readonly getRootContainer: () => Container;Returns the long-lived root server container.
Returns
Section titled “Returns”getRequestContainer
Section titled “getRequestContainer”readonly getRequestContainer: () => Container;Returns the current RSC render-scoped child container.
Returns
Section titled “Returns”createRequestContainer
Section titled “createRequestContainer”readonly createRequestContainer: (providers?) => Container;Creates a fresh child container manually, useful in route handlers or tests.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
readonly |
Returns
Section titled “Returns”runWithRequestContainer
Section titled “runWithRequestContainer”readonly runWithRequestContainer: <TResult>(options) => Promise<Awaited<TResult>>;Runs work inside a fresh child container and disposes it in a finally
block. This does not bind the container to async context; use the callback
argument, or di-craft/node when nested async code should call
getRequestContainer().
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
|
|
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<Awaited<TResult>>
disposeRootContainer
Section titled “disposeRootContainer”readonly disposeRootContainer: () => Promise<void>;Disposes cached instances owned by the root container.
Returns
Section titled “Returns”Promise<void>