import * as _homer0_jimple from '@homer0/jimple'; import { J as Jimpex } from '../../index-DAUqbQ6h.js'; import { Response } from 'express'; import { Statuses } from '../../utils/fns/statuses.js'; import { SimpleConfig } from '@homer0/simple-config'; import '../../types/express.js'; import '../../types/http.js'; import 'https'; import 'http'; import 'spdy'; import 'node-fetch'; import '../../types/utils.js'; import '@homer0/path-utils'; import '@homer0/simple-logger'; import '@homer0/events-hub'; import 'statuses'; /** * The options to construct a {@link ResponsesBuilder}. * * @group Services/ResponsesBuilder */ type ResponsesBuilderConstructorOptions = { /** * A dictionary with the dependencies to inject. */ inject: { config: SimpleConfig; statuses: Statuses; }; }; /** * The options to build a response for a post message. * * @group Services/ResponsesBuilder */ type HTMLPostMessageResponseOptions = { /** * The response object generated by the application. */ res: Response; /** * The title for the HTML. */ title: string; /** * The contents of the post message. */ message: string; /** * The status code for the response. * * @default 200 */ status?: number | string; /** * From which object will the `postMessage` method called from. * * @default 'window.opener' */ target?: string; /** * Whether or not to call `window.close` after sending the message. * * @default true */ close?: boolean; /** * In case `close` is set to `true`, this option is to specify how many milliseconds * should be waited before closing the window. * * @default 700 */ closeDelay?: number; }; /** * The options to build a response for JSON. * * @group Services/ResponsesBuilder */ type JSONResponseOptions = { /** * The response object generated by the application. */ res: Response; /** * The actual data for the response. It will be added in a `data` property. */ data: unknown; /** * The status code for the response. * * @default 200 */ status?: number | string; /** * Extra information to include inside the `metadata` object. */ metadata?: object; }; /** * A utility service to build responses. * * @group Services * @group Services/ResponsesBuilder */ declare class ResponsesBuilder { /** * The application configuration, to get the `version` and the `postMessagesPrefix`. */ protected readonly _config: SimpleConfig; /** * The utility service to get HTTP status codes. */ protected readonly _statuses: Statuses; /** * @param options The options to construct the service. */ constructor({ inject: { config, statuses } }: ResponsesBuilderConstructorOptions); /** * Generates and send an HTML response that emits a post message. * The post message will be prefixed with the value of the configuration setting * `postMessagesPrefix`. * * @param options The options to customize how the HTML is generated. */ htmlPostMessage(options: HTMLPostMessageResponseOptions): void; /** * Generates and sends a JSON response. * * @param options The options to customize how the JSON is generated. * @example * *