@ albertomarturelo/ sii- core (英语)
共享的 SII (Servicio de Impuestos Internos,智利)域核心——引擎
后边 sii CLI 和 英国 sii-mcp 服务器。 节点图书馆:
操作护栏(喉咙、审计、证书处理、以操作为中心)
身份模型)住在这里, 所以一个消费者 代码与任务层
和第一党表面一样.
开源 (MIT). 见 ADR-018 (英语) 财务报告和审定财务报表 ADR-019 (英语)发布到 页:1 公共npm登记. (耳机
0.xgitHub 软件包的释放是私密的 页: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 § 释放。 。 。 .