import { Service, ServiceConstructor } from "@open-pioneer/runtime"; /** * Options for the {@link createService} function. */ export interface CreateServiceOptions { /** * References provided to the service constructor. * * @default {} */ references?: PartialServiceReferences; /** * Properties provided to the service constructor. * * @default {} */ properties?: Record; /** * The locale for i18n messages and formatting. * * @default "en" */ locale?: string; /** * The locale for embedded default messages. * * See also https://formatjs.io/docs/intl#message-descriptor * * @default "en" */ defaultMessageLocale?: string; /** * I18n messages as (messageId, message) entries. * * @default {} */ messages?: Record; } type PartialServiceReferences = { [referenceName in keyof References]?: References[referenceName] extends any[] ? Partial[] : Partial; }; /** * Creates a new service instance of `clazz`. * * The options passed into the constructor of `clazz` are taking from the `options` parameter. * * This function allows the user to define mock- or test objects as service references. * * Most type-checking features are disabled for convenience, but by default this function's types * enforce that a value provided for a reference must match the partial interface of the actually required type. * * For example, if a service depends on `{ ctx: ApplicationContext }`, this function ensures * that the test value for `ctx` implements `Partial`. * This can of course be disabled by casting the value explicitly. * * @param clazz a service class * @param options options passed to the service constructor * @returns a new instance of the given service class */ export declare function createService(clazz: ServiceConstructor, options?: CreateServiceOptions): Service; export {};