@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.
Files changed (200) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/LICENSE +21 -0
  3. package/README.md +108 -0
  4. package/dist/adapters/fake/index.d.ts +98 -0
  5. package/dist/adapters/fake/index.d.ts.map +1 -0
  6. package/dist/adapters/fake/index.js +131 -0
  7. package/dist/adapters/fake/index.js.map +1 -0
  8. package/dist/adapters/node/index.d.ts +22 -0
  9. package/dist/adapters/node/index.d.ts.map +1 -0
  10. package/dist/adapters/node/index.js +65 -0
  11. package/dist/adapters/node/index.js.map +1 -0
  12. package/dist/adapters/node/portal.d.ts +8 -0
  13. package/dist/adapters/node/portal.d.ts.map +1 -0
  14. package/dist/adapters/node/portal.js +222 -0
  15. package/dist/adapters/node/portal.js.map +1 -0
  16. package/dist/adapters/node/response.d.ts +21 -0
  17. package/dist/adapters/node/response.d.ts.map +1 -0
  18. package/dist/adapters/node/response.js +48 -0
  19. package/dist/adapters/node/response.js.map +1 -0
  20. package/dist/audit/audit.d.ts +8 -0
  21. package/dist/audit/audit.d.ts.map +1 -0
  22. package/dist/audit/audit.js +15 -0
  23. package/dist/audit/audit.js.map +1 -0
  24. package/dist/audit/index.d.ts +2 -0
  25. package/dist/audit/index.d.ts.map +1 -0
  26. package/dist/audit/index.js +2 -0
  27. package/dist/audit/index.js.map +1 -0
  28. package/dist/auth/auth.d.ts +43 -0
  29. package/dist/auth/auth.d.ts.map +1 -0
  30. package/dist/auth/auth.js +219 -0
  31. package/dist/auth/auth.js.map +1 -0
  32. package/dist/auth/index.d.ts +3 -0
  33. package/dist/auth/index.d.ts.map +1 -0
  34. package/dist/auth/index.js +3 -0
  35. package/dist/auth/index.js.map +1 -0
  36. package/dist/auth/login-error.d.ts +8 -0
  37. package/dist/auth/login-error.d.ts.map +1 -0
  38. package/dist/auth/login-error.js +18 -0
  39. package/dist/auth/login-error.js.map +1 -0
  40. package/dist/auth/session.d.ts +31 -0
  41. package/dist/auth/session.d.ts.map +1 -0
  42. package/dist/auth/session.js +52 -0
  43. package/dist/auth/session.js.map +1 -0
  44. package/dist/cli.d.ts +3 -0
  45. package/dist/cli.d.ts.map +1 -0
  46. package/dist/cli.js +6 -0
  47. package/dist/cli.js.map +1 -0
  48. package/dist/config/config.d.ts +38 -0
  49. package/dist/config/config.d.ts.map +1 -0
  50. package/dist/config/config.js +40 -0
  51. package/dist/config/config.js.map +1 -0
  52. package/dist/config/index.d.ts +2 -0
  53. package/dist/config/index.d.ts.map +1 -0
  54. package/dist/config/index.js +2 -0
  55. package/dist/config/index.js.map +1 -0
  56. package/dist/errors/errors.d.ts +56 -0
  57. package/dist/errors/errors.d.ts.map +1 -0
  58. package/dist/errors/errors.js +62 -0
  59. package/dist/errors/errors.js.map +1 -0
  60. package/dist/errors/index.d.ts +2 -0
  61. package/dist/errors/index.d.ts.map +1 -0
  62. package/dist/errors/index.js +2 -0
  63. package/dist/errors/index.js.map +1 -0
  64. package/dist/format/format.d.ts +5 -0
  65. package/dist/format/format.d.ts.map +1 -0
  66. package/dist/format/format.js +14 -0
  67. package/dist/format/format.js.map +1 -0
  68. package/dist/format/index.d.ts +2 -0
  69. package/dist/format/index.d.ts.map +1 -0
  70. package/dist/format/index.js +2 -0
  71. package/dist/format/index.js.map +1 -0
  72. package/dist/identity/identity.d.ts +56 -0
  73. package/dist/identity/identity.d.ts.map +1 -0
  74. package/dist/identity/identity.js +93 -0
  75. package/dist/identity/identity.js.map +1 -0
  76. package/dist/identity/index.d.ts +2 -0
  77. package/dist/identity/index.d.ts.map +1 -0
  78. package/dist/identity/index.js +2 -0
  79. package/dist/identity/index.js.map +1 -0
  80. package/dist/index.d.ts +24 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +24 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/node.d.ts +9 -0
  85. package/dist/node.d.ts.map +1 -0
  86. package/dist/node.js +22 -0
  87. package/dist/node.js.map +1 -0
  88. package/dist/periodo/anio.d.ts +15 -0
  89. package/dist/periodo/anio.d.ts.map +1 -0
  90. package/dist/periodo/anio.js +42 -0
  91. package/dist/periodo/anio.js.map +1 -0
  92. package/dist/periodo/index.d.ts +3 -0
  93. package/dist/periodo/index.d.ts.map +1 -0
  94. package/dist/periodo/index.js +3 -0
  95. package/dist/periodo/index.js.map +1 -0
  96. package/dist/periodo/periodo.d.ts +19 -0
  97. package/dist/periodo/periodo.d.ts.map +1 -0
  98. package/dist/periodo/periodo.js +55 -0
  99. package/dist/periodo/periodo.js.map +1 -0
  100. package/dist/portal/bte-comunas.d.ts +9 -0
  101. package/dist/portal/bte-comunas.d.ts.map +1 -0
  102. package/dist/portal/bte-comunas.js +400 -0
  103. package/dist/portal/bte-comunas.js.map +1 -0
  104. package/dist/portal/bte-emit.d.ts +70 -0
  105. package/dist/portal/bte-emit.d.ts.map +1 -0
  106. package/dist/portal/bte-emit.js +266 -0
  107. package/dist/portal/bte-emit.js.map +1 -0
  108. package/dist/portal/bte.d.ts +55 -0
  109. package/dist/portal/bte.d.ts.map +1 -0
  110. package/dist/portal/bte.js +215 -0
  111. package/dist/portal/bte.js.map +1 -0
  112. package/dist/portal/dte-public.d.ts +36 -0
  113. package/dist/portal/dte-public.d.ts.map +1 -0
  114. package/dist/portal/dte-public.js +192 -0
  115. package/dist/portal/dte-public.js.map +1 -0
  116. package/dist/portal/f22/declaraciones.d.ts +37 -0
  117. package/dist/portal/f22/declaraciones.d.ts.map +1 -0
  118. package/dist/portal/f22/declaraciones.js +86 -0
  119. package/dist/portal/f22/declaraciones.js.map +1 -0
  120. package/dist/portal/f22/grid.d.ts +14 -0
  121. package/dist/portal/f22/grid.d.ts.map +1 -0
  122. package/dist/portal/f22/grid.js +51 -0
  123. package/dist/portal/f22/grid.js.map +1 -0
  124. package/dist/portal/f22/historial.d.ts +34 -0
  125. package/dist/portal/f22/historial.d.ts.map +1 -0
  126. package/dist/portal/f22/historial.js +66 -0
  127. package/dist/portal/f22/historial.js.map +1 -0
  128. package/dist/portal/f22/index.d.ts +7 -0
  129. package/dist/portal/f22/index.d.ts.map +1 -0
  130. package/dist/portal/f22/index.js +11 -0
  131. package/dist/portal/f22/index.js.map +1 -0
  132. package/dist/portal/f22/observaciones.d.ts +20 -0
  133. package/dist/portal/f22/observaciones.d.ts.map +1 -0
  134. package/dist/portal/f22/observaciones.js +38 -0
  135. package/dist/portal/f22/observaciones.js.map +1 -0
  136. package/dist/portal/f22/shared.d.ts +32 -0
  137. package/dist/portal/f22/shared.d.ts.map +1 -0
  138. package/dist/portal/f22/shared.js +130 -0
  139. package/dist/portal/f22/shared.js.map +1 -0
  140. package/dist/portal/f22-codigos.d.ts +28 -0
  141. package/dist/portal/f22-codigos.d.ts.map +1 -0
  142. package/dist/portal/f22-codigos.js +141 -0
  143. package/dist/portal/f22-codigos.js.map +1 -0
  144. package/dist/portal/f29-codigos.d.ts +15 -0
  145. package/dist/portal/f29-codigos.d.ts.map +1 -0
  146. package/dist/portal/f29-codigos.js +552 -0
  147. package/dist/portal/f29-codigos.js.map +1 -0
  148. package/dist/portal/f29.d.ts +62 -0
  149. package/dist/portal/f29.d.ts.map +1 -0
  150. package/dist/portal/f29.js +244 -0
  151. package/dist/portal/f29.js.map +1 -0
  152. package/dist/portal/rcv.d.ts +62 -0
  153. package/dist/portal/rcv.d.ts.map +1 -0
  154. package/dist/portal/rcv.js +252 -0
  155. package/dist/portal/rcv.js.map +1 -0
  156. package/dist/portal/representacion.d.ts +24 -0
  157. package/dist/portal/representacion.d.ts.map +1 -0
  158. package/dist/portal/representacion.js +153 -0
  159. package/dist/portal/representacion.js.map +1 -0
  160. package/dist/rut/index.d.ts +2 -0
  161. package/dist/rut/index.d.ts.map +1 -0
  162. package/dist/rut/index.js +2 -0
  163. package/dist/rut/index.js.map +1 -0
  164. package/dist/rut/rut.d.ts +16 -0
  165. package/dist/rut/rut.d.ts.map +1 -0
  166. package/dist/rut/rut.js +70 -0
  167. package/dist/rut/rut.js.map +1 -0
  168. package/dist/seams/index.d.ts +126 -0
  169. package/dist/seams/index.d.ts.map +1 -0
  170. package/dist/seams/index.js +6 -0
  171. package/dist/seams/index.js.map +1 -0
  172. package/dist/tasks/auth.d.ts +16 -0
  173. package/dist/tasks/auth.d.ts.map +1 -0
  174. package/dist/tasks/auth.js +22 -0
  175. package/dist/tasks/auth.js.map +1 -0
  176. package/dist/tasks/bte.d.ts +52 -0
  177. package/dist/tasks/bte.d.ts.map +1 -0
  178. package/dist/tasks/bte.js +169 -0
  179. package/dist/tasks/bte.js.map +1 -0
  180. package/dist/tasks/dte.d.ts +9 -0
  181. package/dist/tasks/dte.d.ts.map +1 -0
  182. package/dist/tasks/dte.js +30 -0
  183. package/dist/tasks/dte.js.map +1 -0
  184. package/dist/tasks/f22.d.ts +69 -0
  185. package/dist/tasks/f22.d.ts.map +1 -0
  186. package/dist/tasks/f22.js +189 -0
  187. package/dist/tasks/f22.js.map +1 -0
  188. package/dist/tasks/f29.d.ts +67 -0
  189. package/dist/tasks/f29.d.ts.map +1 -0
  190. package/dist/tasks/f29.js +213 -0
  191. package/dist/tasks/f29.js.map +1 -0
  192. package/dist/tasks/operate.d.ts +22 -0
  193. package/dist/tasks/operate.d.ts.map +1 -0
  194. package/dist/tasks/operate.js +34 -0
  195. package/dist/tasks/operate.js.map +1 -0
  196. package/dist/tasks/rcv.d.ts +17 -0
  197. package/dist/tasks/rcv.d.ts.map +1 -0
  198. package/dist/tasks/rcv.js +76 -0
  199. package/dist/tasks/rcv.js.map +1 -0
  200. package/package.json +54 -0
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import type { Rut } from '../../rut/index.js';
3
+ import type { PortalSession } from '../../seams/index.js';
4
+ export declare const F22_BASE: string;
5
+ declare const Envelope: z.ZodObject<{
6
+ metaData: z.ZodOptional<z.ZodNullable<z.ZodObject<{
7
+ errors: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
8
+ }, z.core.$loose>>>;
9
+ errorMsg: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
10
+ respCod: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
11
+ data: z.ZodUnknown;
12
+ }, z.core.$loose>;
13
+ export type Envelope = z.infer<typeof Envelope>;
14
+ export declare const aliasGet: (row: Record<string, unknown>, aliases: readonly string[]) => unknown;
15
+ export declare const asStr: (v: unknown) => string | null;
16
+ /** Like `asStr` but trims and maps blank → null. For wire fields SII space-pads or leaves
17
+ * empty (`referencia`, `fechaCitacion`, `unidadSii`) — a blank string is "absent", not data. */
18
+ export declare const trimToNull: (v: unknown) => string | null;
19
+ /** Parse a código `valor`. SII serves montos in **es-CL format** — `.` = thousands, `,` =
20
+ * decimals (confirmed live 2026-06-29; synthetic examples here: `"9.999"` = 9999,
21
+ * `"12.345.678"` = 12345678). A bare `Number()` would misparse `"9.999"` as 9.999 (off by
22
+ * 1000×) and `"12.345.678"` as NaN (two dots). So strip the thousands dots and turn the
23
+ * decimal comma into a dot before parsing. Plain integers (`"177"`, `-150000`) pass through. */
24
+ export declare const asNumber: (v: unknown) => number | null;
25
+ export declare const isObj: (v: unknown) => v is Record<string, unknown>;
26
+ export declare function postSdi(session: PortalSession, url: string, namespace: string, data: Record<string, unknown>): Promise<Envelope>;
27
+ export declare const rutDigits: (rut: Rut) => {
28
+ rut: string;
29
+ dv: string;
30
+ };
31
+ export {};
32
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/portal/f22/shared.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEvE,eAAO,MAAM,QAAQ,QAAuE,CAAC;AAc7F,QAAA,MAAM,QAAQ;;;;;;;iBASJ,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,SAAS,MAAM,EAAE,KAAG,OAMnF,CAAC;AACF,eAAO,MAAM,KAAK,GAAI,GAAG,OAAO,KAAG,MAAM,GAAG,IACM,CAAC;AACnD;iGACiG;AACjG,eAAO,MAAM,UAAU,GAAI,GAAG,OAAO,KAAG,MAAM,GAAG,IAKhD,CAAC;AACF;;;;iGAIiG;AACjG,eAAO,MAAM,QAAQ,GAAI,GAAG,OAAO,KAAG,MAAM,GAAG,IAK9C,CAAC;AACF,eAAO,MAAM,KAAK,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACzB,CAAC;AAiBtC,wBAAsB,OAAO,CAC3B,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,QAAQ,CAAC,CA6BnB;AAED,eAAO,MAAM,SAAS,GAAI,KAAK,GAAG,KAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAG5D,CAAC"}
@@ -0,0 +1,130 @@
1
+ // F22 — Declaración Anual de Renta (estado / readback, read-only). Shared wire plumbing
2
+ // for the per-view facades (declaraciones / grid / observaciones / historial). Ported from
3
+ // the proven Python sii-cli (portal/f22.py); wire contract first-hand-observed there
4
+ // (spike #67, live-captured 2026-06-27, prod), NOT a third-party library (ADR-004).
5
+ // Full contract: docs/sii-contract/f22.md.
6
+ //
7
+ // The F22-status portal is the Angular SPA at `https://www4.sii.cl/consultaestadof22ui/`
8
+ // — a DIFFERENT app from RCV's `consdcvinternetui` (own Referer), same SDI envelope.
9
+ //
10
+ // SESSION-KEYED (ADR-005): F22 authorizes by the session principal — confirmed live
11
+ // 2026-06-27 that a persona's `--rut <empresa>` returns a CLEAN NEGATIVE, not the
12
+ // empresa's F22. The body RUT does not redirect it; the empresa's F22 needs the
13
+ // empresa's own session (logout→login). The task therefore defaults to self.
14
+ //
15
+ // PII: F22 exposes NO `raw` (unlike RCV) — the non-curated F22 data (decl
16
+ // `nombres`/`calle`/`comuna`/`cta`/`bco` and the header códigos) is pure identity/bank
17
+ // PII, not tax detail, so it never reaches a surface/LLM/audit. Error envelope is
18
+ // `metaData.errors` (a list of {id, descripcion}) — NOT RCV's `respEstado.codRespuesta`.
19
+ import { z } from 'zod';
20
+ import { HOSTS } from '../../config/index.js';
21
+ import { F22Error, NotAuthenticatedError } from '../../errors/index.js';
22
+ export const F22_BASE = `${HOSTS.portalApi}/consultaestadof22ui/services/data/facadeService`;
23
+ const CONVERSATION_COOKIE = 'TOKEN';
24
+ // Per-surface headers — Referer is the F22-status SPA root (differs from RCV/F29).
25
+ const HEADERS = {
26
+ 'Content-Type': 'application/json',
27
+ Origin: HOSTS.portalApi,
28
+ Referer: `${HOSTS.portalApi}/consultaestadof22ui/`,
29
+ Accept: 'application/json, text/plain, */*',
30
+ };
31
+ // --- Wire envelope (zod-at-the-boundary, ADR-011) --------------------------------
32
+ // F22's error channel is `metaData.errors` (NOT RCV's respEstado). Keep `errors` and
33
+ // `data` opaque (shapes differ per endpoint) and extract tolerantly below.
34
+ const Envelope = z
35
+ .object({
36
+ metaData: z.object({ errors: z.unknown().nullish() }).loose().nullish(),
37
+ // situacionObservacion ALSO signals errors via a top-level `errorMsg`/`respCod`
38
+ // (observed 2026-06-29); buscaDeclVgte/f22Compacto leave them absent. Keep both.
39
+ errorMsg: z.unknown().nullish(),
40
+ respCod: z.unknown().nullish(),
41
+ data: z.unknown(),
42
+ })
43
+ .loose();
44
+ export const aliasGet = (row, aliases) => {
45
+ for (const key of aliases) {
46
+ const v = row[key];
47
+ if (v !== undefined && v !== null)
48
+ return v;
49
+ }
50
+ return undefined;
51
+ };
52
+ export const asStr = (v) => v === null || v === undefined ? null : String(v);
53
+ /** Like `asStr` but trims and maps blank → null. For wire fields SII space-pads or leaves
54
+ * empty (`referencia`, `fechaCitacion`, `unidadSii`) — a blank string is "absent", not data. */
55
+ export const trimToNull = (v) => {
56
+ const s = asStr(v);
57
+ if (s === null)
58
+ return null;
59
+ const t = s.trim();
60
+ return t === '' ? null : t;
61
+ };
62
+ /** Parse a código `valor`. SII serves montos in **es-CL format** — `.` = thousands, `,` =
63
+ * decimals (confirmed live 2026-06-29; synthetic examples here: `"9.999"` = 9999,
64
+ * `"12.345.678"` = 12345678). A bare `Number()` would misparse `"9.999"` as 9.999 (off by
65
+ * 1000×) and `"12.345.678"` as NaN (two dots). So strip the thousands dots and turn the
66
+ * decimal comma into a dot before parsing. Plain integers (`"177"`, `-150000`) pass through. */
67
+ export const asNumber = (v) => {
68
+ if (v === null || v === undefined || v === '')
69
+ return null;
70
+ if (typeof v === 'number')
71
+ return Number.isFinite(v) ? v : null;
72
+ const n = Number(String(v).trim().replace(/\./g, '').replace(/,/g, '.'));
73
+ return Number.isFinite(n) ? n : null;
74
+ };
75
+ export const isObj = (v) => typeof v === 'object' && v !== null;
76
+ /** `metaData.errors`: a list/dict of `{descripcion}`, or a string. Non-empty ⇒ SII
77
+ * signaled a business error → its `descripcion` verbatim (ADR-004), else null. */
78
+ function f22Error(errors) {
79
+ if (errors === null || errors === undefined)
80
+ return null;
81
+ if (Array.isArray(errors)) {
82
+ const descs = errors
83
+ .map((e) => (isObj(e) ? asStr(e['descripcion']) : null))
84
+ .filter((d) => d !== null);
85
+ return descs.length ? descs.join('; ') : null;
86
+ }
87
+ if (isObj(errors))
88
+ return asStr(errors['descripcion']);
89
+ const s = asStr(errors);
90
+ return s && s !== '' ? s : null;
91
+ }
92
+ export async function postSdi(session, url, namespace, data) {
93
+ const conversationId = (await session.cookie(`${HOSTS.portalApi}/`, CONVERSATION_COOKIE)) ?? '';
94
+ const request = {
95
+ method: 'POST',
96
+ headers: HEADERS,
97
+ // F22 metaData omits `page` (observed); opaque per-request id via Web Crypto.
98
+ body: {
99
+ metaData: { namespace, conversationId, transactionId: globalThis.crypto.randomUUID() },
100
+ data,
101
+ },
102
+ };
103
+ let raw;
104
+ try {
105
+ raw = await session.requestJson(url, request);
106
+ }
107
+ catch (e) {
108
+ // An expired/dead session (the seam raises it) is actionable — let it through.
109
+ if (e instanceof NotAuthenticatedError)
110
+ throw e;
111
+ throw new F22Error('Respuesta inesperada de SII (no es JSON).');
112
+ }
113
+ const parsed = Envelope.safeParse(raw);
114
+ if (!parsed.success)
115
+ throw new F22Error('Respuesta inesperada de SII (no es un objeto JSON del F22).');
116
+ const err = f22Error(parsed.data.metaData?.errors);
117
+ if (err)
118
+ throw new F22Error(err);
119
+ // situacionObservacion surfaces a business error via the top-level `errorMsg`
120
+ // (observed 2026-06-29); pass it verbatim (ADR-004).
121
+ const msg = asStr(parsed.data.errorMsg);
122
+ if (msg !== null && msg.trim() !== '')
123
+ throw new F22Error(msg);
124
+ return parsed.data;
125
+ }
126
+ export const rutDigits = (rut) => ({
127
+ rut: String(rut.body),
128
+ dv: rut.dv,
129
+ });
130
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/portal/f22/shared.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,2FAA2F;AAC3F,qFAAqF;AACrF,oFAAoF;AACpF,2CAA2C;AAC3C,EAAE;AACF,yFAAyF;AACzF,qFAAqF;AACrF,EAAE;AACF,oFAAoF;AACpF,kFAAkF;AAClF,gFAAgF;AAChF,6EAA6E;AAC7E,EAAE;AACF,0EAA0E;AAC1E,uFAAuF;AACvF,kFAAkF;AAClF,yFAAyF;AACzF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;A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AAU,EAAE,EAAE;YACtF,IAAI;SACL;KACF,CAAC;IACF,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,+EAA+E;QAC/E,IAAI,CAAC,YAAY,qBAAqB;YAAE,MAAM,CAAC,CAAC;QAChD,MAAM,IAAI,QAAQ,CAAC,2CAA2C,CAAC,CAAC;IAClE,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,OAAO;QACjB,MAAM,IAAI,QAAQ,CAAC,6DAA6D,CAAC,CAAC;IACpF,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACnD,IAAI,GAAG;QAAE,MAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;IACjC,8EAA8E;IAC9E,qDAAqD;IACrD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,MAAM,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC/D,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAQ,EAA+B,EAAE,CAAC,CAAC;IACnE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;IACrB,EAAE,EAAE,GAAG,CAAC,EAAE;CACX,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /** One curated código of an F22 grid: the code, its parsed value (sign preserved), and the
2
+ * official form label SII serves inline. This is the JSON-serializable unit the surfaces
3
+ * render — pure data, no formatting. */
4
+ export interface CodigoF22 {
5
+ readonly codigo: string;
6
+ readonly valor: number | null;
7
+ readonly glosa: string | null;
8
+ }
9
+ /** The full grid's non-PII códigos organized into the lines a contador reads (#27), each
10
+ * sign-preserving. Identity/bank PII is already dropped upstream; these groups ORGANIZE the
11
+ * rest, with `otros` catching any non-PII código not (yet) mapped — so nothing tax-relevant
12
+ * is hidden. The union of the SIX equals the flat grid. */
13
+ export interface F22Grupos {
14
+ readonly ingresos: readonly CodigoF22[];
15
+ readonly deducciones: readonly CodigoF22[];
16
+ readonly creditos: readonly CodigoF22[];
17
+ readonly calculo: readonly CodigoF22[];
18
+ readonly resultado: readonly CodigoF22[];
19
+ readonly otros: readonly CodigoF22[];
20
+ }
21
+ /** Is this código identity/bank PII (must be dropped from every grid)? */
22
+ export declare function isHeaderCodigo(codigo: string): boolean;
23
+ /** Organize the (already PII-dropped) grid into the lines a contador reads:
24
+ * ingresos / deducciones / retenciones·PPM·créditos / cálculo / resultado, with `otros`
25
+ * catching any non-PII código not yet mapped — so nothing tax-relevant is hidden. Order
26
+ * within a group preserves the wire order; the union of the SIX equals the input. */
27
+ export declare function groupCodigos(codigos: readonly CodigoF22[]): F22Grupos;
28
+ //# sourceMappingURL=f22-codigos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"f22-codigos.d.ts","sourceRoot":"","sources":["../../src/portal/f22-codigos.ts"],"names":[],"mappings":"AAWA;;yCAEyC;AACzC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;4DAG4D;AAC5D,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,SAAS,EAAE,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,SAAS,SAAS,EAAE,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,SAAS,SAAS,EAAE,CAAC;IAGxC,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,SAAS,EAAE,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;CACtC;AAoCD,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEtD;AAqED;;;sFAGsF;AACtF,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAgBrE"}
@@ -0,0 +1,141 @@
1
+ // F22 código taxonomy — the DOMAIN knowledge of the Declaración Anual de Renta form,
2
+ // separated from the wire facade (`f22.ts`). These two change for different reasons: the
3
+ // facade changes when SII moves an endpoint or alters the envelope; this file changes when
4
+ // we observe a new código and classify it. Everything here is derived from first-hand
5
+ // observation of real declarations (cited inline) — no third-party legend (ADR-004).
6
+ //
7
+ // Two responsibilities:
8
+ // 1. The PII denylist (`HEADER_CODIGOS`) — which códigos are identity/bank, hence dropped.
9
+ // 2. The contador grouping (`groupCodigos`) — how the remaining tax códigos organize into
10
+ // the lines a person reads (ingresos / deducciones / retenciones·PPM·créditos / resultado).
11
+ // HEADER / PII códigos — DROPPED from every curated grid (F22 has no `raw`, so these never
12
+ // surface anywhere). Authoritative basis: `codigosFormato.codigosCabecera` (the form skeleton,
13
+ // live 2026-06-29) lists the 12 header códigos 1/2/3/5/6/7/8/9/13/14/55/903 (apellidos/RUT/
14
+ // nombres/calle/folio/comuna/giro/región?/email + 9,903). To those we add the date/moneda
15
+ // metadata (15,53,315,8811) and the bank/identity códigos that live in the BODY, not the
16
+ // cabecera: 301/306/780 (banco/cuenta/tipo), 9306 (código de banco), 9920 (dirección origen),
17
+ // and 8809 (the RUT again as a bare integer — caught leaking via test MF3). Small + bounded +
18
+ // authoritative, so the denylist stays comprehensive (we never allowlist tax códigos — that
19
+ // hides real income; see CONVENTIONS).
20
+ const HEADER_CODIGOS = new Set([
21
+ '1',
22
+ '2',
23
+ '3',
24
+ '5',
25
+ '6',
26
+ '7',
27
+ '8',
28
+ '9',
29
+ '13',
30
+ '14',
31
+ '15',
32
+ '53',
33
+ '55',
34
+ '315',
35
+ '903',
36
+ '8809',
37
+ '8811',
38
+ '301',
39
+ '306',
40
+ '780',
41
+ '9306',
42
+ '9920',
43
+ ]);
44
+ /** Is this código identity/bank PII (must be dropped from every grid)? */
45
+ export function isHeaderCodigo(codigo) {
46
+ return HEADER_CODIGOS.has(codigo);
47
+ }
48
+ // Semantic código → group map for the `--full` grid (#27). The grid already dropped PII; these
49
+ // groups ORGANIZE the remaining (non-PII) tax códigos — anything not mapped falls through to
50
+ // `otros` (VISIBLE, never hidden), so the readback stays COMPLETE. Derived from glosas observed
51
+ // LIVE across AT 2023–2026 (own account, 2026-06-29); extend it (move a código from `otros` into
52
+ // a group) with an `// observed …` citation as new códigos appear (ADR-004).
53
+ const INGRESOS_CODIGOS = new Set([
54
+ '110', // Rentas percibidas art 42 Nº2 (honorarios)
55
+ '155', // Rentas de capitales mobiliarios (art 20 Nº2)
56
+ '161', // Rta Art 42 Nº1
57
+ '170', // BASE IMPONIBLE ANUAL DE IUSC o IGC
58
+ '461', // Honorarios Anuales Con Retención
59
+ '467', // Total Honorarios
60
+ '545', // Honorarios Anuales Sin Retención
61
+ '547', // Total Ingresos Brutos
62
+ '618', // Total Rentas y Retenciones
63
+ '645', // CPT positivo final
64
+ '646', // CPT negativo final (par de 645 — surfaced via `otros` live 2026-06-29, AT 2026)
65
+ '1098', // Sueldos, pensiones y otras rentas
66
+ '1813', // enajenación/rescate art 107 (recuadro)
67
+ '1814',
68
+ '1816',
69
+ '1829',
70
+ '1830',
71
+ '1867', // Rentas de capitales mobiliarios (recuadro)
72
+ ]);
73
+ const DEDUCCIONES_CODIGOS = new Set([
74
+ '169', // Pérdida en operaciones de capitales mobiliarios
75
+ '494', // Gastos presuntos 30% sobre el código 547
76
+ '900', // Cargo por cotizaciones previsionales
77
+ ]);
78
+ // "Retenciones · PPM · Créditos" — retenciones de honorarios, pagos provisionales y créditos.
79
+ const CREDITOS_CODIGOS = new Set([
80
+ '36', // PPM / Pagos provisionales
81
+ '119', // Remanente de crédito por reliquidación del IUSC
82
+ '162', // Crédito al IGC o IUSC
83
+ '198', // Retenciones por rentas declaradas en código 110
84
+ '492', // Impuesto Retenido de Honorarios Con Retención
85
+ '611', // Retenciones Recuadro Nº1
86
+ '619', // Impuesto Retenido del Total Rentas y Retenciones
87
+ '757', // Remanente código 119 y código 116
88
+ '849', // Pago Provisional (art 84) / Rebaja Crédito AFP
89
+ '1905', // PPM de segunda categoría art 84 letra b)
90
+ ]);
91
+ // Intermediate IGC/IUSC computation steps — NOT final outcomes. Split out of `resultado`
92
+ // (#28 review): a "SUB TOTAL" / "según tabla" / "débito fiscal" is a calc step, not a result.
93
+ // Surfaced in its own `calculo` group (never hidden — they're real tax códigos).
94
+ const CALCULO_CODIGOS = new Set([
95
+ '157', // IGC o IUSC, según tabla
96
+ '158', // SUB TOTAL
97
+ '304', // IGC o IUSC, débito fiscal / tasa adicional
98
+ ]);
99
+ const RESULTADO_CODIGOS = new Set([
100
+ '31', // IGC o IUSC, tasa adicional
101
+ '39', // Reajuste art.72
102
+ '85', // Saldo a Favor
103
+ '86', // Saldo Puesto a Disposición de los Socios
104
+ '87', // Monto devolución solicitada
105
+ '90', // Impuesto Adeudado
106
+ '91', // TOTAL A PAGAR (90+39)
107
+ '92', // Reajustes Declaración Fuera de Plazo
108
+ '93', // Intereses y Multas Declaración Fuera de Plazo
109
+ '94', // TOTAL A PAGAR (91+92+93)
110
+ '98', // (codigosPie — total/giro)
111
+ '305', // RESULTADO LIQUIDACIÓN ANUAL
112
+ '795', // (codigosPie — total/giro)
113
+ ]);
114
+ /** Organize the (already PII-dropped) grid into the lines a contador reads:
115
+ * ingresos / deducciones / retenciones·PPM·créditos / cálculo / resultado, with `otros`
116
+ * catching any non-PII código not yet mapped — so nothing tax-relevant is hidden. Order
117
+ * within a group preserves the wire order; the union of the SIX equals the input. */
118
+ export function groupCodigos(codigos) {
119
+ const ingresos = [];
120
+ const deducciones = [];
121
+ const creditos = [];
122
+ const calculo = [];
123
+ const resultado = [];
124
+ const otros = [];
125
+ for (const c of codigos) {
126
+ if (INGRESOS_CODIGOS.has(c.codigo))
127
+ ingresos.push(c);
128
+ else if (DEDUCCIONES_CODIGOS.has(c.codigo))
129
+ deducciones.push(c);
130
+ else if (CREDITOS_CODIGOS.has(c.codigo))
131
+ creditos.push(c);
132
+ else if (CALCULO_CODIGOS.has(c.codigo))
133
+ calculo.push(c);
134
+ else if (RESULTADO_CODIGOS.has(c.codigo))
135
+ resultado.push(c);
136
+ else
137
+ otros.push(c); // non-PII, unmapped — still surfaced
138
+ }
139
+ return { ingresos, deducciones, creditos, calculo, resultado, otros };
140
+ }
141
+ //# sourceMappingURL=f22-codigos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"f22-codigos.js","sourceRoot":"","sources":["../../src/portal/f22-codigos.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,yFAAyF;AACzF,2FAA2F;AAC3F,sFAAsF;AACtF,qFAAqF;AACrF,EAAE;AACF,wBAAwB;AACxB,6FAA6F;AAC7F,4FAA4F;AAC5F,iGAAiG;AA0BjG,2FAA2F;AAC3F,+FAA+F;AAC/F,4FAA4F;AAC5F,0FAA0F;AAC1F,yFAAyF;AACzF,8FAA8F;AAC9F,8FAA8F;AAC9F,4FAA4F;AAC5F,uCAAuC;AACvC,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC;IAClD,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,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AAI,CAAC,CAAC,CAAC,CAAC;aACrD,IAAI,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACnD,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;YAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;YACvD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,qCAAqC;IAC3D,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACxE,CAAC"}
@@ -0,0 +1,15 @@
1
+ export type F29Grupo = 'debitos' | 'creditos' | 'retenciones' | 'otros' | 'totales';
2
+ export interface CodigoF29Meta {
3
+ readonly glosa: string;
4
+ /** Sign in the form: '+' suma, '-' resta, '=' total/subtotal, '' header/sin signo. */
5
+ readonly signo: '+' | '-' | '=' | '';
6
+ readonly grupo: F29Grupo;
7
+ }
8
+ /** Human labels for each group (the contador reading order). */
9
+ export declare const F29_GRUPO_LABELS: Record<F29Grupo, string>;
10
+ export declare const F29_CODIGOS: Record<string, CodigoF29Meta>;
11
+ /** Glosa for a código, or null when unobserved (then label it by its number). */
12
+ export declare function glosaF29(codigo: string): string | null;
13
+ /** Group for a código; an unobserved código → 'otros' (surfaced, never hidden). */
14
+ export declare function grupoF29(codigo: string): F29Grupo;
15
+ //# sourceMappingURL=f29-codigos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"f29-codigos.d.ts","sourceRoot":"","sources":["../../src/portal/f29-codigos.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B;AAED,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAMrD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAgjBrD,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEtD;AAED,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAEjD"}