Where to do the EntityManager request fork.
When using registerGlobalOrm, a "close" hook is always registered. Then, depending on this setting, auto forking may happen in one of two points - a Nitro request hook or a (global) Nitro middleware.
"hook" does it at a Nitro request hook. If fine-grained control over the forking behavior is desired, it can be performed at any Nitro request hook registered before the call to registerGlobalOrm. This is the default behavior, and when combined with ModuleOptions.routeOptions being set to a boolean, it can be more efficient, as the setting is done at startup time, and per-request overrides are not even checked for.
"middleware" does it at (global) Nitro middleware. If fine-grained control over the forking behavior is desired, it can be performed at any Nitro request hook (regardless of when that hook was registered), or via nuxt config's "routeRules", which adds a route override over the defaults defined by ModuleOptions.routeOptions. Note that the middleware is always triggered per request, even with ModuleOptions.routeOptions being set to a boolean.
Setting this option to false
disables auto forking altogether.
Optional
forceDefault force close option.
This is used in closeOrm whenever a force option is not explicitly provided. Notably, this includes the close hook registered with registerGlobalOrm.
Optional
forkDefault fork options.
This is used in initOrm and registerGlobalOrm when the forkOptionsFactory function is either undefined, or returns undefined.
Optional
overridesOverrides of the default options.
If an instance is not in this map, all the default options are used.
If an instance in its map, but misses a given option, the defaults for that option are used.
If an instance is in this map and specifies an option, the values are NOT merged, but instead, the specified value here is used in its entirety.
Optional
routeDefault route options for auto forking.
When using registerGlobalOrm, a "close" hook is always registered. Then, depending on the setting ModuleOptions.autoForking, auto forking may happen in one of two points - a Nitro request hook or a (global) Nitro middleware.
Per-route rules can be defined in nuxt config's "routeRules", but if the "mikroOrm" option is not specified for the route, it will use the defaults here.
Setting to true
performs a fork for all requests (default if left undefined).
Setting to false
skips forking for all requests.
Setting an object allows further customizing the different known types of requests for which fork should or should not happen. Defaults in the object are all "false".
Note that setting a boolean, combined with ModuleOptions.autoForking being set to "hook" enforces
the setting at startup time, whereas an object enforces it at request time regardless of whether
ModuleOptions.autoForking was set to "hook" or "middleware".
Setting this option to false
while ModuleOptions.autoForking is set to "middleware"
effectively
disables auto forking by default, while letting you enable it per route via Nuxt's route rules.
Optional
api?: booleanWhether to fork on api requests (URLs beginning with "/api/").
Optional
islandWhether to fork on island component requests (URLs beginning with "/__nuxt_island/").
Optional
routes?: booleanWhether to fork on any request other than api or island components.
Options to configure the module with.
Available in nuxt config from the "mikroOrm" key.
Copied to "runtimeConfig.mikroOrm" and "nitro.runtimeConfig.mikroOrm", when those are not defined.