<const C extends StoreContractValue>(contract: C): <
T extends StoreScopeTag
>(
tag: T
) => T & {
readonly store: Effect.Effect<
StoreHandleFromContract<C>,
StoreScopeNotRegistered,
Storage
>
}Attach a public store spec to a resource tag (pipe combinator).
Adds yield* Tag.store resolved through the Storage bridge.
export const const withStore: <
C extends StoreContractValue
>(
contract: C
) => <T extends StoreScopeTag>(
tag: T
) => T & {
readonly store: Effect.Effect<
StoreHandleFromContract<C>,
StoreScopeNotRegistered,
Storage
>
}
Attach a public store spec to a resource tag (pipe combinator).
Adds yield* Tag.store resolved through the
Storage
bridge.
withStore = <const function (type parameter) C in <const C extends StoreContractValue>(contract: C): (<T extends StoreScopeTag>(tag: T) => T & {
readonly store: Effect.Effect<StoreHandleFromContract<C>, StoreScopeNotRegistered, Storage>;
})
C extends import StoreContractValueStoreContractValue>(
contract: const C extends StoreContractValuecontract: function (type parameter) C in <const C extends StoreContractValue>(contract: C): (<T extends StoreScopeTag>(tag: T) => T & {
readonly store: Effect.Effect<StoreHandleFromContract<C>, StoreScopeNotRegistered, Storage>;
})
C,
): (<function (type parameter) T in <T extends StoreScopeTag>(tag: T): T & {
readonly store: Effect.Effect<StoreHandleFromContract<C>, StoreScopeNotRegistered, Storage>;
}
T extends import StoreScopeTagStoreScopeTag>(tag: T extends StoreScopeTagtag: function (type parameter) T in <T extends StoreScopeTag>(tag: T): T & {
readonly store: Effect.Effect<StoreHandleFromContract<C>, StoreScopeNotRegistered, Storage>;
}
T) => function (type parameter) T in <T extends StoreScopeTag>(tag: T): T & {
readonly store: Effect.Effect<StoreHandleFromContract<C>, StoreScopeNotRegistered, Storage>;
}
T & {
readonly store: Effect.Effect<
StoreHandleFromContract<C>,
StoreScopeNotRegistered,
Storage
>
(property) store: {
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
store: 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 StoreHandleFromContractStoreHandleFromContract<function (type parameter) C in <const C extends StoreContractValue>(contract: C): (<T extends StoreScopeTag>(tag: T) => T & {
readonly store: Effect.Effect<StoreHandleFromContract<C>, StoreScopeNotRegistered, Storage>;
})
C>,
import StoreScopeNotRegisteredStoreScopeNotRegistered,
class Storageclass Storage {
Service: Service;
key: Identifier;
}
Scope bridge every store handle resolves through — provided by an app
Service
layer or
the soft-default
layerDefaultMemory
(via
withDefaultStorage
). Engines resolve
handles via
withDefault
/
withStorage
(preferred) or bridge.at.
Storage
>;
}) =>
<function (type parameter) T in <T extends StoreScopeTag>(tag: T): T & {
readonly store: Effect.Effect<StoreHandleFromContract<C>, StoreScopeNotRegistered, Storage>;
}
T extends import StoreScopeTagStoreScopeTag>(tag: T extends StoreScopeTagtag: function (type parameter) T in <T extends StoreScopeTag>(tag: T): T & {
readonly store: Effect.Effect<StoreHandleFromContract<C>, StoreScopeNotRegistered, Storage>;
}
T) =>
var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.assign<T, {
store: Effect.Effect<StoreHandleOf<C>, StoreScopeNotRegistered, Storage>;
}>(target: T, source: {
store: Effect.Effect<StoreHandleOf<C>, StoreScopeNotRegistered, Storage>;
}): T & {
store: Effect.Effect<StoreHandleOf<C>, StoreScopeNotRegistered, Storage>;
} (+3 overloads)
Copy the values of all of the enumerable own properties from one or more source objects to a
target object. Returns the target object.
assign(tag: T extends StoreScopeTagtag, {
store: Effect.Effect<
StoreHandleOf<C>,
StoreScopeNotRegistered,
Storage
>
(property) store: {
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
store: const resolve: <
C extends StoreContractValue
>(
scope: string | StoreScopeTag,
contract: C
) => Effect.Effect<
StoreHandleOf<C>,
StoreScopeNotRegistered,
Storage
>
Resolve the store handle for a scope from the storage in context (an app
Service
, or the
baked-in in-memory default). Collapses the flatMap(bridge, (b) => b.at(scope, contract)) plumbing
so consumers never touch the underlying service directly.
Fails
StoreScopeNotRegistered
when the provided storage doesn't carry this scope — the
opt-in path (e.g. persist only if the app wired durable storage for me). For the always-on
observability path, use
resolveOrDie
.
resolve(tag: T extends StoreScopeTagtag.key, contract: const C extends StoreContractValuecontract),
}) as function (type parameter) T in <T extends StoreScopeTag>(tag: T): T & {
readonly store: Effect.Effect<StoreHandleFromContract<C>, StoreScopeNotRegistered, Storage>;
}
T & {
readonly store: Effect.Effect<
StoreHandleFromContract<C>,
StoreScopeNotRegistered,
Storage
>
(property) store: {
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
store: 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 StoreHandleFromContractStoreHandleFromContract<function (type parameter) C in <const C extends StoreContractValue>(contract: C): (<T extends StoreScopeTag>(tag: T) => T & {
readonly store: Effect.Effect<StoreHandleFromContract<C>, StoreScopeNotRegistered, Storage>;
})
C>,
import StoreScopeNotRegisteredStoreScopeNotRegistered,
class Storageclass Storage {
Service: Service;
key: Identifier;
}
Scope bridge every store handle resolves through — provided by an app
Service
layer or
the soft-default
layerDefaultMemory
(via
withDefaultStorage
). Engines resolve
handles via
withDefault
/
withStorage
(preferred) or bridge.at.
Storage
>;
};