# @blackglory/estore-js

> ```sh npm install --save @blackglory/estore-js # or yarn add @blackglory/estore-js ```

Latest version **0.7.2** (published 2026-05-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @blackglory/estore-js
pnpm add @blackglory/estore-js
yarn add @blackglory/estore-js
bun add @blackglory/estore-js
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.7.2 |
| Published | 2026-05-24 |
| First published | 2022-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | BlackGlory |
| Maintainers | black_glory |

## Links

- npm: https://www.npmjs.com/package/@blackglory/estore-js
- Repository: https://github.com/BlackGlory/estore-js
- Homepage: https://github.com/BlackGlory/estore-js#readme
- Issues: https://github.com/BlackGlory/estore-js/issues
- npm.io page: https://npm.io/package/@blackglory/estore-js

## Recent versions

- 0.7.2 (latest) — 2026-05-24
- 0.7.1 — 2026-05-24
- 0.7.0 — 2026-03-14
- 0.6.1 — 2025-07-22
- 0.6.0 — 2025-05-29
- 0.5.3 — 2023-06-10
- 0.5.2 — 2023-03-28
- 0.5.1 — 2023-03-28
- 0.5.0 — 2023-03-28
- 0.4.1 — 2023-03-11
- 0.4.0 — 2023-02-05
- 0.3.0 — 2023-01-29
- 0.2.4 — 2022-10-31
- 0.2.3 — 2022-10-23
- 0.2.2 — 2022-10-21
- … 10 more at https://npm.io/package/@blackglory/estore-js/versions

## README

# estore-js
## Install
```sh
npm install --save @blackglory/estore-js
# or
yarn add @blackglory/estore-js
```

## API
### EStoreClient
```ts
interface INamespaceStats {
  items: number
}

interface IEStoreClientOptions {
  server: string
  timeout?: number
  retryIntervalForReconnection?: number
}

interface IEStoreClientRequestOptions {
  signal?: AbortSignal
  timeout?: number | false
}

class EStoreClient {
  static create(options: IEStoreClientOptions): Promise<EStoreClient>

  close(): Promise<void>

  getNamespaceStats(
    namespace: string
  , signalOrOptions?: AbortSignal | IEStoreClientRequestOptions
  ): Promise<INamespaceStats>

  getAllNamespaces(
    signalOrOptions?: AbortSignal | IEStoreClientRequestOptions
  ): Promise<string[]>

  getAllItemIds(
    namespace: string
  , signalOrOptions?: AbortSignal | IEStoreClientRequestOptions
  ): Promise<string[]>

  getAllEvents(
    namespace: string
  , itemId: string
  , signalOrOptions?: AbortSignal | IEStoreClientRequestOptions
  ): Promise<JSONValue[]>

  clearItemsByNamespace(
    namespace: string
  , signalOrOptions?: AbortSignal | IEStoreClientRequestOptions
  ): Promise<void>

  removeItem(
    namespace: string
  , itemId: string
  , signalOrOptions?: AbortSignal | IEStoreClientRequestOptions
  ): Promise<void>

  getItemSize(
    namespace: string
  , itemId: string
  , signalOrOptions?: AbortSignal | IEStoreClientRequestOptions
  ): Promise<number>

  /**
   * @param nextEventIndex 如果指定, 则会在不匹配下一个index时抛出EventIndexConflict错误.
   * @throws {EventIndexConflict}
   */
  appendEvent(
    namespace: string
  , itemId: string
  , event: JSONValue
  , nextEventIndex?: number
  , signalOrOptions?: AbortSignal | IEStoreClientRequestOptions
  ): Promise<void>

  /**
   * @param lastEventIndex 如果指定, 则会在不匹配最后一个index时抛出EventIndexConflict错误.
   * @throws {EventIndexConflict}
   */
  popEvent(
    namespace: string
  , itemId: string
  , lastEventIndex?: number
  , signalOrOptions?: AbortSignal | IEStoreClientRequestOptions
  ): Promise<void>

  getEvent(
    namespace: string
  , itemId: string
  , index: number
  , signalOrOptions?: AbortSignal | IEStoreClientRequestOptions
  ): Promise<JSONValue | null>
}
```

---
_Source: https://npm.io/package/@blackglory/estore-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
