@albertomarturelo/sii-core

中文文档
0.19.0发布于 2026/10/29MITTypeScriptES Module近 30 天下载 2366

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

中文使用文档
文档目录5 节
  1. 安装
  2. 使用量
  3. 注射自己的接缝
  4. 里面的东西
  5. 释放(维护者)

@ albertomarturelo/ sii- core (英语)

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

开源 (MIT). 见 ADR-018 (英语) 财务报告和审定财务报表 ADR-019 (英语)发布到 页:1 公共npm登记. (耳机 0.x gitHub 软件包的释放是私密的 页:1 @altumstack 范围——ADR-015;已取代。 )

安装

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

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

pnpm add playwright
pnpm exec playwright install chromium

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

使用量

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

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> 联 合 国 覆盖,所以部分再利用是一个支持路径——例如. 节点默认为您的 自己的审计槽和门户驱动程序(一个嵌入的应用程序的被调解的浏览器):

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

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

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

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 财务报告和审定财务报表 docs/ROADMAP.md 为全貌,和 CHANGELOG.md 用于发行笔记.

释放(维护者)

核心释放与CLI和MCP表面结合,从a v* 标签,面向公众 没有。 程序在回购中 CONTRIBUTING.md § 释放。 。 。 .

版本与发布记录

@albertomarturelo/sii-core 共发布 20 个版本,首次发布于 2026/07/03;过去 12 个月发布了 20 个版本。

版本发布日期距今
0.19.0latest2026/10/299 天前
0.18.12026/10/299 天前
0.18.02026/10/2712 天前
0.17.02026/10/2612 天前
0.16.02026/10/2414 天前
0.15.02026/10/2415 天前

关于 @albertomarturelo/sii-core 的常见问题

@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 和提交记录判断。