import "../../Operator/index.js"; import * as T from "../../Effect/index.js"; import * as E from "../../Either/index.js"; import type { Predicate, Refinement } from "../../Function/index.js"; import { NoSuchElementException } from "../../GlobalExceptions/index.js"; import * as O from "../../Option/index.js"; import * as P from "./_internal/primitives.js"; export { catchAll, catchAll_, chain, chain_, ensuring, ensuring_, fail, failWith, foldM, foldM_, map, map_, provideSome, provideSome_, retry, STM, STMEffect, STMFailException, STMRetryException, succeed, succeedWith, unit, die, dieWith } from "./_internal/primitives.js"; export { _catch as catch }; export declare const MaxFrames = 200; /** * Accesses the environment of the transaction. */ export declare function access(f: (r: R) => A): P.STM; /** * Accesses the environment of the transaction to perform a transaction. */ export declare function accessM(f: (r: R0) => P.STM): P.STM; /** * Submerges the error case of an `Either` into the `STM`. The inverse * operation of `STM.either`. */ export declare function absolve(z: P.STM>): P.STM; /** * Propagates the given environment to self. */ export declare function andThen_(self: P.STM, that: P.STM): P.STM; /** * Propagates the given environment to self. * * @ets_data_first andThen_ */ export declare function andThen(that: P.STM): (self: P.STM) => P.STM; /** * Maps the success value of this effect to the specified constant value. */ export declare function as_(self: P.STM, b: B): P.STM; /** * Maps the success value of this effect to the specified constant value. * * @ets_data_first as_ */ export declare function as(b: B): (self: P.STM) => P.STM; /** * Maps the success value of this effect to an optional value. */ export declare function asSome(self: P.STM): P.STM>; /** * Maps the error value of this effect to an optional value. */ export declare function asSomeError(self: P.STM): P.STM, A>; /** * Returns an `STM` effect whose P.failure and success channels have been mapped by * the specified pair of functions, `f` and `g`. */ export declare function bimap_(self: P.STM, g: (e: E) => E1, f: (a: A) => B): P.STM; /** * Returns an `STM` effect whose P.failure and success channels have been mapped by * the specified pair of functions, `f` and `g`. * * @ets_data_first bimap_ */ export declare function bimap(g: (e: E) => E1, f: (a: A) => B): (self: P.STM) => P.STM; /** * Recovers from specified error. * * @ets_data_first catch_ */ declare function _catch(tag: N, k: K, f: (e: Extract) => P.STM, __trace?: string): (self: P.STM) => P.STM, A1 | A>; /** * Recovers from specified error. */ export declare function catch_(self: P.STM, tag: N, k: K, f: (e: Extract) => P.STM): P.STM | E1, A | A1>; /** * Recovers from specified error. * * @ets_data_first catchTag_ */ export declare function catchTag(k: K, f: (e: Extract) => P.STM, __trace?: string): (self: P.STM) => P.STM, A1 | A>; /** * Recovers from specified error. */ export declare function catchTag_(self: P.STM, k: K, f: (e: Extract) => P.STM): P.STM | E1, A | A1>; /** * Recovers from some or all of the error cases. */ export declare function catchSome_(self: P.STM, f: (e: E) => O.Option>): P.STM; /** * Recovers from some or all of the error cases. * * @ets_data_first catchSome_ */ export declare function catchSome(f: (e: E) => O.Option>): (self: P.STM) => P.STM; /** * Simultaneously filters and flatMaps the value produced by this effect. * Continues on the effect returned from pf. */ export declare function continueOrRetryM_(fa: P.STM, pf: (a: A) => O.Option>): P.STM; /** * Simultaneously filters and flatMaps the value produced by this effect. * Continues on the effect returned from pf. * * @ets_data_first continueOrRetryM_ */ export declare function continueOrRetryM(pf: (a: A) => O.Option>): (fa: P.STM) => P.STM; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * succeed with the returned value. */ export declare function continueOrRetry_(fa: P.STM, pf: (a: A) => O.Option): P.STM; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * succeed with the returned value. * * @ets_data_first continueOrRetry_ */ export declare function continueOrRetry(pf: (a: A) => O.Option): (fa: P.STM) => P.STM; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * continue with the returned value. */ export declare function continueOrFailM_(fa: P.STM, e: E1, pf: (a: A) => O.Option>): P.STM; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * continue with the returned value. * * @ets_data_first continueOrFailM_ */ export declare function continueOrFailM(e: E1, pf: (a: A) => O.Option>): (fa: P.STM) => P.STM; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * succeed with the returned value. */ export declare function continueOrFail_(fa: P.STM, e: E1, pf: (a: A) => O.Option): P.STM; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * succeed with the returned value. * * @ets_data_first continueOrFail_ */ export declare function continueOrFail(e: E1, pf: (a: A) => O.Option): (fa: P.STM) => P.STM; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * continue with the returned value. */ export declare function continueOrFailWithM_(fa: P.STM, e: () => E1, pf: (a: A) => O.Option>): P.STM; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * continue with the returned value. * * @ets_data_first continueOrFailWithM_ */ export declare function continueOrFailWithM(e: () => E1, pf: (a: A) => O.Option>): (fa: P.STM) => P.STM; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * succeed with the returned value. */ export declare function continueOrFailWith_(fa: P.STM, e: () => E1, pf: (a: A) => O.Option): P.STM; /** * Fail with `e` if the supplied `PartialFunction` does not match, otherwise * succeed with the returned value. * * @ets_data_first continueOrFailWith_ */ export declare function continueOrFailWith(e: () => E1, pf: (a: A) => O.Option): (fa: P.STM) => P.STM; /** * Creates a composite effect that represents this effect followed by another * one that may depend on the error produced by this one. * * @ets_data_first chainError_ */ export declare function chainError(f: (e: E) => P.STM): (self: P.STM) => P.STM; /** * Creates a composite effect that represents this effect followed by another * one that may depend on the error produced by this one. */ export declare function chainError_(self: P.STM, f: (e: E) => P.STM): P.STM; /** * Checks the condition, and if it's true, returns unit, otherwise, retries. */ export declare function checkWith(predicate: () => boolean): P.STM; /** * Checks the condition, and if it's true, returns unit, otherwise, retries. */ export declare function check(predicate: boolean): P.STM; /** * Propagates self environment to that. */ export declare function compose_(self: P.STM, that: P.STM): P.STM; /** * Propagates self environment to that. * * @ets_data_first compose_ */ export declare function compose(that: P.STM): (self: P.STM) => P.STM; /** * Commits this transaction atomically. */ export declare function commit(self: P.STM): T.Effect; /** * Commits this transaction atomically, regardless of whether the transaction * is a success or a failure. */ export declare function commitEither(self: P.STM): T.Effect; /** * Kills the fiber running the effect with a `RuntimeError` that contains * the specified message. */ export declare function dieMessage(message: string): P.STM; /** * Kills the fiber running the effect with a `RuntimeError` that contains * the specified message. */ export declare function dieMessageWith(message: () => string): P.STM; /** * Converts the failure channel into an `Either`. */ export declare function either(self: P.STM): P.STM>; /** * Retrieves the environment inside an stm. */ export declare function environment(): P.STM; /** * Returns an effect that ignores errors and runs repeatedly until it eventually succeeds. */ export declare function eventually(self: P.STM): P.STM; /** * Dies with specified `unknown` if the predicate fails. * * @ets_data_first filterOrDie_ */ export declare function filterOrDie(p: Refinement, dieWith: (a: Exclude) => unknown): (fa: P.STM) => P.STM; export declare function filterOrDie(p: Predicate, dieWith: (a: A) => unknown): (fa: P.STM) => P.STM; /** * Dies with specified `unknown` if the predicate fails. */ export declare function filterOrDie_(fa: P.STM, p: Refinement, dieWith: (a: Exclude) => unknown): P.STM; export declare function filterOrDie_(fa: P.STM, p: Predicate, dieWith: (a: A) => unknown): P.STM; /** * Fails with `failWith` if the predicate fails. * * @ets_data_first filterOrFail_ */ export declare function filterOrFail(p: Refinement, failWith: (a: Exclude) => E1): (fa: P.STM) => P.STM; export declare function filterOrFail(p: Predicate, failWith: (a: A) => E1): (fa: P.STM) => P.STM; /** * Fails with `failWith` if the predicate fails. */ export declare function filterOrFail_(fa: P.STM, p: Refinement, failWith: (a: Exclude) => E1): P.STM; export declare function filterOrFail_(fa: P.STM, p: Predicate, failWith: (a: A) => E1): P.STM; /** * Applies `or` if the predicate fails. * * @ets_data_first filterOrElse_ */ export declare function filterOrElse(p: Refinement, or: (a: Exclude) => P.STM): (fa: P.STM) => P.STM; export declare function filterOrElse(p: Predicate, or: (a: A) => P.STM): (fa: P.STM) => P.STM; /** * Applies `or` if the predicate fails. */ export declare function filterOrElse_(fa: P.STM, p: Refinement, or: (a: Exclude) => P.STM): P.STM; export declare function filterOrElse_(fa: P.STM, p: Predicate, or: (a: A) => P.STM): P.STM; /** * Dies with a `Error` having the specified text message * if the predicate fails. * * @ets_data_first filterOrDieMessage_ */ export declare function filterOrDieMessage(p: Refinement, message: (a: Exclude) => string): (fa: P.STM) => P.STM; export declare function filterOrDieMessage(p: Predicate, message: (a: A) => string): (fa: P.STM) => P.STM; /** * Dies with a `Error` having the specified text message * if the predicate fails. */ export declare function filterOrDieMessage_(fa: P.STM, p: Refinement, message: (a: Exclude) => string): P.STM; export declare function filterOrDieMessage_(fa: P.STM, p: Predicate, message: (a: A) => string): P.STM; /** * Returns an effect that swaps the error/success cases. This allows you to * use all methods on the error channel, possibly before flipping back. */ export declare function flip(self: P.STM): P.STM; /** * Swaps the error/value parameters, applies the function `f` and flips the parameters back * * @ets_data_first flipWith_ */ export declare function flipWith(f: (self: P.STM) => P.STM): (self: P.STM) => P.STM; /** * Swaps the error/value parameters, applies the function `f` and flips the parameters back */ export declare function flipWith_(self: P.STM, f: (self: P.STM) => P.STM): P.STM; /** * Folds over the `STM` effect, handling both P.failure and success, but not * retry. */ export declare function fold_(self: P.STM, g: (e: E) => C, f: (a: A) => B): P.STM; /** * Folds over the `STM` effect, handling both P.failure and success, but not * retry. * * @ets_data_first fold_ */ export declare function fold(g: (e: E) => C, f: (a: A) => B): (self: P.STM) => P.STM; /** * Flattens out a nested `STM` effect. */ export declare function flatten(self: P.STM>): P.STM; /** * Unwraps the optional error, defaulting to the provided value. * * @ets_data_first flattenErrorOptionWith_ */ export declare function flattenErrorOptionWith(def: () => E2): (self: P.STM, A>) => P.STM; /** * Unwraps the optional error, defaulting to the provided value. */ export declare function flattenErrorOptionWith_(self: P.STM, A>, def: () => E2): P.STM; /** * Unwraps the optional error, defaulting to the provided value. * * @ets_data_first flattenErrorOption_ */ export declare function flattenErrorOption(def: E2): (self: P.STM, A>) => P.STM; /** * Unwraps the optional error, defaulting to the provided value. */ export declare function flattenErrorOption_(self: P.STM, A>, def: E2): P.STM; /** * Applies the function `f` to each element of the `Iterable` and * returns a transactional effect that produces a new `ReadonlyArray`. */ export declare function forEach_(it: Iterable, f: (a: A) => P.STM): P.STM; /** * Applies the function `f` to each element of the `Iterable` and * returns a transactional effect that produces a new `ReadonlyArray`. * * @ets_data_first forEach_ */ export declare function forEach(f: (a: A) => P.STM): (it: Iterable) => P.STM; /** * Lifts an `Either` into a `STM`. */ export declare function fromEitherWith(e: () => E.Either): P.STM; /** * Lifts an `Either` into a `STM`. */ export declare function fromEither(e: E.Either): P.STM; /** * Unwraps the optional success of this effect, but can fail with an None value. */ export declare function get(self: P.STM>): P.STM, A>; /** * Returns a successful effect with the head of the list if the list is * non-empty or fails with the error `None` if the list is empty. */ export declare function head(self: P.STM>): P.STM, A>; /** * Returns a new effect that ignores the success or failure of this effect. */ export declare function ignore(self: P.STM): P.STM; /** * Returns whether this effect is a failure. */ export declare function isFailure(self: P.STM): P.STM; /** * Returns whether this effect is a success. */ export declare function isSuccess(self: P.STM): P.STM; /** * Returns a successful effect if the value is `Left`, or fails with the error `None`. */ export declare function left(self: P.STM>): P.STM, B>; /** * Returns a successful effect if the value is `Left`, or fails with the error e. */ export declare function leftOrFail_(self: P.STM>, orFail: (c: C) => E1): P.STM; /** * Returns a successful effect if the value is `Left`, or fails with the error e. * * @ets_data_first leftOrFail_ */ export declare function leftOrFail(orFail: (c: C) => E1): (self: P.STM>) => P.STM; /** * Returns a successful effect if the value is `Left`, or fails with a `NoSuchElementException`. */ export declare function leftOrFailException(self: P.STM>): P.STM; /** * Depending on provided environment returns either this one or the other effect. * * @ets_data_first join_ */ export declare function join(that: P.STM): (self: P.STM) => P.STM, E1 | E, A1 | A>; /** * Depending on provided environment returns either this one or the other effect. */ export declare function join_(self: P.STM, that: P.STM): P.STM, E | E1, A | A1>; /** * Depending on provided environment returns either this one or the other effect. */ export declare function joinEither_(self: P.STM, that: P.STM): P.STM, E | E1, E.Either>; /** * Depending on provided environment returns either this one or the other effect. */ export declare function joinEither(that: P.STM): (self: P.STM) => P.STM, E | E1, E.Either>; /** * Maps from one error type to another. */ export declare function mapError_(self: P.STM, f: (a: E) => E1): P.STM; /** * Maps from one error type to another. * * @ets_data_first mapError_ */ export declare function mapError(f: (a: E) => E1): (self: P.STM) => P.STM; /** * Provides the transaction its required environment, which eliminates * its dependency on `R`. */ export declare function provideAll_(self: P.STM, r: R): P.STM; /** * Provides the transaction its required environment, which eliminates * its dependency on `R`. * * @ets_data_first provideAll_ */ export declare function provideAll(r: R): (self: P.STM) => P.STM; /** * Repeats this `STM` effect until its result satisfies the specified predicate. * * WARNING: * `repeatUntil` uses a busy loop to repeat the effect and will consume a thread until * it completes (it cannot yield). This is because STM describes a single atomic * transaction which must either complete, retry or fail a transaction before * yielding back to the Effect Runtime. * * - Use `retryUntil` instead if you don't need to maintain transaction state for repeats. * - Ensure repeating the STM effect will eventually satisfy the predicate. */ export declare function repeatUntil_(self: P.STM, f: (a: A) => boolean): P.STM; /** * Repeats this `STM` effect until its result satisfies the specified predicate. * * WARNING: * `repeatUntil` uses a busy loop to repeat the effect and will consume a thread until * it completes (it cannot yield). This is because STM describes a single atomic * transaction which must either complete, retry or fail a transaction before * yielding back to the Effect Runtime. * * - Use `retryUntil` instead if you don't need to maintain transaction state for repeats. * - Ensure repeating the STM effect will eventually satisfy the predicate. * * @ets_data_first repeatUntil_ */ export declare function repeatUntil(f: (a: A) => boolean): (self: P.STM) => P.STM; /** * Repeats this `STM` effect while its result satisfies the specified predicate. * * WARNING: * `repeatWhile` uses a busy loop to repeat the effect and will consume a thread until * it completes (it cannot yield). This is because STM describes a single atomic * transaction which must either complete, retry or fail a transaction before * yielding back to the Effect Runtime. * * - Use `retryWhile` instead if you don't need to maintain transaction state for repeats. * - Ensure repeating the STM effect will eventually not satisfy the predicate. */ export declare function repeatWhile_(self: P.STM, f: (a: A) => boolean): P.STM; /** * Repeats this `STM` effect while its result satisfies the specified predicate. * * WARNING: * `repeatWhile` uses a busy loop to repeat the effect and will consume a thread until * it completes (it cannot yield). This is because STM describes a single atomic * transaction which must either complete, retry or fail a transaction before * yielding back to the Effect Runtime. * * - Use `retryWhile` instead if you don't need to maintain transaction state for repeats. * - Ensure repeating the STM effect will eventually not satisfy the predicate. * * @ets_data_first repeatWhile_ */ export declare function repeatWhile(f: (a: A) => boolean): (self: P.STM) => P.STM; /** * Suspends creation of the specified transaction lazily. */ export declare function suspend(f: () => P.STM): P.STM; /** * "Peeks" at the success of transactional effect. */ export declare function tap_(self: P.STM, f: (a: A) => P.STM): P.STM; /** * "Peeks" at the success of transactional effect. * * @ets_data_first tap_ */ export declare function tap(f: (a: A) => P.STM): (self: P.STM) => P.STM; /** * Returns an effect with the value on the left part. */ export declare function toLeftWith(a: () => A): P.STM>; /** * Returns an effect with the value on the left part. */ export declare function toLeft(a: A): P.STM>; /** * Sequentially zips this value with the specified one, combining the values * using the specified combiner function. */ export declare function zipWith_(self: P.STM, that: P.STM, f: (a: A, b: B) => C): P.STM; /** * Sequentially zips this value with the specified one, combining the values * using the specified combiner function. * * @ets_data_first zipWith_ */ export declare function zipWith(that: P.STM, f: (a: A, b: B) => C): (self: P.STM) => P.STM; //# sourceMappingURL=core.d.ts.map