IndexedDb
Browser IndexedDB primitives and key schemas for Effect applications.
This module is the low-level bridge used by the platform-browser IndexedDB integration. It provides an IndexedDb service around the browser indexedDB factory and IDBKeyRange constructor, a layerWindow layer for wiring those primitives from window, and schemas for the key shapes accepted by IndexedDB object stores and indexes.
Constructors
Layers
layerWindow
Layer that provides IndexedDb from window.indexedDB and window.IDBKeyRange, failing with a config error when they are unavailable.
Signature
declare const layerWindow: Layer.Layer<IndexedDb>;Schemas
AutoIncrement
Schema for auto-incremented IndexedDB keys, accepting integers from 1 through 2 ** 53.
When to use
Use when you need to define numeric key-path fields for IndexedDbTable definitions that use IndexedDB auto-increment keys.
Details
The schema accepts integer values from 1 through 2 ** 53, matching the range used for generated IndexedDB auto-increment keys.
See
IDBValidKeyfor the broader IndexedDB key schema
Signature
declare const AutoIncrement: Int;IDBValidKey
Schema for IndexedDB keys: strings, non-NaN numbers, valid dates, buffer sources, or arrays of those flat key values.
Signature
declare const IDBValidKey: Union<
readonly [
Union<readonly [String, Number, Date, declare<BufferSource, unknown>]>,
$Array<Union<readonly [String, Number, Date, declare<BufferSource, unknown>]>>,
]
>;Services
Service tag for browser IndexedDB primitives.
Signature
declare const IndexedDb: Service<IndexedDb, IndexedDb>;Service interface that provides the browser indexedDB factory and IDBKeyRange constructor.
Signature
interface IndexedDb {
readonly "~@effect/platform-browser/IndexedDb": "~@effect/platform-browser/IndexedDb";
readonly IDBKeyRange: {
(): IDBKeyRange;
prototype: IDBKeyRange;
bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange;
lowerBound(lower: any, open?: boolean): IDBKeyRange;
only(value: any): IDBKeyRange;
upperBound(upper: any, open?: boolean): IDBKeyRange;
};
readonly indexedDB: IDBFactory;
}
Creates an
IndexedDbservice from anIDBFactoryandIDBKeyRangeconstructor.