@atcute/ozone

中文文档
4.0.14发布于 2026/10/270BSDES Module近 30 天下载 3272

臭氧(工具.ozone.*)

中文使用文档
文档目录3 节
  1. 使用量
  2. 与 @atcute/client
  3. 与 @atcute/lex-cli

@ atcute/ 分区

臭氧 (tools.ozone.*) 计划定义

npm install @atcute/ozone

使用量

import { is, type $type } from '@atcute/lexicons';
import { ToolsOzoneModerationDefs } from '@atcute/ozone';

type LabelEvent = $type.enforce<ToolsOzoneModerationDefs.ModEventLabel>;

const evt: LabelEvent = {
    $type: 'tools.ozone.moderation.defs#modEventLabel',
    createLabelVals: ['awesome'],
    negateLabelVals: [],
};

is(ToolsOzoneModerationDefs.modEventLabelSchema, evt);
// -> true

与 @atcute/client

选择这3个选项之一来登记环境声明

// tsconfig.json
{
    "compilerOptions": {
        "types": ["@atcute/ozone"],
    },
}
// env.d.ts
/// <reference types="@atcute/ozone" />
// index.ts
import type {} from '@atcute/ozone';

现在所有 XRPC 操作都应该在客户端可见

import { Client, simpleFetchHandler } from '@atcute/client';

const client = new Client({
    handler: simpleFetchHandler({ service: 'https://mod.example.com' }),
});

const response = await client.post('tools.ozone.moderation.emitEvent', {
    input: {
        createdBy: 'did:plc:ia76kvnndjutgedggx2ibrem',
        subject: {
            $type: 'com.atproto.repo.strongRef',
            uri: 'at://did:plc:ia76kvnndjutgedggx2ibrem/app.bsky.feed.post/3l6uo5yecnsu7',
            cid: 'bafyreibluyqpqno2ixrhdkztquyarpug7k6t4en6ug7g3sw6fonzzmakbq',
        },
        event: {
            $type: 'tools.ozone.moderation.defs#modEventLabel',
            createLabelVals: ['awesome'],
            negateLabelVals: [],
        },
    },
});
// ...

与 @atcute/lex-cli

创建参考臭氧类型的词汇表时,请配置 lex-cli 从此导入 软件包 :

// file: lex.config.js
import { defineLexiconConfig } from '@atcute/lex-cli';

export default defineLexiconConfig({
    files: ['lexicons/**/*.json'],
    outdir: 'src/lexicons/',
    imports: ['@atcute/ozone'],
});

版本与发布记录

@atcute/ozone 共发布 47 个版本,首次发布于 2024/09/02;过去 12 个月发布了 19 个版本。

版本发布日期距今
4.0.14latest2026/10/2711 天前
4.0.132026/10/2217 天前
4.0.122026/10/1028 天前
4.0.102026/09/101 个月前
4.0.92026/08/122 个月前
4.0.82026/08/023 个月前

关于 @atcute/ozone 的常见问题

@atcute/ozone 是什么?

臭氧(工具.ozone.*)

如何安装 @atcute/ozone?

在项目目录运行 npm install @atcute/ozone,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@atcute/lexicons(^2.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@atcute/ozone 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/atcute__ozone 是否存在。

@atcute/ozone 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@atcute/ozone 可以商用吗?

@atcute/ozone 使用 0BSD 许可。几乎没有限制:可自由使用、修改和分发,连保留版权声明也不要求。以上为概括,不构成法律意见,请以许可原文为准。

@atcute/ozone 的下载量有多少?

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

@atcute/ozone 还在维护吗?

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