feat(navigation): add bindProductionNavigation(config) DI helper

This commit is contained in:
2026-05-05 08:50:47 +02:00
parent 02aee1ec23
commit 5620fae116
2 changed files with 15 additions and 1 deletions

View File

@@ -6,7 +6,8 @@
"exports": {
".": "./src/index.ts",
"./cms": "./src/integrations/cms/index.ts",
"./api": "./src/integrations/api/router.ts"
"./api": "./src/integrations/api/router.ts",
"./di/bind-production": "./src/di/bind-production.ts"
},
"scripts": {
"build": "tsc --noEmit",

View File

@@ -0,0 +1,13 @@
import type { SanitizedConfig } from "payload";
import { navigationContainer } from "./container";
import { NAVIGATION_SYMBOLS } from "./symbols";
import { PayloadHeaderRepository } from "../infrastructure/repositories/payload-header.repository";
export function bindProductionNavigation(config: SanitizedConfig): void {
if (navigationContainer.isBound(NAVIGATION_SYMBOLS.IHeaderRepository)) {
navigationContainer.unbind(NAVIGATION_SYMBOLS.IHeaderRepository);
}
navigationContainer
.bind(NAVIGATION_SYMBOLS.IHeaderRepository)
.toConstantValue(new PayloadHeaderRepository(config));
}