/** * @since 2.0.0 */ import type * as Effect from "./Effect.js"; import type * as Schedule from "./Schedule.js"; import type * as Scope from "./Scope.js"; import type * as Types from "./Types.js"; import type * as Unify from "./Unify.js"; /** * @since 2.0.0 * @category symbols */ export declare const ResourceTypeId: unique symbol; /** * @since 2.0.0 * @category symbols */ export type ResourceTypeId = typeof ResourceTypeId; /** * A `Resource` is a possibly resourceful value that is loaded into memory, and * which can be refreshed either manually or automatically. * * @since 2.0.0 * @category models */ export interface Resource extends Effect.Effect, Resource.Variance { readonly [Unify.typeSymbol]?: unknown; readonly [Unify.unifySymbol]?: ResourceUnify; readonly [Unify.ignoreSymbol]?: ResourceUnifyIgnore; } /** * @category models * @since 3.9.0 */ export interface ResourceUnify extends Effect.EffectUnify { Resource?: () => Extract>; } /** * @category models * @since 3.9.0 */ export interface ResourceUnifyIgnore extends Effect.EffectUnifyIgnore { Effect?: true; } /** * @since 2.0.0 */ export declare namespace Resource { /** * @since 2.0.0 * @category models */ interface Variance { readonly [ResourceTypeId]: { _A: Types.Invariant; _E: Types.Invariant; }; } } /** * Creates a new `Resource` value that is automatically refreshed according to * the specified policy. Note that error retrying is not performed * automatically, so if you want to retry on errors, you should first apply * retry policies to the acquisition effect before passing it to this * constructor. * * @since 2.0.0 * @category constructors */ export declare const auto: (acquire: Effect.Effect, policy: Schedule.Schedule) => Effect.Effect, never, R | R2 | Scope.Scope>; /** * Retrieves the current value stored in the cache. * * @since 2.0.0 * @category getters */ export declare const get: (self: Resource) => Effect.Effect; /** * Creates a new `Resource` value that must be manually refreshed by calling * the refresh method. Note that error retrying is not performed * automatically, so if you want to retry on errors, you should first apply * retry policies to the acquisition effect before passing it to this * constructor. * * @since 2.0.0 * @category constructors */ export declare const manual: (acquire: Effect.Effect) => Effect.Effect, never, Scope.Scope | R>; /** * Refreshes the cache. This method will not return until either the refresh * is successful, or the refresh operation fails. * * @since 2.0.0 * @category utils */ export declare const refresh: (self: Resource) => Effect.Effect; //# sourceMappingURL=Resource.d.ts.map