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

@triple-sun/hoop

v0.1.1

Published

Пакет SDK для Loop/Mattermost

Readme

🏀 Hoop

🇬🇧 Read in English

TypeScript SDK для упрощения разработки интеграций с Loop и Mattermost.

📦 Установка

npm install @triple-sun/hoop
# или
pnpm add @triple-sun/hoop
# или
yarn add @triple-sun/hoop

🎯 Что это?

Hoop предоставляет удобные и типобезопасные билдеры и фабрики для создания объектов Loop (или Mattermost) API, таких как посты, формы, диалоги, кнопки и т.д. Вместе с loop-client он сильно упрощает разработку интеграций для Loop и Mattermost.

✨ Фичи

  • 🏗️ Билдеры - Построение сложных объектов цепочками вызовов
  • 🏭 Фабрики - Шорткаты для билдеров и пресеты
  • 📘 Строгая типизация - типобезопасность, неизменяемые объекты, подсказки и автокомплит
  • 🌐 Локализация - Поддержка локализации
  • 🔗 Сделан специально для loop-client

🚀 Быстрый старт

import { HoopFactory, ActionFactory } from '@triple-sun/hoop';

// Создаем пост с вложениями и интерактивными кнопками
const post = HoopFactory.Post()
  .set('message', 'Выберите действие:')
  .attachments.append({
    text: 'Нажмите кнопку ниже',
    actions: [
      ActionFactory.Button({ name: 'approve', integration: { url: 'https://some.url/approve' } }),
      ActionFactory.Button({ name: 'reject', integration: { url: 'https://some.url/reject' } })
    ]
  })
  .build();

📚 Основные компоненты

Билдеры (Builders)

Билдеры предоставляют fluent-интерфейс для создания сложных объектов:

  • PostBuilder - Создание и изменение постов с вложениями, действиями и полями (подробный гайд)
  • FormBuilder - Построение интерактивных форм (подробный гайд)
  • DialogBuilder - Создание модальных диалогов (подробный гайд)
  • AppBindingBuilder - Создание app bindings и embedded bindings в постах
  • AttachmentBuilder - Управление вложениями постов

Фабрики (Factories)

Фабрики предлагают быстрые шорткаты для стандартных паттернов и групп билдеров:

  • HoopFactory - Создание крупных объектов - постов, форм и диалогов
  • ActionFactory - Создание кнопок и выпадающих списков
  • AttachmentFactory - Создание вложений для постов
  • BindingFactory - Настройка app bindings и embedded bindings в постах
  • FormFieldFactory - Создание полей для форм
  • DialogElementFactory - Создание элементов для диалогов

🔨 Примеры

Создание интерактивного поста

import { HoopFactory, ActionFactory } from '@triple-sun/hoop';

const post = HoopFactory.Post()
  .set('message', 'Вопрос опроса')
  .attachments.append({
    title: 'Насколько вы довольны?',
    text: 'Пожалуйста, выберите оценку',
    actions: [
      ActionFactory.Select.Static({
        name: 'rating',
        integration: { url: 'https://some.url/submit-rating' },
        options: [
          { text: 'Очень доволен', value: '5' },
          { text: 'Доволен', value: '4' },
          { text: 'Нейтрально', value: '3' },
          { text: 'Недоволен', value: '2' }
        ]
      })
    ]
  })
  .build();

Построение форм

import { HoopFactory } from '@triple-sun/hoop';

const form = HoopFactory.Form()
  .set('title', 'Регистрация пользователя')
  .fields.append(
    { type: 'text', name: 'username', display_name: 'Имя пользователя' },
    { type: 'text', name: 'email', display_name: 'Email', subtype: 'email' }
  )
  .build();

Работа с вложениями

const post = HoopFactory.Post()
  .set('message', 'Отчет о статусе')
  .attachments.append({
    color: '#00FF00',
    title: 'Сборка успешна',
    fields: [
      { title: 'Длительность', value: '2m 34s', short: true },
      { title: 'Тесты', value: '142 passed', short: true }
    ]
  })
  .build();

🌐 Локализация

Hoop поддерживает английскую и русскую локали для стандартных лейблов (например, "Отправить", "Диалог" и т.д.). По умолчанию используется русская (ru).

Для переключения локали используйте setLocale:

import { setLocale } from '@triple-sun/hoop';

setLocale('en'); // Переключиться на английские дефолтные значения

🧪 Разработка

# Запуск тестов
npm test

# Сборка проекта
npm run build

# Форматирование кода
npm run format

# Линтинг кода
npm run check

📄 Лицензия

MIT

🔗 Ссылки