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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@typexim/web-sdk

v0.0.14

Published

```javascript import { create, enums, events } from '@typexim/web-sdk';

Readme

TypeX WEB SDK

调用方式

import { create, enums, events } from '@typexim/web-sdk';

const chat = create('sdk', {
  httpHost: 'https://coco.typex.im',
  websocketHost: 'wss://w.typexim.com'
})

chat.setLogLevel(enums.LogLevel.info);

chat.login({
    user_code: 'xxxx'
});
chat.once(
    events.CHAT_SDK_EVENT.SDK_READY,
    async () => {
        chat.on(
            events.CHAT_SDK_EVENT.FEED_LIST_UPDATED
            ({ is_sync_completed, list }) => {
                console.log('feed列表', list);
            }
        );

        const result = await chat.getFeedList();
        if (result.ok) {
          console.log('feed列表', result.data.list);
        } else {
          console.log(result.code);
          console.log(result.msg);
        }
    }
);

API清单

事件

  1. on
  2. off

事件码

  1. SDK_READY
  2. SDK_NOT_READY
  3. MESSAGE_RECEIVED
  4. MESSAGE_EDITED
  5. MESSAGE_RECALLED
  6. MESSAGE_REACTION_UPDATED
  7. MESSAGE_RECEIPT_RECEIVED
  8. FEED_LIST_UPDATED
  9. ROOM_MESSAGE_RECEIVED
  10. SYSTEM_NOTICE_RECEIVED

初始化

  1. create

设置日志级别

  1. setLogLevel

SDK是否ready

  1. isReady

登录

  1. login
  2. logout
  3. getLoginUser

会话Feed

  1. createSingleChatFeed
  2. deleteFeed
  3. getFeedList(不分页,最多100条)
  4. getFeedDetail
  5. getFeedMemberList
  6. setMute({ feedId, isMute },成功返回 Feed,失败返回 null)
  7. markFeedAsUnRead({ feedId },成功返回 true,失败返回 false)
  8. setPin({ feedId, pin },成功返回 Feed,失败返回 null)
  9. setName({ feedId, name },成功返回 Feed,失败返回 null)
  10. setSave({ feedId, isSave },成功返回 Feed,失败返回 null)
  11. setArchive({ feedId, isArchive },成功返回 Feed,失败返回 null)
  12. setMark({ feedId, isMark },成功返回 Feed,失败返回 null)

会话Feed消息

  1. getFeedMessageList(分页)
  2. createCustomMessage(可选 reply_msg_id / thread_msg_id / thread_id)
  3. sendMessageToFeed(custom 发送会转发 reply_msg_id / thread_msg_id / thread_id)
  4. sendMessageReadReceipt
  5. removeMessages(透传 twoWay / deleteFeed,deleteFeed 默认 0)
  6. addReaction
  7. deleteReaction

Feed 分组 Folder

  1. getFolders(可选 folderIds;folder.id 为 string)

聊天室Room

  1. joinRoom
  2. leaveRoom
  3. getJoinedRooms

聊天室Room消息

  1. getRoomRecentMessageList(最近50条)
  2. sendMessageToRoom

注意事项

  1. 同个浏览器可同时打开多个窗口:若已有窗口处于登录态,新窗口会自动复用其登录态并各自维持一条 WebSocket;若先打开的窗口尚未登录,另一窗口登录成功后也会广播给已打开的窗口。旧窗口不会被踢出。无已登录窗口时需自行调用 login。任一窗口调用 logout 成功后,其它窗口会同步本地登出并触发 SDK_NOT_READY。每个窗口同一时刻只有一条推送 WebSocket;刷新页面会先关闭旧连接,再由新页面建立新连接。
  2. WebSocket 连接会带上 ws_route(取值与本浏览器共享的 deviceId 相同),供网关做粘性会话;同一浏览器多个 Tab 的 ws_route 一致。