npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yukikoa

v0.14.0

Published

Reactive and functional-programming style telegram Bot framework based on RxJS.

Downloads

311

Readme

Yukikoa

Reactive and functional-programming style telegram Bot framework based on RxJS.

ChangeLog

v0.14.0

  1. Add plenty of wrapper and helper APIs.
  2. Add support for retry strategy
  3. Built-in logger system support v0.13.0
  4. More simple ADT definitions
  5. Long polling optimization
  6. API changed: Wrapper is now split into individual functions
  7. New APIs: reply and replyText to make interaction easier
  8. Test was moved into the CI test module of monorepo
  9. Support customize API server. It can also be fetched from Context object now

Quick Start

TODO

Combine Plugins

Use the pipe function from rxjs is an easy way to combine plugins but note that as plugins are transformers of Effect, on which the data flow is reverse of the data that contained in an Observable, you need to reverse the piping order of the data flow of the observables. For instance, consider two plugins:

  import { pipe } from 'rxjs'
  const pluginAcc = createPluginViaMapFunc((n: number) => n + 1)
  const pluginDouble = createPluginViaMapFunc((n: number) => n + n)
  const pluginCombineA = pipe(pluginAcc, pluginDouble) // This plugin will convert value n to n * 2 + 1

TODO Maybe provide a function combinePlugins?

Retry Strategy

Added in v0.14.0

可在 fetchOptionsretrymaxRetryTimes 中设置重试策略。retry 选项默认支持两种策略:'auto''never',同时也可以传入一个自定义的 RetryConfig 对象来配置,该对象将作为参数传递给 rxjsretry 操作符 (此时 maxRetryTimes 参数无效)。

  • auto: 使用 Yukikoa 内建的自动重试策略算法,具体如下:
    • 如果服务器返回参数不包含 retryAfter,则使用二进制指数退避算法,每次重试的延迟翻倍
    • 如果服务器返回参数包含 retryAfter,则将延迟设置为retryAfter + 1
    • 重试次数的上限由 maxRetryTimes 决定,默认为 5
  • never: 永不重试。在该设置下,maxRetryTimes 的设置无效

Core Concepts

Effect

In ADT level, it's just an OperationFunction of RxJS:

 type Effect<P> = OperatorFunction<P, void>

Semantically, it indicates an effect that processes the incoming telegram updates. A typical effect may have the signature

Effect<Context{},void>

Plugin

The Plugin is defined as

type Plugin<S,T> = (source: Effect<S>) => Effect<T>

i.e. a Plugin is actually an Effect transformer which accepts an Effect as input and outputs a new Effect.