@albertomarturelo/sii-core 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +114 -0
- package/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/adapters/fake/index.d.ts +98 -0
- package/dist/adapters/fake/index.d.ts.map +1 -0
- package/dist/adapters/fake/index.js +131 -0
- package/dist/adapters/fake/index.js.map +1 -0
- package/dist/adapters/node/index.d.ts +22 -0
- package/dist/adapters/node/index.d.ts.map +1 -0
- package/dist/adapters/node/index.js +65 -0
- package/dist/adapters/node/index.js.map +1 -0
- package/dist/adapters/node/portal.d.ts +8 -0
- package/dist/adapters/node/portal.d.ts.map +1 -0
- package/dist/adapters/node/portal.js +222 -0
- package/dist/adapters/node/portal.js.map +1 -0
- package/dist/adapters/node/response.d.ts +21 -0
- package/dist/adapters/node/response.d.ts.map +1 -0
- package/dist/adapters/node/response.js +48 -0
- package/dist/adapters/node/response.js.map +1 -0
- package/dist/audit/audit.d.ts +8 -0
- package/dist/audit/audit.d.ts.map +1 -0
- package/dist/audit/audit.js +15 -0
- package/dist/audit/audit.js.map +1 -0
- package/dist/audit/index.d.ts +2 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/index.js +2 -0
- package/dist/audit/index.js.map +1 -0
- package/dist/auth/auth.d.ts +43 -0
- package/dist/auth/auth.d.ts.map +1 -0
- package/dist/auth/auth.js +219 -0
- package/dist/auth/auth.js.map +1 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/login-error.d.ts +8 -0
- package/dist/auth/login-error.d.ts.map +1 -0
- package/dist/auth/login-error.js +18 -0
- package/dist/auth/login-error.js.map +1 -0
- package/dist/auth/session.d.ts +31 -0
- package/dist/auth/session.d.ts.map +1 -0
- package/dist/auth/session.js +52 -0
- package/dist/auth/session.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/config.d.ts +38 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +40 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/errors/errors.d.ts +56 -0
- package/dist/errors/errors.d.ts.map +1 -0
- package/dist/errors/errors.js +62 -0
- package/dist/errors/errors.js.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +2 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/format/format.d.ts +5 -0
- package/dist/format/format.d.ts.map +1 -0
- package/dist/format/format.js +14 -0
- package/dist/format/format.js.map +1 -0
- package/dist/format/index.d.ts +2 -0
- package/dist/format/index.d.ts.map +1 -0
- package/dist/format/index.js +2 -0
- package/dist/format/index.js.map +1 -0
- package/dist/identity/identity.d.ts +56 -0
- package/dist/identity/identity.d.ts.map +1 -0
- package/dist/identity/identity.js +93 -0
- package/dist/identity/identity.js.map +1 -0
- package/dist/identity/index.d.ts +2 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +2 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +9 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +22 -0
- package/dist/node.js.map +1 -0
- package/dist/periodo/anio.d.ts +15 -0
- package/dist/periodo/anio.d.ts.map +1 -0
- package/dist/periodo/anio.js +42 -0
- package/dist/periodo/anio.js.map +1 -0
- package/dist/periodo/index.d.ts +3 -0
- package/dist/periodo/index.d.ts.map +1 -0
- package/dist/periodo/index.js +3 -0
- package/dist/periodo/index.js.map +1 -0
- package/dist/periodo/periodo.d.ts +19 -0
- package/dist/periodo/periodo.d.ts.map +1 -0
- package/dist/periodo/periodo.js +55 -0
- package/dist/periodo/periodo.js.map +1 -0
- package/dist/portal/bte-comunas.d.ts +9 -0
- package/dist/portal/bte-comunas.d.ts.map +1 -0
- package/dist/portal/bte-comunas.js +400 -0
- package/dist/portal/bte-comunas.js.map +1 -0
- package/dist/portal/bte-emit.d.ts +70 -0
- package/dist/portal/bte-emit.d.ts.map +1 -0
- package/dist/portal/bte-emit.js +266 -0
- package/dist/portal/bte-emit.js.map +1 -0
- package/dist/portal/bte.d.ts +55 -0
- package/dist/portal/bte.d.ts.map +1 -0
- package/dist/portal/bte.js +215 -0
- package/dist/portal/bte.js.map +1 -0
- package/dist/portal/dte-public.d.ts +36 -0
- package/dist/portal/dte-public.d.ts.map +1 -0
- package/dist/portal/dte-public.js +192 -0
- package/dist/portal/dte-public.js.map +1 -0
- package/dist/portal/f22/declaraciones.d.ts +37 -0
- package/dist/portal/f22/declaraciones.d.ts.map +1 -0
- package/dist/portal/f22/declaraciones.js +86 -0
- package/dist/portal/f22/declaraciones.js.map +1 -0
- package/dist/portal/f22/grid.d.ts +14 -0
- package/dist/portal/f22/grid.d.ts.map +1 -0
- package/dist/portal/f22/grid.js +51 -0
- package/dist/portal/f22/grid.js.map +1 -0
- package/dist/portal/f22/historial.d.ts +34 -0
- package/dist/portal/f22/historial.d.ts.map +1 -0
- package/dist/portal/f22/historial.js +66 -0
- package/dist/portal/f22/historial.js.map +1 -0
- package/dist/portal/f22/index.d.ts +7 -0
- package/dist/portal/f22/index.d.ts.map +1 -0
- package/dist/portal/f22/index.js +11 -0
- package/dist/portal/f22/index.js.map +1 -0
- package/dist/portal/f22/observaciones.d.ts +20 -0
- package/dist/portal/f22/observaciones.d.ts.map +1 -0
- package/dist/portal/f22/observaciones.js +38 -0
- package/dist/portal/f22/observaciones.js.map +1 -0
- package/dist/portal/f22/shared.d.ts +32 -0
- package/dist/portal/f22/shared.d.ts.map +1 -0
- package/dist/portal/f22/shared.js +130 -0
- package/dist/portal/f22/shared.js.map +1 -0
- package/dist/portal/f22-codigos.d.ts +28 -0
- package/dist/portal/f22-codigos.d.ts.map +1 -0
- package/dist/portal/f22-codigos.js +141 -0
- package/dist/portal/f22-codigos.js.map +1 -0
- package/dist/portal/f29-codigos.d.ts +15 -0
- package/dist/portal/f29-codigos.d.ts.map +1 -0
- package/dist/portal/f29-codigos.js +552 -0
- package/dist/portal/f29-codigos.js.map +1 -0
- package/dist/portal/f29.d.ts +62 -0
- package/dist/portal/f29.d.ts.map +1 -0
- package/dist/portal/f29.js +244 -0
- package/dist/portal/f29.js.map +1 -0
- package/dist/portal/rcv.d.ts +62 -0
- package/dist/portal/rcv.d.ts.map +1 -0
- package/dist/portal/rcv.js +252 -0
- package/dist/portal/rcv.js.map +1 -0
- package/dist/portal/representacion.d.ts +24 -0
- package/dist/portal/representacion.d.ts.map +1 -0
- package/dist/portal/representacion.js +153 -0
- package/dist/portal/representacion.js.map +1 -0
- package/dist/rut/index.d.ts +2 -0
- package/dist/rut/index.d.ts.map +1 -0
- package/dist/rut/index.js +2 -0
- package/dist/rut/index.js.map +1 -0
- package/dist/rut/rut.d.ts +16 -0
- package/dist/rut/rut.d.ts.map +1 -0
- package/dist/rut/rut.js +70 -0
- package/dist/rut/rut.js.map +1 -0
- package/dist/seams/index.d.ts +126 -0
- package/dist/seams/index.d.ts.map +1 -0
- package/dist/seams/index.js +6 -0
- package/dist/seams/index.js.map +1 -0
- package/dist/tasks/auth.d.ts +16 -0
- package/dist/tasks/auth.d.ts.map +1 -0
- package/dist/tasks/auth.js +22 -0
- package/dist/tasks/auth.js.map +1 -0
- package/dist/tasks/bte.d.ts +52 -0
- package/dist/tasks/bte.d.ts.map +1 -0
- package/dist/tasks/bte.js +169 -0
- package/dist/tasks/bte.js.map +1 -0
- package/dist/tasks/dte.d.ts +9 -0
- package/dist/tasks/dte.d.ts.map +1 -0
- package/dist/tasks/dte.js +30 -0
- package/dist/tasks/dte.js.map +1 -0
- package/dist/tasks/f22.d.ts +69 -0
- package/dist/tasks/f22.d.ts.map +1 -0
- package/dist/tasks/f22.js +189 -0
- package/dist/tasks/f22.js.map +1 -0
- package/dist/tasks/f29.d.ts +67 -0
- package/dist/tasks/f29.d.ts.map +1 -0
- package/dist/tasks/f29.js +213 -0
- package/dist/tasks/f29.js.map +1 -0
- package/dist/tasks/operate.d.ts +22 -0
- package/dist/tasks/operate.d.ts.map +1 -0
- package/dist/tasks/operate.js +34 -0
- package/dist/tasks/operate.js.map +1 -0
- package/dist/tasks/rcv.d.ts +17 -0
- package/dist/tasks/rcv.d.ts.map +1 -0
- package/dist/tasks/rcv.js +76 -0
- package/dist/tasks/rcv.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAErF,MAAM,wBAAwB,GAAG,OAAO,CAAC;AACzC,gFAAgF;AAChF,mFAAmF;AACnF,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,mFAAmF;AACnF,MAAM,UAAU,GAAG,2DAA2D,CAAC;AAsC/E,wEAAwE;AACxE,MAAM,C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,CAAC,CAAC;IACnC,MAAM,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,CAAC,CAAC;IACzF,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AAC3C,CAAC;AAED;;mFAEmF;AACnF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAgB;IAClD,OAAO,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACtC,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,qBAAqB,CAAC,6CAA6C,CAAC,CAAC;QACjF,CAAC;QACD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAmB,UAAU,CAAC,CAAC,CAAC;QACnF,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QACzF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Extract SII's verbatim login-error cause from the failed-login page body text.
|
|
2
|
+
* Observed 2026-06-28 (docs/sii-contract/auth-login.md): the page renders the
|
|
3
|
+
* human cause, then a line `El código de este mensaje es <código>`. The line
|
|
4
|
+
* BEFORE the código line is the cause (e.g. "La Clave Tributaria ingresada no es
|
|
5
|
+
* correcta…"). Returns `"<causa> (<código line>)"`, or `null` if the shape
|
|
6
|
+
* changed (the caller falls back to a generic no-retry message). */
|
|
7
|
+
export declare function parseSiiLoginError(bodyText: string): string | null;
|
|
8
|
+
//# sourceMappingURL=login-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-error.d.ts","sourceRoot":"","sources":["../../src/auth/login-error.ts"],"names":[],"mappings":"AAIA;;;;;qEAKqE;AACrE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOlE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Pure parser for SII's failed-login page (rendered on zeusr.sii.cl at
|
|
2
|
+
// /cgi_AUT2000/CAutInicio.cgi). Kept DOM-free so it is unit-testable in Node;
|
|
3
|
+
// the Playwright adapter passes it the page's `innerText` (adapters/node/portal.ts).
|
|
4
|
+
/** Extract SII's verbatim login-error cause from the failed-login page body text.
|
|
5
|
+
* Observed 2026-06-28 (docs/sii-contract/auth-login.md): the page renders the
|
|
6
|
+
* human cause, then a line `El código de este mensaje es <código>`. The line
|
|
7
|
+
* BEFORE the código line is the cause (e.g. "La Clave Tributaria ingresada no es
|
|
8
|
+
* correcta…"). Returns `"<causa> (<código line>)"`, or `null` if the shape
|
|
9
|
+
* changed (the caller falls back to a generic no-retry message). */
|
|
10
|
+
export function parseSiiLoginError(bodyText) {
|
|
11
|
+
const lines = bodyText
|
|
12
|
+
.split('\n')
|
|
13
|
+
.map((l) => l.trim())
|
|
14
|
+
.filter(Boolean);
|
|
15
|
+
const i = lines.findIndex((l) => /El c[oó]digo de este mensaje/i.test(l));
|
|
16
|
+
return i > 0 ? `${lines[i - 1]} (${lines[i]})` : null;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=login-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-error.js","sourceRoot":"","sources":["../../src/auth/login-error.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,8EAA8E;AAC9E,qFAAqF;AAErF;;;;;qEAKqE;AACrE,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,KAAK,GAAG,QAAQ;SACnB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,OAAO,CAAC,CAAC;IACnB,MAAM,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,+BAA+B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { KeyValueStore, PortalSession, Runtime } from '../seams/index.js';
|
|
2
|
+
export interface StoredSession {
|
|
3
|
+
/** Canonical session-principal RUT (read from the portal, not a credential). */
|
|
4
|
+
readonly rut: string;
|
|
5
|
+
/** Cookies-only storage state (opaque to the core). */
|
|
6
|
+
readonly cookies: unknown;
|
|
7
|
+
readonly savedAt: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function readSession(store: KeyValueStore): Promise<StoredSession | null>;
|
|
10
|
+
export declare function writeSession(store: KeyValueStore, session: StoredSession): Promise<void>;
|
|
11
|
+
export declare function deleteSession(store: KeyValueStore): Promise<void>;
|
|
12
|
+
export interface SessionContext {
|
|
13
|
+
/** Canonical session-principal RUT (who is logged in). */
|
|
14
|
+
readonly sessionRut: string;
|
|
15
|
+
/** Canonical RUT this operation acts as: `--rut` override > operate pointer > self
|
|
16
|
+
* (ADR-005). Body-RUT facades put this in the request; session-keyed surfaces
|
|
17
|
+
* ignore it and authorize by `sessionRut`. */
|
|
18
|
+
readonly operatingRut: string;
|
|
19
|
+
}
|
|
20
|
+
/** Acquire a live `PortalSession` from the stored cookies-only session and run `fn`
|
|
21
|
+
* against it. This is how DOMAIN TASKS reach SII: they consume a session, they
|
|
22
|
+
* NEVER mint one (only `login` mints — ADR-006, sii-py ADR-019). The operating/body
|
|
23
|
+
* RUT is resolved by precedence (override > pointer > self — ADR-005) and handed to
|
|
24
|
+
* `fn`. The session is ALWAYS closed; a missing local session raises
|
|
25
|
+
* `NotAuthenticated`. It does NOT eagerly probe liveness — an expired cookie jar
|
|
26
|
+
* surfaces as the facade's own typed error (representacion.ts) — and it NEVER
|
|
27
|
+
* retries after a SII block (CONVENTIONS). */
|
|
28
|
+
export declare function withSession<T>(runtime: Runtime, fn: (session: PortalSession, ctx: SessionContext) => Promise<T>, options?: {
|
|
29
|
+
rut?: string;
|
|
30
|
+
}): Promise<T>;
|
|
31
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/auth/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK/E,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAErF;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9F;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE;AAED,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;mDAE+C;IAC/C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;+CAO+C;AAC/C,wBAAsB,WAAW,CAAC,CAAC,EACjC,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,EAC/D,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,OAAO,CAAC,CAAC,CAAC,CA4BZ"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { NotAuthenticatedError } from '../errors/index.js';
|
|
2
|
+
import { readOperateState, resolveOperableTarget } from '../identity/index.js';
|
|
3
|
+
// Distinct KeyValueStore key (ADR-007) — never shares a file with `identity`'s 'operate'.
|
|
4
|
+
const SESSION_KEY = 'session';
|
|
5
|
+
export async function readSession(store) {
|
|
6
|
+
return store.read(SESSION_KEY);
|
|
7
|
+
}
|
|
8
|
+
export async function writeSession(store, session) {
|
|
9
|
+
await store.write(SESSION_KEY, session);
|
|
10
|
+
}
|
|
11
|
+
export async function deleteSession(store) {
|
|
12
|
+
await store.delete(SESSION_KEY);
|
|
13
|
+
}
|
|
14
|
+
/** Acquire a live `PortalSession` from the stored cookies-only session and run `fn`
|
|
15
|
+
* against it. This is how DOMAIN TASKS reach SII: they consume a session, they
|
|
16
|
+
* NEVER mint one (only `login` mints — ADR-006, sii-py ADR-019). The operating/body
|
|
17
|
+
* RUT is resolved by precedence (override > pointer > self — ADR-005) and handed to
|
|
18
|
+
* `fn`. The session is ALWAYS closed; a missing local session raises
|
|
19
|
+
* `NotAuthenticated`. It does NOT eagerly probe liveness — an expired cookie jar
|
|
20
|
+
* surfaces as the facade's own typed error (representacion.ts) — and it NEVER
|
|
21
|
+
* retries after a SII block (CONVENTIONS). */
|
|
22
|
+
export async function withSession(runtime, fn, options = {}) {
|
|
23
|
+
const stored = await readSession(runtime.store);
|
|
24
|
+
if (!stored) {
|
|
25
|
+
throw new NotAuthenticatedError('No hay sesión. Ejecuta `sii auth login`.');
|
|
26
|
+
}
|
|
27
|
+
// Resolve the operating/body RUT (ADR-005). A `--rut` override is the same
|
|
28
|
+
// value-domain as the operate pointer, so it is validated against the operable set
|
|
29
|
+
// HERE (empresa account / out-of-set RUT rejected locally, not round-tripped to SII)
|
|
30
|
+
// — the single enforcement point for per-call `--rut`. No override → the operate
|
|
31
|
+
// pointer; missing operate state alongside a session is broken → re-login.
|
|
32
|
+
const operateState = await readOperateState(runtime.store);
|
|
33
|
+
let operatingRut;
|
|
34
|
+
if (options.rut !== undefined) {
|
|
35
|
+
if (!operateState) {
|
|
36
|
+
throw new NotAuthenticatedError('No hay sesión. Ejecuta `sii auth login`.');
|
|
37
|
+
}
|
|
38
|
+
operatingRut = resolveOperableTarget(operateState, options.rut);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
operatingRut = operateState?.operatingRut ?? stored.rut;
|
|
42
|
+
}
|
|
43
|
+
let s = null;
|
|
44
|
+
try {
|
|
45
|
+
s = await runtime.portal.restore(stored.cookies);
|
|
46
|
+
return await fn(s, { sessionRut: stored.rut, operatingRut });
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
await s?.close();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/auth/session.ts"],"names":[],"mappings":"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AAC;IAClE,CAAC;SAAM,CAAC;QACN,YAAY,GAAG,YAAY,EAAE,YAAY,IAAI,MAAM,CAAC,GAAG,CAAC;IAC1D,CAAC;IAED,IAAI,CAAC,GAAyB,IAAI,CAAC;IACnC,IAAI,CAAC;QACH,CAAC,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACjD,OAAO,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,CAAC,CAAC;IAC/D,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// CLI-ONLY surface of @albertomarturelo/sii-core (subpath `@albertomarturelo/sii-core/cli`). `consoleLogin` accepts
|
|
2
|
+
// a Clave argument, so it is DELIBERATELY kept out of the main barrel (`@albertomarturelo/sii-core`)
|
|
3
|
+
// — the MCP server imports only the main barrel and must never wire a task that
|
|
4
|
+
// takes a password (ADR-006). The terminal CLI imports this subpath instead.
|
|
5
|
+
export { consoleLogin } from './tasks/auth.js';
|
|
6
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,qGAAqG;AACrG,gFAAgF;AAChF,6EAA6E;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const HOSTS: {
|
|
2
|
+
/** Clave Tributaria login host. Landing here ⇒ NOT authenticated (URL-based detection). */
|
|
3
|
+
readonly login: "https://zeusr.sii.cl";
|
|
4
|
+
/** Login page path; takes the post-login destination as an UNKEYED query string (observed). */
|
|
5
|
+
readonly loginPath: "/AUT2000/InicioAutenticacion/IngresoRutClave.html";
|
|
6
|
+
/** Server-side logout endpoint path; the close redirects OFF this path (sii-py, observed). */
|
|
7
|
+
readonly logoutPath: "/cgi_AUT2000/autTermino.cgi";
|
|
8
|
+
/** Mi SII landing — serves the inline `DatosCntrNow` object with the contribuyente snapshot. */
|
|
9
|
+
readonly miSii: "https://misiir.sii.cl/cgi_misii/siihome.cgi";
|
|
10
|
+
readonly portal: "https://www.sii.cl";
|
|
11
|
+
/** SPA JSON facades (RCV / F29 / F22) live under this host. */
|
|
12
|
+
readonly portalApi: "https://www4.sii.cl";
|
|
13
|
+
/** Legacy BHE/BTE consulta CGIs (boletas de honorarios). HTML skeleton filled
|
|
14
|
+
* client-side from inline JS maps; read via `PortalSession.goto`/`evaluate`, NOT
|
|
15
|
+
* the SDI-JSON facade. The `.sii.cl` session cookie SSO-carries here (observed
|
|
16
|
+
* 2026-06-30). Session-keyed (`rut_arrastre` = the principal). (#20 / ADR-004) */
|
|
17
|
+
readonly bheCgi: "https://loa.sii.cl/cgi_IMT";
|
|
18
|
+
/** Palena: DTE SOAP web services AND the public, login-free consulta CGIs
|
|
19
|
+
* (e.g. `/cvc_cgi/dte/ee_empresa_rut` — empresas autorizadas a emitir DTE, ADR-014). */
|
|
20
|
+
readonly dteWs: "https://palena.sii.cl";
|
|
21
|
+
readonly claveUnica: "https://accounts.claveunica.gob.cl/openid/authorize/";
|
|
22
|
+
};
|
|
23
|
+
/** URL hostname that indicates an unauthenticated session (sii-py ADR-009). */
|
|
24
|
+
export declare const LOGIN_HOST = "zeusr.sii.cl";
|
|
25
|
+
/** Full login page URL (host + path). */
|
|
26
|
+
export declare const LOGIN_URL: string;
|
|
27
|
+
/** Full server-side logout URL (host + path). The close redirects OFF this path. */
|
|
28
|
+
export declare const LOGOUT_URL: string;
|
|
29
|
+
export interface Settings {
|
|
30
|
+
/** Max requests/second used to pace portal POSTs (sii-py ADR-011). */
|
|
31
|
+
readonly rateLimitRps: number;
|
|
32
|
+
/** Cookies-only session TTL hint, minutes. */
|
|
33
|
+
readonly sessionTtlMinutes: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const DEFAULT_SETTINGS: Settings;
|
|
36
|
+
/** Build the login URL: `<LOGIN_URL>?<destination>` — unkeyed query, observed format. */
|
|
37
|
+
export declare function loginUrl(destination: string): string;
|
|
38
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK;IAChB,2FAA2F;;IAE3F,+FAA+F;;IAE/F,8FAA8F;;IAE9F,gGAAgG;;;IAGhG,+DAA+D;;IAE/D;;;uFAGmF;;IAEnF;6FACyF;;;CAGjF,CAAC;AAEX,+EAA+E;AAC/E,eAAO,MAAM,UAAU,iBAAiB,CAAC;AAEzC,yCAAyC;AACzC,eAAO,MAAM,SAAS,QAAqC,CAAC;AAE5D,oFAAoF;AACpF,eAAO,MAAM,UAAU,QAAsC,CAAC;AAE9D,MAAM,WAAW,QAAQ;IACvB,sEAAsE;IACtE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,8CAA8C;IAC9C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAED,eAAO,MAAM,gBAAgB,EAAE,QAG9B,CAAC;AAEF,yFAAyF;AACzF,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// SII production hostnames — the single source of truth (ADR-004). Never
|
|
2
|
+
// hard-code a SII host anywhere else. Ported from first-hand observation in the
|
|
3
|
+
// Python sii-cli; prod-only, no env switch (sii-py ADR-016).
|
|
4
|
+
export const HOSTS = {
|
|
5
|
+
/** Clave Tributaria login host. Landing here ⇒ NOT authenticated (URL-based detection). */
|
|
6
|
+
login: 'https://zeusr.sii.cl',
|
|
7
|
+
/** Login page path; takes the post-login destination as an UNKEYED query string (observed). */
|
|
8
|
+
loginPath: '/AUT2000/InicioAutenticacion/IngresoRutClave.html',
|
|
9
|
+
/** Server-side logout endpoint path; the close redirects OFF this path (sii-py, observed). */
|
|
10
|
+
logoutPath: '/cgi_AUT2000/autTermino.cgi',
|
|
11
|
+
/** Mi SII landing — serves the inline `DatosCntrNow` object with the contribuyente snapshot. */
|
|
12
|
+
miSii: 'https://misiir.sii.cl/cgi_misii/siihome.cgi',
|
|
13
|
+
portal: 'https://www.sii.cl',
|
|
14
|
+
/** SPA JSON facades (RCV / F29 / F22) live under this host. */
|
|
15
|
+
portalApi: 'https://www4.sii.cl',
|
|
16
|
+
/** Legacy BHE/BTE consulta CGIs (boletas de honorarios). HTML skeleton filled
|
|
17
|
+
* client-side from inline JS maps; read via `PortalSession.goto`/`evaluate`, NOT
|
|
18
|
+
* the SDI-JSON facade. The `.sii.cl` session cookie SSO-carries here (observed
|
|
19
|
+
* 2026-06-30). Session-keyed (`rut_arrastre` = the principal). (#20 / ADR-004) */
|
|
20
|
+
bheCgi: 'https://loa.sii.cl/cgi_IMT',
|
|
21
|
+
/** Palena: DTE SOAP web services AND the public, login-free consulta CGIs
|
|
22
|
+
* (e.g. `/cvc_cgi/dte/ee_empresa_rut` — empresas autorizadas a emitir DTE, ADR-014). */
|
|
23
|
+
dteWs: 'https://palena.sii.cl',
|
|
24
|
+
claveUnica: 'https://accounts.claveunica.gob.cl/openid/authorize/',
|
|
25
|
+
};
|
|
26
|
+
/** URL hostname that indicates an unauthenticated session (sii-py ADR-009). */
|
|
27
|
+
export const LOGIN_HOST = 'zeusr.sii.cl';
|
|
28
|
+
/** Full login page URL (host + path). */
|
|
29
|
+
export const LOGIN_URL = `${HOSTS.login}${HOSTS.loginPath}`;
|
|
30
|
+
/** Full server-side logout URL (host + path). The close redirects OFF this path. */
|
|
31
|
+
export const LOGOUT_URL = `${HOSTS.login}${HOSTS.logoutPath}`;
|
|
32
|
+
export const DEFAULT_SETTINGS = {
|
|
33
|
+
rateLimitRps: 1,
|
|
34
|
+
sessionTtlMinutes: 60,
|
|
35
|
+
};
|
|
36
|
+
/** Build the login URL: `<LOGIN_URL>?<destination>` — unkeyed query, observed format. */
|
|
37
|
+
export function loginUrl(destination) {
|
|
38
|
+
return `${LOGIN_URL}?${destination}`;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,gFAAgF;AAChF,6DAA6D;AAE7D,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,2FAA2F;IAC3F,KAAK,EAAE,sBAAsB;IAC7B,+FAA+F;IAC/F,SAAS,EAAE,mDAAmD;IAC9D,8FAA8F;IAC9F,UAAU,EAAE,6BAA6B;IACzC,gGAAgG;IAChG,KAAK,EAAE,6CAA6C;IACpD,MAAM,EAAE,oBAAoB;IAC5B,+DAA+D;IAC/D,SAAS,EAAE,qBAAqB;IAChC;;;uFAGmF;IACnF,MAAM,EAAE,4BAA4B;IACpC;6FACyF;IACzF,KAAK,EAAE,uBAAuB;IAC9B,UAAU,EAAE,sDAAsD;CAC1D,CAAC;AAEX,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC;AAEzC,yCAAyC;AACzC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;AAE5D,oFAAoF;AACpF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;AAS9D,MAAM,CAAC,MAAM,gBAAgB,GAAa;IACxC,YAAY,EAAE,CAAC;IACf,iBAAiB,EAAE,EAAE;CACtB,CAAC;AAEF,yFAAyF;AACzF,MAAM,UAAU,QAAQ,CAAC,WAAmB;IAC1C,OAAO,GAAG,SAAS,IAAI,WAAW,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare class SiiError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
/** No valid cached session; the user must run `sii auth login`. */
|
|
5
|
+
export declare class NotAuthenticatedError extends SiiError {
|
|
6
|
+
}
|
|
7
|
+
/** A cached session existed but the cookies are dead. Carries an actionable
|
|
8
|
+
* recovery message (e.g. re-run the browser login). Subclass of NotAuthenticated
|
|
9
|
+
* so a generic catch still treats it as "not authenticated". */
|
|
10
|
+
export declare class SessionExpiredError extends NotAuthenticatedError {
|
|
11
|
+
}
|
|
12
|
+
/** Browser login was not completed (timeout / window closed). No partial
|
|
13
|
+
* session is ever written. */
|
|
14
|
+
export declare class LoginFailedError extends SiiError {
|
|
15
|
+
}
|
|
16
|
+
/** SII server-side rate limit / block. NEVER retry — surface verbatim and stop. */
|
|
17
|
+
export declare class RateLimitError extends SiiError {
|
|
18
|
+
}
|
|
19
|
+
/** A stored credential was required (e.g. unattended re-mint) but none resolved. */
|
|
20
|
+
export declare class CredentialNotFoundError extends SiiError {
|
|
21
|
+
}
|
|
22
|
+
/** Invalid user input: bad RUT, an operate target not in the operable set, etc. */
|
|
23
|
+
export declare class ValidationError extends SiiError {
|
|
24
|
+
}
|
|
25
|
+
/** SII rejected a portal/SDI facade request (error envelope or unparseable
|
|
26
|
+
* response). Carries SII's message verbatim — never translated (ADR-004). */
|
|
27
|
+
export declare class RepresentacionError extends SiiError {
|
|
28
|
+
}
|
|
29
|
+
/** SII rejected an RCV (Registro de Compras y Ventas) facade request, or the
|
|
30
|
+
* response was not parseable. SII's message verbatim — never translated (ADR-004). */
|
|
31
|
+
export declare class RcvError extends SiiError {
|
|
32
|
+
}
|
|
33
|
+
/** SII rejected an F22 (Declaración Anual de Renta) facade request, or the response
|
|
34
|
+
* was not parseable. SII's message verbatim — never translated (ADR-004). */
|
|
35
|
+
export declare class F22Error extends SiiError {
|
|
36
|
+
}
|
|
37
|
+
/** SII rejected an F29 (Declaración Mensual de IVA) facade request, the response was
|
|
38
|
+
* not parseable, OR the operation is invalid for F29's session-keyed contract — F29
|
|
39
|
+
* authorizes by the session principal, so operating as a represented empresa is
|
|
40
|
+
* rejected up front (ADR-005). SII's message verbatim — never translated (ADR-004). */
|
|
41
|
+
export declare class F29Error extends SiiError {
|
|
42
|
+
}
|
|
43
|
+
/** SII rejected a BTE/BHE (boletas de honorarios) consulta, or the inline report map was
|
|
44
|
+
* absent / unparseable (a non-report or cross-RUT page). SII's message verbatim where one
|
|
45
|
+
* exists — never translated (ADR-004). NOT raised for an empty month (a clean 0-boletas
|
|
46
|
+
* result). */
|
|
47
|
+
export declare class BteError extends SiiError {
|
|
48
|
+
}
|
|
49
|
+
/** The public DTE-authorized consulta could not be completed for a non-user reason —
|
|
50
|
+
* the network/CGI failed, a non-200 came back, or the portal HTML changed shape
|
|
51
|
+
* ("scraper roto"). A RUT that is simply not a DTE emisor is NOT this error: it is a
|
|
52
|
+
* clean negative result (`autorizado: false` + SII's verbatim message). Fail loud,
|
|
53
|
+
* never retry (ADR-004 / ADR-014). */
|
|
54
|
+
export declare class DteError extends SiiError {
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AAIA,qBAAa,QAAS,SAAQ,KAAK;gBACrB,OAAO,EAAE,MAAM;CAI5B;AAED,mEAAmE;AACnE,qBAAa,qBAAsB,SAAQ,QAAQ;CAAG;AAEtD;;iEAEiE;AACjE,qBAAa,mBAAoB,SAAQ,qBAAqB;CAAG;AAEjE;+BAC+B;AAC/B,qBAAa,gBAAiB,SAAQ,QAAQ;CAAG;AAEjD,mFAAmF;AACnF,qBAAa,cAAe,SAAQ,QAAQ;CAAG;AAE/C,oFAAoF;AACpF,qBAAa,uBAAwB,SAAQ,QAAQ;CAAG;AAExD,mFAAmF;AACnF,qBAAa,eAAgB,SAAQ,QAAQ;CAAG;AAEhD;8EAC8E;AAC9E,qBAAa,mBAAoB,SAAQ,QAAQ;CAAG;AAEpD;uFACuF;AACvF,qBAAa,QAAS,SAAQ,QAAQ;CAAG;AAEzC;8EAC8E;AAC9E,qBAAa,QAAS,SAAQ,QAAQ;CAAG;AAEzC;;;wFAGwF;AACxF,qBAAa,QAAS,SAAQ,QAAQ;CAAG;AAEzC;;;eAGe;AACf,qBAAa,QAAS,SAAQ,QAAQ;CAAG;AAEzC;;;;uCAIuC;AACvC,qBAAa,QAAS,SAAQ,QAAQ;CAAG"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Domain error hierarchy. The CLI maps these to exit codes (in @sii/cli):
|
|
2
|
+
// NotAuthenticated → 2, LoginFailed → 3, RateLimit → 4. Pass SII's Spanish
|
|
3
|
+
// messages through unchanged (sii-py error-surfacing convention).
|
|
4
|
+
export class SiiError extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = new.target.name;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** No valid cached session; the user must run `sii auth login`. */
|
|
11
|
+
export class NotAuthenticatedError extends SiiError {
|
|
12
|
+
}
|
|
13
|
+
/** A cached session existed but the cookies are dead. Carries an actionable
|
|
14
|
+
* recovery message (e.g. re-run the browser login). Subclass of NotAuthenticated
|
|
15
|
+
* so a generic catch still treats it as "not authenticated". */
|
|
16
|
+
export class SessionExpiredError extends NotAuthenticatedError {
|
|
17
|
+
}
|
|
18
|
+
/** Browser login was not completed (timeout / window closed). No partial
|
|
19
|
+
* session is ever written. */
|
|
20
|
+
export class LoginFailedError extends SiiError {
|
|
21
|
+
}
|
|
22
|
+
/** SII server-side rate limit / block. NEVER retry — surface verbatim and stop. */
|
|
23
|
+
export class RateLimitError extends SiiError {
|
|
24
|
+
}
|
|
25
|
+
/** A stored credential was required (e.g. unattended re-mint) but none resolved. */
|
|
26
|
+
export class CredentialNotFoundError extends SiiError {
|
|
27
|
+
}
|
|
28
|
+
/** Invalid user input: bad RUT, an operate target not in the operable set, etc. */
|
|
29
|
+
export class ValidationError extends SiiError {
|
|
30
|
+
}
|
|
31
|
+
/** SII rejected a portal/SDI facade request (error envelope or unparseable
|
|
32
|
+
* response). Carries SII's message verbatim — never translated (ADR-004). */
|
|
33
|
+
export class RepresentacionError extends SiiError {
|
|
34
|
+
}
|
|
35
|
+
/** SII rejected an RCV (Registro de Compras y Ventas) facade request, or the
|
|
36
|
+
* response was not parseable. SII's message verbatim — never translated (ADR-004). */
|
|
37
|
+
export class RcvError extends SiiError {
|
|
38
|
+
}
|
|
39
|
+
/** SII rejected an F22 (Declaración Anual de Renta) facade request, or the response
|
|
40
|
+
* was not parseable. SII's message verbatim — never translated (ADR-004). */
|
|
41
|
+
export class F22Error extends SiiError {
|
|
42
|
+
}
|
|
43
|
+
/** SII rejected an F29 (Declaración Mensual de IVA) facade request, the response was
|
|
44
|
+
* not parseable, OR the operation is invalid for F29's session-keyed contract — F29
|
|
45
|
+
* authorizes by the session principal, so operating as a represented empresa is
|
|
46
|
+
* rejected up front (ADR-005). SII's message verbatim — never translated (ADR-004). */
|
|
47
|
+
export class F29Error extends SiiError {
|
|
48
|
+
}
|
|
49
|
+
/** SII rejected a BTE/BHE (boletas de honorarios) consulta, or the inline report map was
|
|
50
|
+
* absent / unparseable (a non-report or cross-RUT page). SII's message verbatim where one
|
|
51
|
+
* exists — never translated (ADR-004). NOT raised for an empty month (a clean 0-boletas
|
|
52
|
+
* result). */
|
|
53
|
+
export class BteError extends SiiError {
|
|
54
|
+
}
|
|
55
|
+
/** The public DTE-authorized consulta could not be completed for a non-user reason —
|
|
56
|
+
* the network/CGI failed, a non-200 came back, or the portal HTML changed shape
|
|
57
|
+
* ("scraper roto"). A RUT that is simply not a DTE emisor is NOT this error: it is a
|
|
58
|
+
* clean negative result (`autorizado: false` + SII's verbatim message). Fail loud,
|
|
59
|
+
* never retry (ADR-004 / ADR-014). */
|
|
60
|
+
export class DteError extends SiiError {
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,kEAAkE;AAElE,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;IAC9B,CAAC;CACF;AAED,mEAAmE;AACnE,MAAM,OAAO,qBAAsB,SAAQ,QAAQ;CAAG;AAEtD;;iEAEiE;AACjE,MAAM,OAAO,mBAAoB,SAAQ,qBAAqB;CAAG;AAEjE;+BAC+B;AAC/B,MAAM,OAAO,gBAAiB,SAAQ,QAAQ;CAAG;AAEjD,mFAAmF;AACnF,MAAM,OAAO,cAAe,SAAQ,QAAQ;CAAG;AAE/C,oFAAoF;AACpF,MAAM,OAAO,uBAAwB,SAAQ,QAAQ;CAAG;AAExD,mFAAmF;AACnF,MAAM,OAAO,eAAgB,SAAQ,QAAQ;CAAG;AAEhD;8EAC8E;AAC9E,MAAM,OAAO,mBAAoB,SAAQ,QAAQ;CAAG;AAEpD;uFACuF;AACvF,MAAM,OAAO,QAAS,SAAQ,QAAQ;CAAG;AAEzC;8EAC8E;AAC9E,MAAM,OAAO,QAAS,SAAQ,QAAQ;CAAG;AAEzC;;;wFAGwF;AACxF,MAAM,OAAO,QAAS,SAAQ,QAAQ;CAAG;AAEzC;;;eAGe;AACf,MAAM,OAAO,QAAS,SAAQ,QAAQ;CAAG;AAEzC;;;;uCAIuC;AACvC,MAAM,OAAO,QAAS,SAAQ,QAAQ;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** es-CL money rendering: thousands-grouped (`12.345.678`), `—` for a missing value. */
|
|
2
|
+
export declare function formatMoney(value: number | null): string;
|
|
3
|
+
/** Canonical RUT (`76192083-9`) → display form with dots + DV (`76.192.083-9`). */
|
|
4
|
+
export declare function formatRut(canonical: string): string;
|
|
5
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/format/format.ts"],"names":[],"mappings":"AAMA,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAExD;AAED,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Shared es-CL presentation helpers for the HUMAN renderings (CLI `--human`,
|
|
2
|
+
// MCP resource/tool text). Presentation only — tasks keep returning raw
|
|
3
|
+
// JSON-serializable values; that contract is untouched (ADR-012). Hoisted here
|
|
4
|
+
// after the same one-liners were copy-pasted across both surfaces.
|
|
5
|
+
import { Rut } from '../rut/index.js';
|
|
6
|
+
/** es-CL money rendering: thousands-grouped (`12.345.678`), `—` for a missing value. */
|
|
7
|
+
export function formatMoney(value) {
|
|
8
|
+
return value === null ? '—' : value.toLocaleString('es-CL');
|
|
9
|
+
}
|
|
10
|
+
/** Canonical RUT (`76192083-9`) → display form with dots + DV (`76.192.083-9`). */
|
|
11
|
+
export function formatRut(canonical) {
|
|
12
|
+
return Rut.parse(canonical).formatted;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/format/format.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,wEAAwE;AACxE,+EAA+E;AAC/E,mEAAmE;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,wFAAwF;AACxF,MAAM,UAAU,WAAW,CAAC,KAAoB;IAC9C,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AAC9D,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,SAAS,CAAC,SAAiB;IACzC,OAAO,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { KeyValueStore } from '../seams/index.js';
|
|
2
|
+
export type AccountType = 'persona' | 'empresa';
|
|
3
|
+
export interface OperableEntry {
|
|
4
|
+
/** Canonical RUT (`<body>-<DV>`). */
|
|
5
|
+
readonly rut: string;
|
|
6
|
+
/** Razón social / nombre — PII: never audited, never chatted. */
|
|
7
|
+
readonly razonSocial: string;
|
|
8
|
+
readonly isSelf: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface OperateState {
|
|
11
|
+
/** The session principal (who is logged in), canonical. */
|
|
12
|
+
readonly selfRut: string;
|
|
13
|
+
readonly accountType: AccountType;
|
|
14
|
+
/** Currently operating AS this RUT (defaults to selfRut), canonical. */
|
|
15
|
+
readonly operatingRut: string;
|
|
16
|
+
/** Empresas this account can operate. For an empresa account: just self. */
|
|
17
|
+
readonly operable: readonly OperableEntry[];
|
|
18
|
+
}
|
|
19
|
+
export declare function readOperateState(store: KeyValueStore): Promise<OperateState | null>;
|
|
20
|
+
/** Initialise on login: operatingRut defaults to self, operable cached. */
|
|
21
|
+
export declare function initOperateState(store: KeyValueStore, input: {
|
|
22
|
+
selfRut: string;
|
|
23
|
+
accountType: AccountType;
|
|
24
|
+
operable: readonly OperableEntry[];
|
|
25
|
+
}): Promise<OperateState>;
|
|
26
|
+
export declare function clearOperateState(store: KeyValueStore): Promise<void>;
|
|
27
|
+
/** Validate + canonicalise an operate target against the cached operable set —
|
|
28
|
+
* SELECTS, never mints (ADR-005). Throws `ValidationError` for an empresa account
|
|
29
|
+
* (no operate capability) or a RUT outside the operable set. Shared by the
|
|
30
|
+
* persistent `operate` command AND the per-call `--rut` override so both enforce the
|
|
31
|
+
* same value-domain (CONVENTIONS: `--rut` is the operable set, not a separate concept). */
|
|
32
|
+
export declare function resolveOperableTarget(state: OperateState, target: string): string;
|
|
33
|
+
/** Set the operating RUT, validated against the cached operable set. SELECTS,
|
|
34
|
+
* never mints (ADR-005). Accepts any RUT format. */
|
|
35
|
+
export declare function setOperatingRut(store: KeyValueStore, target: string): Promise<OperateState>;
|
|
36
|
+
/** Reset the operating RUT back to self. */
|
|
37
|
+
export declare function clearOperatingRut(store: KeyValueStore): Promise<OperateState>;
|
|
38
|
+
export interface OperatingContext {
|
|
39
|
+
readonly operatingRut: string;
|
|
40
|
+
readonly selfRut: string;
|
|
41
|
+
readonly isSelf: boolean;
|
|
42
|
+
readonly razonSocial: string | null;
|
|
43
|
+
}
|
|
44
|
+
export declare function operatingContext(state: OperateState): OperatingContext;
|
|
45
|
+
/** Render the operating context as the shared `Operando como …` display line
|
|
46
|
+
* (the CLI STDERR header / `operate` output and the MCP `sii://operating`
|
|
47
|
+
* resource + `operate` tool used to carry verbatim copies of this). The razón
|
|
48
|
+
* social only appears for a represented empresa — never for self (own-name PII
|
|
49
|
+
* stays off the line). */
|
|
50
|
+
export declare function describeOperating(ctx: OperatingContext): string;
|
|
51
|
+
/** Render one operable entry as a single display line (shared by CLI `operate --list`
|
|
52
|
+
* and the MCP `operate list=true` tool, so the format stays in one place):
|
|
53
|
+
* `<rut>[ <razón social>][ (tú mismo, operando ahora)]`. Razón social falls back to
|
|
54
|
+
* the RUT when SII returned no name — omit it then so the RUT isn't repeated. */
|
|
55
|
+
export declare function formatOperableEntry(entry: OperableEntry, operatingRut: string): string;
|
|
56
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/identity/identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,G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