open-index/open-npm huggingface dataset:
npm package: @roasmax/comfyui
Description: A modern TypeScript SDK for ComfyUI with flexible template system and elegant callback mechanisms
Author: roasmax
Latest version: 1.1.0

# @roasmax/comfyui

一个现代化的 ComfyUI TypeScript SDK，专注于提供灵活的模板系统和优雅的回调机制。

## 特性

- 🎯 **类型安全**: 完整的 TypeScript 类型定义
- 🔧 **模板系统**: 灵活的工作流模板管理和参数化
- 🔄 **实时监控**: WebSocket 实时事件监听
- 📦 **易于使用**: 简洁的 API 设计和优雅的回调机制
- 🧪 **测试覆盖**: 完整的单元测试覆盖
- 📚 **文档完善**: 详细的 API 文档和使用示例

## 安装

```bash
npm install @roasmax/comfyui
# 或
yarn add @roasmax/comfyui
# 或
pnpm add @roasmax/comfyui
```

## 快速开始

### 基本使用

```typescript
import { ComfyUIClient, WorkflowTemplate } from '@roasmax/comfyui';

// 创建客户端
const client = new ComfyUIClient({
  baseUrl: 'http://localhost:8188'
});

// 创建模板
const template = new WorkflowTemplate({
  metadata: {
    id: 'text-to-image',
    name: 'Text to Image',
    description: 'Simple text to image generation'
  },
  workflow: {
    "1": {
      "class_type": "CLIPTextEncode",
      "inputs": {
        "text": "{{prompt}}",
        "clip": ["2", 0]
      }
    }
    // ... 更多节点
  },
  parameters: {
    prompt: {
      type: 'string',
      required: true,
      description: 'The text prompt for image generation'
    }
  }
});

// 执行模板
const result = await client.executeTemplate(template, {
  prompt: 'A beautiful sunset over mountains'
}, {
  onProgress: (progress) => {
    console.log(`Progress: ${progress.progress}/${progress.max}`);
  },
  onExecuted: (result) => {
    console.log('Execution completed:', result);
  },
  onError: (error) => {
    console.error('Execution failed:', error);
  }
});
```

### 模板管理

```typescript
import { TemplateManager } from '@roasmax/comfyui';

const manager = new TemplateManager();

// 注册模板
manager.register(template);

// 按 ID 执行模板
const result = await client.executeTemplateById('text-to-image', {
  prompt: 'A serene lake at dawn'
});

// 查找模板
const templates = manager.findByCategory('image-generation');
```

## API 文档

### ComfyUIClient

主要的客户端类，提供与 ComfyUI 服务器交互的功能。

#### 构造函数

```typescript
new ComfyUIClient(config: ComfyUIClientConfig)
```

#### 方法

- `executeTemplate(template, parameters, options?)`: 执行工作流模板
- `executeTemplateById(templateId, parameters, options?)`: 按 ID 执行模板
- `connect()`: 建立 WebSocket 连接
- `disconnect()`: 断开连接

### WorkflowTemplate

工作流模板类，支持参数化和验证。

#### 构造函数

```typescript
new WorkflowTemplate(data: WorkflowTemplateData)
```

#### 方法

- `createInstance(parameters)`: 创建模板实例
- `validate(parameters)`: 验证参数
- `getParameterSchema()`: 获取参数模式

### TemplateManager

模板管理器，提供模板注册、查找和分类功能。

#### 方法

- `register(template)`: 注册模板
- `unregister(templateId)`: 注销模板
- `findById(templateId)`: 按 ID 查找模板
- `findByCategory(category)`: 按分类查找模板
- `list()`: 列出所有模板

## 开发

```bash
# 安装依赖
npm install

# 开发模式
npm run dev

# 构建
npm run build

# 测试
npm run test

# 代码检查
npm run lint
```

## 许可证

MIT License - 详见 [LICENSE](LICENSE) 文件。

## 贡献

欢迎提交 Issue 和 Pull Request！

## 更新日志

详见 [CHANGELOG.md](CHANGELOG.md)。
npm package: @roast-cms/link-tool
Description: A Node.js API for managing affiliate links.
Author: dmitrizzle
Latest version: 0.0.6

