Skip to content

@gluonjs/core / packages/ssr/src/tenant / TenantResolutionRequest

Interface: TenantResolutionRequest ​

Properties ​

headers ​

readonly headers: Readonly<Record<string, string | undefined>>


hostname ​

readonly hostname: string


url ​

readonly url: string

Example ​

Provide hostname and headers to an application-owned tenant resolver:

ts
import { createTenantContext, deserializeTenantContext, installTenant, resolveTenant, serializeTenantContext, tenantInjectionKey, type TenantContext, type TenantJsonValue, type TenantResolutionRequest, type TenantResolver } from '@gluonjs/ssr/tenant';
const request: TenantResolutionRequest = { url: 'https://acme.example/', hostname: 'acme.example', headers: {} };
const resolver: TenantResolver = (input) => ({ id: input.hostname, locale: 'en-GB' });
const context: TenantContext = await resolveTenant(request, resolver);
const explicit = createTenantContext({ id: 'acme' } satisfies TenantJsonValue, { hostname: request.hostname });
const serialized = serializeTenantContext(context);
const restored = deserializeTenantContext(serialized);
console.log(installTenant, tenantInjectionKey, explicit, restored);

Version-matched documentation. Examples are checked against the public package contracts.