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

next-box

v2.1.104

Published

Библиотека для разработки расширений, компонентов и работы с данными на платформе [NextBox](https://next-box.ru/).

Downloads

2,246

Readme

Библиотека для разработки расширений, компонентов и работы с данными на платформе NextBox.

NPM Установка

npm install next-box

CDN Установка

<script src="
https://cdn.jsdelivr.net/npm/next-box@latest/index.min.js
"></script>

Простой пример использования

import { NextBox, StorageApi, Transport } from 'next-box';

const nb = new NextBox();

nb.init((state) => {
    const api = new StorageApi(state);
    ...

    api.download()
        .then((response) => response.json())
        .then((result) => {
            ...
        })
});

Навигация

В родительском фрейме

  • Перейти на / Transport.navigate('/', {}, '_parent')
  • Изменить queryParams на текущей странице Transport.navigate('', {'key': 'value'}, '_parent')

Открыть в новом окне

  • Перейти на / Transport.navigate('/', {}, '_blank')
  • Перейти на / и добавить queryParams Transport.navigate('/', {'key': 'value'}, '_blank')

Управление url текущим фреймом

  • Перейти на / Transport.navigate('/', {}, '_self')
  • Перейти на / и добавить queryParams Transport.navigate('/', {'key': 'value'}, '_self')

Инстанс NextBox

export declare class NextBox extends EventEmitter {
    /**
     *  Хранит актуальное состояние подключения
     */
    state?: AppState;

    /**
     *  Метод подключения к приложению, будет вызван после получения актуального состояния
     */
    init(handler?: (state: AppState) => void): void;
}

Инстанс StorageApi

export declare class StorageApi extends Api {
    /**
     * Получить список файлов
     */
    list(params: StorageRequestListParams): Promise<ResponseList<StorageElement>>;

    /**
     * Информация о файле (модель)
     */
    info(path: string): Promise<StorageElement>;

    /**
     * Создать файл или папку
     */
    create(name: string, path: string, type: 'dir' | 'file'): Promise<ResponseItem<StorageElement>>;

    /**
     * Удалить файл или папку
     */
    delete(path: string, hard?: boolean): Promise<any>;

    /**
     * Возвращает полный путь для загрузки файла
     */
    makeDownloadPath(path?: string, options?: MakePathOption): string;

    /**
     * Возвращает полный путь к изображению предварительного просмотра
     */
    makeImagePreview(path?: string, options?: MakePathOption): string;

    /**
     * Получить тело файла
     */
    download(path?: string): Promise<Response>;

    /**
     * Отправьте запрос на изменение файла
     */
    replace(body: any, path?: string): Promise<Response | null>;

    /**
     * Синхронная запись в файлы
     */
    liveReplace(body: any, path?: string, finalize?: () => void): void;

    /**
     * Загрузить файл
     */
    upload(path: string, file: File): Promise<{
        row: StorageElement;
    }>;

    /**
     * Загрузить файл по URL-адресу
     */
    uploadNet(path: string, url: string, overwrite?: boolean): Promise<StorageElement>;

    /**
     * Создать файд метаданных для расширения
     */
    createMeta(name?: string, path?: string): Promise<{
        row: StorageElement;
    }>;

    /**
     * Прочитать метаданные расширения
     */
    readMeta(path?: string): Promise<any>;

    /**
     * Сохранить метаданные расширения
     */
    saveMeta(body: any, path?: string): Promise<any>;

    /**
     * Относительный путь (откуда вызывается редактор)
     */
    relativePath(path?: string, defaultPath?: string): string;

    /**
     * Возвращает действительный URL-адрес в API (storage или FCA)
     */
    makeApiPath(...arg: string[]): URL;

    /**
     * Возвращает имя метафайла расширения (берется из extenstion.name.ru)
     */
    get metaName(): string;
}

Инстанс UserApi

export declare class UserApi extends Api {
    /**
     * Выход из системы
     */
    logout(): Promise<void>;

    /**
     * Получить данные пользователя по его id
     */
    get(id: number): Promise<User>;

    /**
     * Список пользователей
     */
    list(params: RequestUserListParams): Promise<ResponseList<User>>;

    /**
     * Вернуть удаленного пользователя
     */
    restore(id: number): Promise<void>;

    /**
     * Удалить пользователя
     */
    delete(id: number, params?: {
        hard: boolean;
    }): Promise<void>;

    /**
     * Обновить данные пользователя
     */
    update(data: UpdateUserParams): Promise<ResponseItem<User>>;

    /**
     * Создать нового пользователя
     */
    create(data: CreateUserParams): Promise<ResponseItem<User>>;

    /**
     * Создать API токен
     */
    createToken(data: {
        name: string;
        expire_in: string | null;
    }): Promise<UserToken>;

    /**
     * Получить список пользователей
     */
    listToken(params: RequestBaseParams): Promise<ResponseList<UserToken>>;

    /**
     * Удалить токен
     */
    deleteToken(id: number): Promise<void>;

    /**
     * Изменить пароль
     */
    changePassword(data: {
        new_password: string;
        old_password: string;
    }): Promise<{
        success: boolean;
    }>;

    /**
     * Получить данные о себе
     */
    me(): Promise<ResponseItem<User>>;

    /**
     * Загрузить аватар
     */
    meUploadAvatar(file: Blob, fileName: string): Promise<{
        file_path: string;
    }>;

    /**
     * Удалить аватар
     */
    meDeleteAvatar(): Promise<void>;

    /**
     * Получить список активных сессий
     */
    meListSession(params: RequestBaseParams): Promise<ResponseList<UserSession>>;

    /**
     * Удалить сессию по id или все
     */
    meDeleteSession(id?: number): Promise<void>;
}