# @albertomarturelo/sii-core 中文文档

规范地址：https://npmcn.com/package/%40albertomarturelo/sii-core/

版本：0\.19\.0
npm 元数据更新时间：2026-10-29T13:49:37.139Z
中文译文更新时间：2026-11-06T20:48:46.279Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40albertomarturelo/sii-core
原文对照：https://npmcn.com/package/%40albertomarturelo/sii-core/?lang=original
项目主页：https://github.com/albertomarturelo/sii#readme
源码仓库：https://github.com/albertomarturelo/sii

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：1.4 MB，308 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：1 个
- peer 依赖：playwright ^1\.49\.0
- 首次发布：2026-07-03T01:27:26.118Z
- 最新版本发布：2026-10-29T13:49:36.738Z
- 近 30 天下载量：2366（2026-10-06 至 2026-11-04，npm 官方下载统计）
- 已发布版本数：20（近 12 个月 20 个）

## 中文简介

共享 SII 域名核心:rut, config (prod hostnames),合同,任务,接合. 一个节点库;外部副作用(门户,秘密,审计,时钟)通过接缝(ADR-003)注入.

## 安装

```sh
npm install @albertomarturelo/sii-core
```

也可以使用：`pnpm add @albertomarturelo/sii-core`、`yarn add @albertomarturelo/sii-core`、`bun add @albertomarturelo/sii-core`

## README

# @ albertomarturelo/ sii- core (英语)

共享的 SII (Servicio de Impuestos Internos,智利)域核心——引擎 后边 `sii` CLI 和 英国 `sii-mcp` 服务器。 节点图书馆: 操作护栏(喉咙、审计、证书处理、以操作为中心) 身份模型)住在这里, 所以一个消费者 代码与任务层 和第一党表面一样.

> **开源 (MIT).** 见 [ADR-018 (英语)](https://npmcn.com/package/docs/decisions/018-public-release-mit-license.md) 财务报告和审定财务报表 [ADR-019 (英语)](https://npmcn.com/package/docs/decisions/019-publish-public-npm-personal-scope.md)发布到 页:1 **公共npm登记**. (耳机 `0.x` gitHub 软件包的释放是私密的 页:1 `@altumstack` 范围——ADR-015;已取代。 )

## 安装

```bash
pnpm add @albertomarturelo/sii-core
# or: npm install @albertomarturelo/sii-core
```

`zod` 成为依附者. **`playwright` 是可选对等点** (ADR-016号): 仅默认 `PortalDriver` (单位:千美元) `@albertomarturelo/sii-core/node` 子路径)需要它. 如果您使用默认驱动程序, 即您实际驱动一个真实的浏览器 SII — 安装加铬二进制一次:

```bash
pnpm add playwright
pnpm exec playwright install chromium
```

如果你自己注射的话 `PortalDriver` (或只使用任务/原始内容),跳过 这完全——主桶进口剧作家或 `node:*`。 。 。 .

## 使用量

消费者建设 `Runtime` (连接节点默认的构成根) 适配器,来自 `./node` 和电话 **任务** ——公共经营. 永远不要穿过任务层进入子模块;它绕过护栏 (ADR-003) (英语).

```ts
import { authStatus, rcvSummary } from '@albertomarturelo/sii-core';
import { createNodeRuntime } from '@albertomarturelo/sii-core/node';

const runtime = createNodeRuntime();

// Who is the current session operating as? (pure-local read)
const status = await authStatus(runtime);

// Read the RCV compra summary for a period (body-RUT surface — `rut` optional).
const resumen = await rcvSummary(runtime, { periodo: '2026-05', side: 'compra' });
console.log(JSON.stringify(resumen, null, 2));
```

任务返回纯 JSON 序列大小对象( 无) `Date`编号 :`Map`编号 :`Set`——即: 图书馆合同(ADR-012)。 认证是一个明确的动词: 任务消耗 a 活动或活动 `NotAuthenticated`; 仅 `login` 薄荷一两. 登录打开 一个真正的浏览器,用户在其中键入其 Clave( cookies- only; 密码从不) 跨越库边界——ADR-006.

### 注射自己的接缝

外部副作用是接口(`PortalDriver`, (中文(简体) ), `KeyValueStore`, (中文(简体) ), `AuditSink`, (中文(简体) ), `Clock`(中文(简体) ). `createNodeRuntime` 接受一个 `Partial<Runtime>` 联 合 国 覆盖,所以部分再利用是一个支持路径——例如. 节点默认为您的 自己的审计槽和门户驱动程序(一个嵌入的应用程序的被调解的浏览器):

```ts
import { createNodeRuntime } from '@albertomarturelo/sii-core/node';

const runtime = createNodeRuntime({ audit: myAuditSink, portal: myPortalDriver });
```

内装假船 `testing` 所以消费者的测试 永远不会触摸真实 SII,键盘,或时钟——组装 `Runtime` 他们:

```ts
import { testing, type Runtime } from '@albertomarturelo/sii-core';

const runtime: Runtime = {
  clock: new testing.FixedClock(new Date('2026-06-29T12:00:00Z')),
  audit: new testing.RecordingAuditSink(),
  store: new testing.InMemoryKeyValueStore(),
  portal: new testing.FakePortalDriver({ requestPublic: () => '<html>…</html>' }),
};
```

## 里面的东西

-   **认证/ 身份** ——单一账户,以运行为中心的会话模式(ADR-005).
-   **读取表面** —— 说 `rcv`, (中文(简体) ), `f22`, (中文(简体) ), `f29`, (中文(简体) ), `bte`, (中文(简体) ), `dte` (授权,公开).
-   **原始人** —— 说 `Rut` (模式11), `Periodo` 编号 : `Anio`音标 `HOSTS`审计.

见 [`docs/ARCHITECTURE.md`](https://npmcn.com/package/docs/ARCHITECTURE.md) 财务报告和审定财务报表 [`docs/ROADMAP.md`](https://npmcn.com/package/docs/ROADMAP.md) 为全貌,和 [`CHANGELOG.md`](https://npmcn.com/package/%40albertomarturelo/sii-core/CHANGELOG.md) 用于发行笔记.

## 释放(维护者)

核心释放与CLI和MCP表面结合,从a `v*` 标签,面向公众 没有。 程序在回购中 [`CONTRIBUTING.md` § 释放](https://github.com/albertomarturelo/sii/blob/main/CONTRIBUTING.md#releasing-maintainers)。 。 。 .

## 常见问题

### @albertomarturelo/sii-core 是什么？

共享 SII 域名核心:rut, config \(prod hostnames\),合同,任务,接合\. 一个节点库;外部副作用\(门户,秘密,审计,时钟\)通过接缝\(ADR-003\)注入\.

### 如何安装 @albertomarturelo/sii-core？

在项目目录运行 npm install @albertomarturelo/sii-core，或使用 pnpm add / yarn add / bun add。

### @albertomarturelo/sii-core 支持 TypeScript 吗？

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

### @albertomarturelo/sii-core 支持 ESM 还是 CommonJS？

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

### @albertomarturelo/sii-core 可以商用吗？

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

### @albertomarturelo/sii-core 的下载量有多少？

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

### @albertomarturelo/sii-core 还在维护吗？

最新版本 0\.19\.0 发布于 2026/10/29（9 天前）；至今共发布 20 个版本，其中过去 12 个月发布了 20 个；首次发布于 2026/07/03。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

