@civitai/cybertipline-tools

中文文档
0.1.0发布于 2025/09/09MITTypeScriptESM + CJS近 30 天下载 1.2万

Unofficial Types and Utilities for working with the CyberTipline API

原始使用文档
文档目录8 节
  1. Installation
  2. Quick Start
  3. Requirements
  4. Features
  5. Error Handling
  6. Development Status
  7. License
  8. Resources

CyberTipline Tools

A unofficial collection of tools for interacting with the National Center for Missing & Exploited Children's CyberTipline Reporting API.

Installation

# Using pnpm
pnpm add cybertipline-tools

# Using npm
npm install cybertipline-tools

# Using yarn
yarn add cybertipline-tools

Quick Start

import { Client, Environment, IncidentType } from 'cybertipline-tools';

// Create a new client
const client = new Client({
  environment: Environment.Testing, // Use Testing for development
  credentials: {
    username: 'your-username',
    password: 'your-password',
  },
});

// Test your connection
const status = await client.getStatus();
console.log('Connected:', status.data.responseDescription);

// Submit a report
const report = await client.submitReport({
  incidentSummary: {
    incidentType: IncidentType.ChildSexTourism,
    // ... other required fields
  },
  reporter: {
    reportingPerson: {
      email: '[email protected]',
      // ... other required fields
    },
  },
});
console.log('Report ID:', report.data.reportId);

// Upload a file
const fileUpload = await client.uploadFile({
  id: report.data.reportId,
  file: new File(['...'], 'evidence.jpg'),
});
console.log('File ID:', fileUpload.data.fileId);

// Add file details
await client.submitFileDetails({
  reportId: Number(report.data.reportId),
  fileId: fileUpload.data.fileId,
  fileName: 'evidence.jpg',
  // ... other optional fields
});

// Mark report as complete
await client.finishReport({
  id: report.data.reportId,
});

Requirements

  • Node.js 22.x or later (TypeScript 5.x for type definitions)
    • Older versions may work, but are not officially verified.
  • ESM module support
    • CommonJS is exported, but not officially tested. We welcome contributions to improve this.

Features

✨ Type Safety

  • Full TypeScript support with detailed type definitions
  • Inline documentation with JSDoc comments
    • Allowing for IDE autocompletion for all APIs

🐛 Error Handling

  • Request ID extraction for all operations
  • Error handling with detailed messages

🛠️ API Support

  • GET /status - Test API connectivity

  • POST /submit - Submit new reports

  • POST /upload - Upload evidence files

  • POST /fileinfo - Add file metadata

  • POST /finish - Complete reports

  • POST /retract - Cancel reports

  • You provide JSON, we convert it to XML and back, so no need to worry about XML!

Error Handling

The client includes built-in error handling:

try {
  await client.getStatus();
} catch (error) {
  // All API errors include the Request-ID for troubleshooting
  console.error('API Error:', error.message);
  // Example: "Authentication failed (Request-ID: abc-123)"
}

Development Status

🚧 Todo

  • Schema validation (Zod?)
  • Examples and demos
  • Documentation improvements
  • Performance optimizations
  • Stabilize developer experience

🔮 Possible Future Plans

  • E2E testing against running CyberTipline test environment
  • Batch reporting support
  • XSD schema to TypeScript generation

License

MIT License - see the LICENSE file for details.

Resources

版本与发布记录

@civitai/cybertipline-tools 共发布 1 个版本,首次发布于 2025/09/09;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.0latest2025/09/091.2 年前

关于 @civitai/cybertipline-tools 的常见问题

@civitai/cybertipline-tools 是什么?

Unofficial Types and Utilities for working with the CyberTipline API

如何安装 @civitai/cybertipline-tools?

在项目目录运行 npm install @civitai/cybertipline-tools,或使用 pnpm add / yarn add / bun add。

@civitai/cybertipline-tools 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@civitai/cybertipline-tools 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@civitai/cybertipline-tools 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.18.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@civitai/cybertipline-tools 可以商用吗?

@civitai/cybertipline-tools 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@civitai/cybertipline-tools 的下载量有多少?

根据 npm 官方下载统计,@civitai/cybertipline-tools 在 2026/10/10 – 2026/11/08 这 30 天内被下载 11,701 次,日均约 390 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@civitai/cybertipline-tools 还在维护吗?

最新版本 0.1.0 发布于 2025/09/09(1.2 年前);至今共发布 1 个版本,其中过去 12 个月发布了 0 个;首次发布于 2025/09/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。