/** * @since 2.0.0 */ import type * as Context from "./Context.js" import type * as Effect from "./Effect.js" import * as internal from "./internal/reloadable.js" import type * as Layer from "./Layer.js" import type * as Schedule from "./Schedule.js" import type * as ScopedRef from "./ScopedRef.js" import type * as Types from "./Types.js" /** * @since 2.0.0 * @category symbols */ export const ReloadableTypeId: unique symbol = internal.ReloadableTypeId /** * @since 2.0.0 * @category symbols */ export type ReloadableTypeId = typeof ReloadableTypeId /** * A `Reloadable` is an implementation of some service that can be dynamically * reloaded, or swapped out for another implementation on-the-fly. * * @since 2.0.0 * @category models */ export interface Reloadable extends Reloadable.Variance { /** * @internal */ readonly scopedRef: ScopedRef.ScopedRef /** * @internal */ readonly reload: Effect.Effect } /** * @since 2.0.0 */ export declare namespace Reloadable { /** * @since 2.0.0 * @category models */ export interface Variance { readonly [ReloadableTypeId]: { readonly _A: Types.Invariant } } } /** * Makes a new reloadable service from a layer that describes the construction * of a static service. The service is automatically reloaded according to the * provided schedule. * * @since 2.0.0 * @category constructors */ export const auto: ( tag: Context.Tag, options: { readonly layer: Layer.Layer; readonly schedule: Schedule.Schedule } ) => Layer.Layer, E, R | In> = internal.auto /** * Makes a new reloadable service from a layer that describes the construction * of a static service. The service is automatically reloaded according to a * schedule, which is extracted from the input to the layer. * * @since 2.0.0 * @category constructors */ export const autoFromConfig: ( tag: Context.Tag, options: { readonly layer: Layer.Layer readonly scheduleFromConfig: (context: Context.Context) => Schedule.Schedule } ) => Layer.Layer, E, R | In> = internal.autoFromConfig /** * Retrieves the current version of the reloadable service. * * @since 2.0.0 * @category getters */ export const get: (tag: Context.Tag) => Effect.Effect> = internal.get /** * Makes a new reloadable service from a layer that describes the construction * of a static service. * * @since 2.0.0 * @category constructors */ export const manual: ( tag: Context.Tag, options: { readonly layer: Layer.Layer } ) => Layer.Layer, E, In> = internal.manual /** * Reloads the specified service. * * @since 2.0.0 * @category constructors */ export const reload: (tag: Context.Tag) => Effect.Effect> = internal.reload /** * @since 2.0.0 * @category context */ export const tag: (tag: Context.Tag) => Context.Tag, Reloadable> = internal.reloadableTag /** * Forks the reload of the service in the background, ignoring any errors. * * @since 2.0.0 * @category constructors */ export const reloadFork: (tag: Context.Tag) => Effect.Effect> = internal.reloadFork