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
🌲
- Host: GitHub
- URL: https://github.com/blackglory/estore-js
- Owner: BlackGlory
- License: mit
- Created: 2022-02-06T03:10:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-10T17:35:54.000Z (about 3 years ago)
- Last Synced: 2025-02-04T06:18:22.902Z (over 1 year ago)
- Topics: browser, esm, library, nodejs, npm-package, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@blackglory/estore-js
- Size: 1.26 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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
}
```