An open API service indexing awesome lists of open source software.

https://github.com/blackglory/estore-js

🌲
https://github.com/blackglory/estore-js

browser esm library nodejs npm-package typescript

Last synced: 2 months ago
JSON representation

🌲

Awesome Lists containing this project

README

          

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

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

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

export class EStoreClient {
static create(options: IEStoreClientOptions): Promise

close(): Promise

getNamespaceStats(
namespace: string
, signal?: AbortSignal
): Promise

getAllNamespaces(signal?: AbortSignal): Promise

getAllItemIds(namespace: string, signal?: AbortSignal): Promise

getAllEvents(
namespace: string
, itemId: string
, signal?: AbortSignal
): Promise

clearItemsByNamespace(namespace: string, signal?: AbortSignal): Promise

removeItem(
namespace: string
, itemId: string
, signal?: AbortSignal
): Promise

getItemSize(
namespace: string
, itemId: string
, signal?: AbortSignal
): Promise

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

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

getEvent(
namespace: string
, itemId: string
, index: number
, signal?: AbortSignal
): Promise
}
```