# `link-tool`

> A Node.js API for managing affiliate links.

This project creates an API service which will return a link (most likely a URL) in response to a key (could be another url) and parameters (like locale). You can use the returned URL to either create redirects (link cloaking) or to simply manage links the HTML of your blog, website, or a tool. This tools is currently in development -- see [releases](https://github.com/roast-cms/link-tool/releases).

## API:

#### GET `/recommends/widget?locale=us`

```json
{
  "link": "https://shop.com/us/widget?referral=you"
}
```

For this example to work, MongoDB collection `links` should have the following document (`vendors[].locale` is optional):

```json
{
  "link": "widget",
  "vendors": [
    {
      "url": "https://shop.com/us/widget?referral=you",
      "value": 1,
      "locale": "us"
    }
  ]
}
```

## Usage (with React):

This an example using React framework, however, the idea would be the same in any kind of project (both on server and on the browser):

1. Make an XHR (or fetch) request to `link-tool` service with the key (must be a string) as a URL path and any parameters sent as a query.
2. Wait for response.
3. Use the response to create link in the returned HTML (though this could be any language your app is built in).

```javascript
export const MyPage = () => {
  // manage state of the app (React-specific)
  const [myLink, setMyLink] = useState("#default-link");

  // send fetch request on page load and update state
  useEffect(() => {
    try {
      const linkResponse = await fetch("/recommends/widget?locale=us");
      const linkResponseJson = await linkResponse.json();
      setMyLink(linkResponseJson.link);
    } catch(error) {
      console.log(error);
    }
  },[]);

  // return page HTML
  return <div>This is my example text, oh, and look: an affiliate <a href={myLink}>link</link>!</div>
}
```

## Installation:

After you've installed [MongoDB](https://docs.mongodb.com/guides/server/install/) (I recommend you also install [MongoDB Compass](https://www.mongodb.com/products/compass)) and [Redis](https://www.javaniceday.com/post/install-and-run-redis-locally) on your machine, create `.env` file in the root of this project folder and use `.env.example` as a template. For `APPLICATION_SECRET`, you'll need to create your own string of random numbers/letters (make sure to add your `.env` to `.gitignore` and not to share it publicly).

Then you can `yarn dev` to run the sample server.

## To Do:

- [x] Initialize project in Node.js with Mongoose (MongoDB)
- [x] TypeScript and Jest
- [ ] Add locale selection logic
- [ ] Allow link disabling/archiving
npm package: @roast-cms/slate-drop-or-paste-images
Description: A Slate plugin that inserts images on drop or paste.
Latest version: 0.8.2


### `slate-drop-or-paste-images`

A Slate plugin that inserts images on drop or paste.

When trying to add support for inserting images, there are many ways that a user can do it. In total, this plugin enables six ways of inserting images. The user can choose between:

- dragging and dropping an image file from their computer.
- dragging and dropping an HTML fragment that contains an image.
- dragging and dropping a URL to an image on the web.
- pasting an HTML fragment that contains an image.
- pasting an image file from their clipboard.
- pasting a URL to an image on the web.

It does not handle dragging and dropping Slate nodes or fragments, which is handled internally by Slate by default. And it does not handle insert images via an image chooser, which you'd want to implement with your own UI components.

[View Demo ⬈](https://ianstormtaylor.github.io/slate-plugins/#/slate-drop-or-paste-images)

```js
import InsertImages from 'slate-drop-or-paste-images'
import { Editor } from 'slate-react'

// Add the plugin to your set of plugins...
const plugins = [
  InsertImages({
    extensions: ['png'],
    insertImage: (transform, file) => {
      return transform.insertBlock({
        type: 'image',
        isVoid: true,
        data: { file }
      })
    }
  })
]

// And later pass it into the Slate editor...
<Editor
  ...
  plugins={plugins}
/>
```

Option | Type | Description
--- | --- | ---
**`insertImage`** | `Function` | A transforming function that is passed a Slate `Change` and a `File` object representing an image. It should apply the proper transform that inserts the image into Slate based on your schema. It can return a promise resolved with the resulting Slate `Change`.
**`extensions`** | `Array` | An array of allowed extensions.