0.9.1 • Published 10 months ago

@blackglory/geyser-js v0.9.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

geyser-js

Install

npm install --save @blackglory/geyser-js
# or
yarn add @blackglory/geyser-js

API

GeyserClient

interface IRateLimiterConfig extends JSONObject {
  duration: number | null
  limit: number | null
}

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

class GeyserClient {
  static create(options: IGeyserClientOptions): Promise<GeyserClient>

  close(): Promise<void>

  getAllRateLimiterIds(timeout?: number): Promise<string[]>

  getRateLimiter(rateLimiterId: string, timeout?: number): Promise<IRateLimiterConfig | null>

  setRateLimiter(
    rateLimiterId: string
  , config: IRateLimiterConfig
  , timeout?: number
  ): Promise<void>

  removeRateLimiter(rateLimiterId: string, timeout?: number): Promise<void>

  /**
   * 重置速率限制器的状态.
   * 
   * @throws {RateLimiterNotFound}
   */
  resetRateLimiter(rateLimiterId: string, timeout?: number): Promise<void>

  /**
   * @throws {RateLimiterNotFound}
   */
  acquireToken(rateLimiterId: string, timeout?: number): Promise<void>
}

/**
 * 速率限制器在未经配置的情况下, 相当于不存在.
 */
class RateLimiterNotFound extends CustomError {}
0.9.1

10 months ago

0.9.0

12 months ago

0.8.1

1 year ago

0.8.0

1 year ago

0.7.1

1 year ago

0.7.0

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.4

1 year ago

0.5.5

1 year ago

0.5.3

2 years ago

0.3.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago