/// /// import { IncomingMessage, ServerResponse } from 'node:http'; import { AnyObject } from 'loopback-datasource-juggler'; import { SWStats } from 'swagger-stats-sf'; export interface IServiceConfig { useCustomSequence?: boolean; useSequelize?: boolean; } export type OASPathDefinition = AnyObject; export declare const AuthCacheSourceName = "AuthCache"; export declare const AuthDbSourceName = "AuthDB"; export interface CoreConfig { name?: string; configObject?: i18n.ConfigurationOptions; enableObf?: boolean; obfPath?: string; tenantContextEncryptionKey?: string; openapiSpec?: Record; tenantContextMiddleware?: boolean; disablei18n?: boolean; /** * In order to hide or alter some path from the definition provided by swagger stats, `modifyPathDefinition` * callback can be used. It'll get called for each of the path specified in the `openapiSpec` provided. * @param path The name of the API path. * @param pathDefinition The definition object containing method and other details. * @returns `null` if the path needs to be omitted from the spec else return the `pathDefinition` either in the original form as received in the argument or by modifying it as per the needs. */ modifyPathDefinition?: (path: string, pathDefinition: OASPathDefinition) => OASPathDefinition | null; authentication?: boolean; swaggerUsername?: string; swaggerPassword?: string; authenticateSwaggerUI?: boolean; swaggerStatsConfig?: Omit; swaggerAuthenticate?: (req?: IncomingMessage, username?: string, password?: string) => boolean; } /** * The function `addTenantId` extracts and decrypts a tenant ID from the request headers and adds it to * the response object. * @param {IncomingMessage} req - The `req` parameter is of type `IncomingMessage`, which represents an * incoming HTTP request. * @param res - The `res` parameter is used to send the response back to the client after processing the * request. * @param {AnyObject} reqResponse - In the provided function, the 'tenant-id' property of reqResponse is being set based on the * 'tenant-id' header value from the incoming request. * @param {string} [secretKey] - The `secretKey` parameter in the `addTenantId` function is an optional * parameter of type `string`. It is used for decrypting the `tenant-id` value if provided. If the * `secretKey` is not provided, the `tenant-id` value is directly assigned to `req */ export declare function addTenantId(req: IncomingMessage, res: ServerResponse, reqResponse: AnyObject, secretKey?: string): void; export type TenantIdEncryptionFn = (secretKey: string, tenantId: string) => Promise;