/** * Generated bundle index. Do not edit. */ import { Express, Request, RequestHandler, Response } from "express"; import { AngularNodeAppEngine, createNodeRequestHandler } from "@angular/ssr/node"; export type SitemapChangefreq = 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never'; export interface SitemapRoute { /** Route path, e.g. `/obiekty`. */ path: string; changefreq?: SitemapChangefreq; /** `0`..`1`; numbers are rendered with one decimal (`1` → `1.0`). */ priority?: number | string; } export interface SitemapOptions { routes: SitemapRoute[]; /** Languages emitted as `xhtml:link rel="alternate"`; default `['pl', 'en']`. */ languages?: string[]; /** Language served without the query param; default `'pl'`. */ defaultLanguage?: string; /** Query param carrying the language; default `'lang'`. */ langQueryParam?: string; } export interface RobotsOptions { /** Paths emitted as `Disallow:` lines. */ disallow?: string[]; } /** * `process.env` variable name, a list of names (the first one that is set * wins), or a resolver returning the value. */ export type EnvValueSource = string | readonly string[] | (() => string | undefined); /** `window.env` key → source of its value. */ export type EnvMap = Record; export interface TranslationsOptions { /** * Candidate files, first existing one wins. Default: the app's public source * file, then `translations.json` next to the browser bundle, then the Nx dist path. */ paths?: string[]; } /** Subset of the `compression` middleware options; framework-owned so the public typings need no `@types/compression`. */ export interface ICompressionOptions { /** Minimum response size (bytes, or a `bytes` string such as `'1kb'`) worth compressing. */ threshold?: number | string; /** zlib compression level, `-1`..`9`. */ level?: number; /** Decides per response whether it is compressed; replaces the default `compressible` check. */ filter?: (req: Request, res: Response) => boolean; } export interface MobilemsServerOptions { /** `import.meta.url` of the app's `server.ts`; resolves the dist folders and `isMainModule`. */ moduleUrl: string; /** Omit to serve no `/sitemap.xml` (robots then carries no `Sitemap:` line). */ sitemap?: SitemapOptions; /** `false` disables `/robots.txt`. */ robots?: RobotsOptions | false; /** Extra / overriding `window.env` keys on top of the MobilEMS defaults. */ env?: EnvMap; /** `false` disables the `/api/translations` dev endpoint. */ translations?: TranslationsOptions | false; /** Hosts appended to the ones derived from the env vars. */ allowedHosts?: string[]; /** Env vars whose hostnames are allowed for SSR fetches; default `SITE_URL`, `MULTIMEDIA_URL`, `API_URL`. */ allowedHostsEnvVars?: string[]; /** Forwarded headers trusted by `AngularNodeAppEngine`; default: the explicit nginx ingress set. */ trustProxyHeaders?: boolean | readonly string[]; /** Load `.env` via dotenv before anything else; default `true` (`/.env`). */ dotenv?: boolean | { path: string; }; /** * Compress responses; default `true`. Registered as the first middleware, so built-in routes, * static files and SSR are all compressed. Pass options to tune it, `false` to disable. */ compression?: boolean | ICompressionOptions; /** Register custom routes; runs after the built-in endpoints, before static files and SSR. */ configure?: (app: Express) => void; /** Call `app.listen` when this module is the entry point; default `true`. */ autoListen?: boolean; /** Port for `autoListen`; default `process.env.PORT` or `4000`. */ port?: number; } export interface SiteUrlRequest { protocol: string; get(name: string): string | undefined; } /** Prepends `https://` when the scheme is missing. */ export declare function withProtocol(value: string): string; /** Hostname of a URL-ish env value, or `undefined` when it does not parse. */ export declare function hostnameOf(value: string | undefined): string | undefined; /** * Canonical site origin without a trailing slash: `SITE_URL` when configured, * otherwise the request's own protocol + host. */ export declare function resolveSiteUrl(req: SiteUrlRequest, configured?: string | undefined): string; export declare const DEFAULT_ALLOWED_HOSTS_ENV_VARS: string[]; export interface BuildAllowedHostsOptions { /** Env vars to derive hostnames from. */ envVars?: string[]; /** Hosts appended verbatim. */ extra?: string[]; processEnv?: NodeJS.ProcessEnv; } /** * SSRF allow-list for `AngularNodeAppEngine`: hostnames of the configured * env URLs (the site host in both `www.` and bare form), plus `localhost` * outside production or when nothing is configured. */ export declare function buildAllowedHosts(options?: BuildAllowedHostsOptions): string[]; /** `window.env` keys every MobilEMS app exposes. */ export declare const DEFAULT_ENV_MAP: EnvMap; /** Resolves the defaults merged with `env` (same key overrides) to plain strings. */ export declare function resolveEnvValues(env?: EnvMap, processEnv?: NodeJS.ProcessEnv): Record; /** Renders the `/env.js` body. Values are JSON-encoded, so any string is safe. */ export declare function renderEnvScript(values: Record): string; export declare function createEnvScriptHandler(env?: EnvMap): RequestHandler; export declare const DEFAULT_SITEMAP_LANGUAGES: string[]; export declare const DEFAULT_SITEMAP_LANGUAGE = "pl"; /** Route URL for a language: the default language has no query param. */ export declare function localizedUrl(siteUrl: string, path: string, lang: string, options?: Pick): string; export declare function buildSitemapXml(siteUrl: string, options: SitemapOptions, lastmod?: string): string; export declare function createSitemapHandler(options: SitemapOptions): RequestHandler; export interface BuildRobotsTxtOptions extends RobotsOptions { /** Emit the `Sitemap:` line pointing at `/sitemap.xml`. */ sitemap?: boolean; } export declare function buildRobotsTxt(siteUrl: string, options?: BuildRobotsTxtOptions): string; export declare function createRobotsHandler(options?: BuildRobotsTxtOptions): RequestHandler; /** * Dev-time candidates for `translations.json`: the editable source file first * (no rebuild needed), then the copy next to the browser bundle, then the Nx * dist path for a server started from the workspace root. */ export declare function defaultTranslationPaths(browserDistFolder: string): string[]; export declare function createTranslationsHandler(paths: string[]): RequestHandler; /** * Behind an nginx ingress every request carries `x-forwarded-*`. Without trusting * them `@angular/ssr` degrades to CSR (`deoptToCSR`) and serves an empty * ``. The list is explicit because `true` covers only the standard * five and nginx also sends the non-standard `x-forwarded-scheme`. */ export declare const DEFAULT_TRUST_PROXY_HEADERS: readonly string[]; export interface MobilemsServer { app: Express; angularApp: AngularNodeAppEngine; /** Export this as `reqHandler` from `server.ts` — the Angular CLI dev server needs it. */ reqHandler: ReturnType; browserDistFolder: string; } /** * Assembles the MobilEMS SSR Express server: dotenv, SSRF allow-list, * response compression, `/env.js`, `/api/translations`, `/robots.txt`, `/sitemap.xml`, custom * routes, static files and the Angular request handler. */ export declare function createMobilemsServer(options: MobilemsServerOptions): MobilemsServer;