Skip to content

StoreInput

What every store checks of its input before its driver sees it: that the input matches its schema, and whatever else the store requires of a write, such as that a record belongs to the space the store is bound to. A caller passes typed values, but a TypeScript type does not enforce a schema’s refinements, so each store decodes what it is given once, here, and its driver trusts it.

Since v0.2.0

A read’s inputs, checked against their schemas; a malformed one fails the read.

Signature

declare const read: (
store: string
) => <S extends Schema.Top>(
operation: string,
schema: S,
input: S["Type"]
) => Effect.Effect<S["Type"], StoreError.StoreError, never>

Source

Since v0.2.0

A write’s inputs, checked against their schemas; a malformed one is rejected. reject says why a well-formed input is still refused, such as a record of another space, or nothing to accept it.

Signature

declare const write: (
store: string,
reject?: (value: unknown) => string | undefined
) => <S extends Schema.Top>(
operation: string,
schema: S,
input: S["Type"]
) => Effect.Effect<S["Type"], StoreError.StoreError, never>

Source

Since v0.2.0