Scope bridge API carried by Store.Storage.
export interface StorageApi {
readonly StorageApi.at: <Input extends StoreSpec | StoreContractValue>(scopeKey: string, input: Input) => Effect.Effect<StoreHandleOf<Input>, StoreScopeNotRegistered>at: <function (type parameter) Input in <Input extends StoreSpec | StoreContractValue>(scopeKey: string, input: Input): Effect.Effect<StoreHandleOf<Input>, StoreScopeNotRegistered>Input extends import StoreSpecStoreSpec | import StoreContractValueStoreContractValue>(
scopeKey: stringscopeKey: string,
input: Input extends StoreSpec | StoreContractValueinput: function (type parameter) Input in <Input extends StoreSpec | StoreContractValue>(scopeKey: string, input: Input): Effect.Effect<StoreHandleOf<Input>, StoreScopeNotRegistered>Input,
) => import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<import StoreHandleOfStoreHandleOf<function (type parameter) Input in <Input extends StoreSpec | StoreContractValue>(scopeKey: string, input: Input): Effect.Effect<StoreHandleOf<Input>, StoreScopeNotRegistered>Input>, import StoreScopeNotRegisteredStoreScopeNotRegistered>;
readonly StorageApi.changes: (scopeKey: string) => Effect.Effect<Stream.Stream<StoreChangeEvent, StoreJournalDecodeError>, StoreScopeNotRegistered, Scope>changes: (
scopeKey: stringscopeKey: string,
) => import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<
import StreamStream.interface Stream<out A, out E = never, out R = never>A Stream<A, E, R> describes a program that can emit many A values, fail
with E, and require R.
Details
Streams are pull-based with backpressure and emit chunks to amortize effect
evaluation. They support monadic composition and error handling similar to
Effect, adapted for multiple values.
Example (Creating and consuming streams)
import { Console, Effect, Stream } from "effect"
const program = Effect.gen(function*() {
yield* Stream.make(1, 2, 3).pipe(
Stream.map((n) => n * 2),
Stream.runForEach((n) => Console.log(n))
)
})
Effect.runPromise(program)
// Output:
// 2
// 4
// 6
Stream<import StoreChangeEventStoreChangeEvent, import StoreJournalDecodeErrorStoreJournalDecodeError>,
import StoreScopeNotRegisteredStoreScopeNotRegistered,
Scope
>;
}