@accounter/opcn1214-generator 0.0.0-bootstrap.0 → 0.0.0-stage

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 (477) hide show
  1. package/README.md +2 -336
  2. package/package.json +3 -74
  3. package/.bob/cjs/api/generate.d.ts +0 -44
  4. package/.bob/cjs/api/generate.js +0 -115
  5. package/.bob/cjs/api/parse.d.ts +0 -28
  6. package/.bob/cjs/api/parse.js +0 -38
  7. package/.bob/cjs/api/response.d.ts +0 -24
  8. package/.bob/cjs/api/response.js +0 -75
  9. package/.bob/cjs/api/validate.d.ts +0 -16
  10. package/.bob/cjs/api/validate.js +0 -15
  11. package/.bob/cjs/codec/boolean.d.ts +0 -7
  12. package/.bob/cjs/codec/boolean.js +0 -49
  13. package/.bob/cjs/codec/date.d.ts +0 -6
  14. package/.bob/cjs/codec/date.js +0 -68
  15. package/.bob/cjs/codec/enum.d.ts +0 -4
  16. package/.bob/cjs/codec/enum.js +0 -26
  17. package/.bob/cjs/codec/numeric.d.ts +0 -56
  18. package/.bob/cjs/codec/numeric.js +0 -186
  19. package/.bob/cjs/codec/padding.d.ts +0 -10
  20. package/.bob/cjs/codec/padding.js +0 -26
  21. package/.bob/cjs/codec/percent.d.ts +0 -6
  22. package/.bob/cjs/codec/percent.js +0 -33
  23. package/.bob/cjs/codec/phone.d.ts +0 -4
  24. package/.bob/cjs/codec/phone.js +0 -48
  25. package/.bob/cjs/codec/record.d.ts +0 -18
  26. package/.bob/cjs/codec/record.js +0 -176
  27. package/.bob/cjs/codec/registry.d.ts +0 -8
  28. package/.bob/cjs/codec/registry.js +0 -27
  29. package/.bob/cjs/codec/sections.d.ts +0 -41
  30. package/.bob/cjs/codec/sections.js +0 -177
  31. package/.bob/cjs/codec/text.d.ts +0 -5
  32. package/.bob/cjs/codec/text.js +0 -29
  33. package/.bob/cjs/codec/types.d.ts +0 -36
  34. package/.bob/cjs/codec/types.js +0 -16
  35. package/.bob/cjs/codec/windows1255.d.ts +0 -9
  36. package/.bob/cjs/codec/windows1255.js +0 -38
  37. package/.bob/cjs/errors.d.ts +0 -32
  38. package/.bob/cjs/errors.js +0 -103
  39. package/.bob/cjs/file/assemble.d.ts +0 -17
  40. package/.bob/cjs/file/assemble.js +0 -28
  41. package/.bob/cjs/file/control.d.ts +0 -13
  42. package/.bob/cjs/file/control.js +0 -45
  43. package/.bob/cjs/file/parse.d.ts +0 -18
  44. package/.bob/cjs/file/parse.js +0 -478
  45. package/.bob/cjs/file/split.d.ts +0 -17
  46. package/.bob/cjs/file/split.js +0 -71
  47. package/.bob/cjs/index.d.ts +0 -16
  48. package/.bob/cjs/index.js +0 -28
  49. package/.bob/cjs/layout/2024/layout.generated.d.ts +0 -6919
  50. package/.bob/cjs/layout/2024/layout.generated.js +0 -7224
  51. package/.bob/cjs/layout/2025/index.d.ts +0 -6
  52. package/.bob/cjs/layout/2025/index.js +0 -10
  53. package/.bob/cjs/layout/capital-gains.d.ts +0 -9
  54. package/.bob/cjs/layout/capital-gains.js +0 -15
  55. package/.bob/cjs/layout/countries.d.ts +0 -5
  56. package/.bob/cjs/layout/countries.js +0 -10
  57. package/.bob/cjs/layout/freeze.d.ts +0 -5
  58. package/.bob/cjs/layout/freeze.js +0 -16
  59. package/.bob/cjs/layout/registry.d.ts +0 -10
  60. package/.bob/cjs/layout/registry.js +0 -32
  61. package/.bob/cjs/layout/types.d.ts +0 -82
  62. package/.bob/cjs/layout/types.js +0 -35
  63. package/.bob/cjs/model/codes.generated.d.ts +0 -48
  64. package/.bob/cjs/model/codes.generated.js +0 -628
  65. package/.bob/cjs/model/index.d.ts +0 -3
  66. package/.bob/cjs/model/index.js +0 -5
  67. package/.bob/cjs/model/input.d.ts +0 -543
  68. package/.bob/cjs/model/input.js +0 -24
  69. package/.bob/cjs/model/normalized.d.ts +0 -43
  70. package/.bob/cjs/model/normalized.js +0 -0
  71. package/.bob/cjs/model/options.d.ts +0 -14
  72. package/.bob/cjs/model/options.js +0 -0
  73. package/.bob/cjs/model/schema.d.ts +0 -594
  74. package/.bob/cjs/model/schema.js +0 -339
  75. package/.bob/cjs/normalize/canonical.d.ts +0 -13
  76. package/.bob/cjs/normalize/canonical.js +0 -288
  77. package/.bob/cjs/normalize/capital-gains/assets.d.ts +0 -37
  78. package/.bob/cjs/normalize/capital-gains/assets.js +0 -94
  79. package/.bob/cjs/normalize/capital-gains/index.d.ts +0 -61
  80. package/.bob/cjs/normalize/capital-gains/index.js +0 -149
  81. package/.bob/cjs/normalize/capital-gains/no-withholding.d.ts +0 -18
  82. package/.bob/cjs/normalize/capital-gains/no-withholding.js +0 -36
  83. package/.bob/cjs/normalize/capital-gains/other.d.ts +0 -54
  84. package/.bob/cjs/normalize/capital-gains/other.js +0 -122
  85. package/.bob/cjs/normalize/capital-gains/section6.d.ts +0 -7
  86. package/.bob/cjs/normalize/capital-gains/section6.js +0 -13
  87. package/.bob/cjs/normalize/capital-gains/securities.d.ts +0 -26
  88. package/.bob/cjs/normalize/capital-gains/securities.js +0 -58
  89. package/.bob/cjs/normalize/denormalize.d.ts +0 -42
  90. package/.bob/cjs/normalize/denormalize.js +0 -359
  91. package/.bob/cjs/normalize/derive.d.ts +0 -57
  92. package/.bob/cjs/normalize/derive.js +0 -111
  93. package/.bob/cjs/normalize/enums.d.ts +0 -58
  94. package/.bob/cjs/normalize/enums.js +0 -69
  95. package/.bob/cjs/normalize/fields.d.ts +0 -28
  96. package/.bob/cjs/normalize/fields.js +0 -86
  97. package/.bob/cjs/normalize/foreign.d.ts +0 -22
  98. package/.bob/cjs/normalize/foreign.js +0 -85
  99. package/.bob/cjs/normalize/main.d.ts +0 -24
  100. package/.bob/cjs/normalize/main.js +0 -208
  101. package/.bob/cjs/normalize/paths.d.ts +0 -74
  102. package/.bob/cjs/normalize/paths.js +0 -169
  103. package/.bob/cjs/normalize/phone.d.ts +0 -12
  104. package/.bob/cjs/normalize/phone.js +0 -35
  105. package/.bob/cjs/normalize/rd-investments.d.ts +0 -10
  106. package/.bob/cjs/normalize/rd-investments.js +0 -25
  107. package/.bob/cjs/normalize/related-companies.d.ts +0 -10
  108. package/.bob/cjs/normalize/related-companies.js +0 -25
  109. package/.bob/cjs/normalize/report.d.ts +0 -9
  110. package/.bob/cjs/normalize/report.js +0 -53
  111. package/.bob/cjs/normalize/shareholders.d.ts +0 -10
  112. package/.bob/cjs/normalize/shareholders.js +0 -30
  113. package/.bob/cjs/normalize/text.d.ts +0 -11
  114. package/.bob/cjs/normalize/text.js +0 -41
  115. package/.bob/cjs/normalize/today.d.ts +0 -4
  116. package/.bob/cjs/normalize/today.js +0 -14
  117. package/.bob/cjs/pipeline.d.ts +0 -13
  118. package/.bob/cjs/pipeline.js +0 -37
  119. package/.bob/cjs/response/codes.d.ts +0 -2
  120. package/.bob/cjs/response/codes.js +0 -31
  121. package/.bob/cjs/validate/capital-gains-rules.d.ts +0 -6
  122. package/.bob/cjs/validate/capital-gains-rules.js +0 -162
  123. package/.bob/cjs/validate/check-digit.d.ts +0 -10
  124. package/.bob/cjs/validate/check-digit.js +0 -26
  125. package/.bob/cjs/validate/engine.d.ts +0 -5
  126. package/.bob/cjs/validate/engine.js +0 -35
  127. package/.bob/cjs/validate/field-rules.d.ts +0 -4
  128. package/.bob/cjs/validate/field-rules.js +0 -331
  129. package/.bob/cjs/validate/foreign-rules.d.ts +0 -6
  130. package/.bob/cjs/validate/foreign-rules.js +0 -171
  131. package/.bob/cjs/validate/issue.d.ts +0 -51
  132. package/.bob/cjs/validate/issue.js +0 -78
  133. package/.bob/cjs/validate/main-rules.d.ts +0 -24
  134. package/.bob/cjs/validate/main-rules.js +0 -425
  135. package/.bob/cjs/validate/parse-rules.d.ts +0 -31
  136. package/.bob/cjs/validate/parse-rules.js +0 -114
  137. package/.bob/cjs/validate/rules.d.ts +0 -746
  138. package/.bob/cjs/validate/rules.js +0 -680
  139. package/.bob/cjs/validate/shape.d.ts +0 -19
  140. package/.bob/cjs/validate/shape.js +0 -231
  141. package/.bob/cjs/validate/shareholder-rules.d.ts +0 -6
  142. package/.bob/cjs/validate/shareholder-rules.js +0 -83
  143. package/.bob/cjs/validate/structure-rules.d.ts +0 -26
  144. package/.bob/cjs/validate/structure-rules.js +0 -130
  145. package/.bob/esm/api/generate.d.ts +0 -44
  146. package/.bob/esm/api/generate.js +0 -111
  147. package/.bob/esm/api/parse.d.ts +0 -28
  148. package/.bob/esm/api/parse.js +0 -34
  149. package/.bob/esm/api/response.d.ts +0 -24
  150. package/.bob/esm/api/response.js +0 -72
  151. package/.bob/esm/api/validate.d.ts +0 -16
  152. package/.bob/esm/api/validate.js +0 -11
  153. package/.bob/esm/codec/boolean.d.ts +0 -7
  154. package/.bob/esm/codec/boolean.js +0 -46
  155. package/.bob/esm/codec/date.d.ts +0 -6
  156. package/.bob/esm/codec/date.js +0 -64
  157. package/.bob/esm/codec/enum.d.ts +0 -4
  158. package/.bob/esm/codec/enum.js +0 -23
  159. package/.bob/esm/codec/numeric.d.ts +0 -56
  160. package/.bob/esm/codec/numeric.js +0 -175
  161. package/.bob/esm/codec/padding.d.ts +0 -10
  162. package/.bob/esm/codec/padding.js +0 -21
  163. package/.bob/esm/codec/percent.d.ts +0 -6
  164. package/.bob/esm/codec/percent.js +0 -30
  165. package/.bob/esm/codec/phone.d.ts +0 -4
  166. package/.bob/esm/codec/phone.js +0 -45
  167. package/.bob/esm/codec/record.d.ts +0 -18
  168. package/.bob/esm/codec/record.js +0 -172
  169. package/.bob/esm/codec/registry.d.ts +0 -8
  170. package/.bob/esm/codec/registry.js +0 -23
  171. package/.bob/esm/codec/sections.d.ts +0 -41
  172. package/.bob/esm/codec/sections.js +0 -170
  173. package/.bob/esm/codec/text.d.ts +0 -5
  174. package/.bob/esm/codec/text.js +0 -26
  175. package/.bob/esm/codec/types.d.ts +0 -36
  176. package/.bob/esm/codec/types.js +0 -12
  177. package/.bob/esm/codec/windows1255.d.ts +0 -9
  178. package/.bob/esm/codec/windows1255.js +0 -32
  179. package/.bob/esm/errors.d.ts +0 -32
  180. package/.bob/esm/errors.js +0 -94
  181. package/.bob/esm/file/assemble.d.ts +0 -17
  182. package/.bob/esm/file/assemble.js +0 -25
  183. package/.bob/esm/file/control.d.ts +0 -13
  184. package/.bob/esm/file/control.js +0 -41
  185. package/.bob/esm/file/parse.d.ts +0 -18
  186. package/.bob/esm/file/parse.js +0 -474
  187. package/.bob/esm/file/split.d.ts +0 -17
  188. package/.bob/esm/file/split.js +0 -68
  189. package/.bob/esm/index.d.ts +0 -16
  190. package/.bob/esm/index.js +0 -11
  191. package/.bob/esm/layout/2024/layout.generated.d.ts +0 -6919
  192. package/.bob/esm/layout/2024/layout.generated.js +0 -7221
  193. package/.bob/esm/layout/2025/index.d.ts +0 -6
  194. package/.bob/esm/layout/2025/index.js +0 -7
  195. package/.bob/esm/layout/capital-gains.d.ts +0 -9
  196. package/.bob/esm/layout/capital-gains.js +0 -11
  197. package/.bob/esm/layout/countries.d.ts +0 -5
  198. package/.bob/esm/layout/countries.js +0 -7
  199. package/.bob/esm/layout/freeze.d.ts +0 -5
  200. package/.bob/esm/layout/freeze.js +0 -13
  201. package/.bob/esm/layout/registry.d.ts +0 -10
  202. package/.bob/esm/layout/registry.js +0 -27
  203. package/.bob/esm/layout/types.d.ts +0 -82
  204. package/.bob/esm/layout/types.js +0 -32
  205. package/.bob/esm/model/codes.generated.d.ts +0 -48
  206. package/.bob/esm/model/codes.generated.js +0 -625
  207. package/.bob/esm/model/index.d.ts +0 -3
  208. package/.bob/esm/model/index.js +0 -2
  209. package/.bob/esm/model/input.d.ts +0 -543
  210. package/.bob/esm/model/input.js +0 -21
  211. package/.bob/esm/model/normalized.d.ts +0 -43
  212. package/.bob/esm/model/normalized.js +0 -0
  213. package/.bob/esm/model/options.d.ts +0 -14
  214. package/.bob/esm/model/options.js +0 -0
  215. package/.bob/esm/model/schema.d.ts +0 -594
  216. package/.bob/esm/model/schema.js +0 -335
  217. package/.bob/esm/normalize/canonical.d.ts +0 -13
  218. package/.bob/esm/normalize/canonical.js +0 -285
  219. package/.bob/esm/normalize/capital-gains/assets.d.ts +0 -37
  220. package/.bob/esm/normalize/capital-gains/assets.js +0 -87
  221. package/.bob/esm/normalize/capital-gains/index.d.ts +0 -61
  222. package/.bob/esm/normalize/capital-gains/index.js +0 -142
  223. package/.bob/esm/normalize/capital-gains/no-withholding.d.ts +0 -18
  224. package/.bob/esm/normalize/capital-gains/no-withholding.js +0 -31
  225. package/.bob/esm/normalize/capital-gains/other.d.ts +0 -54
  226. package/.bob/esm/normalize/capital-gains/other.js +0 -112
  227. package/.bob/esm/normalize/capital-gains/section6.d.ts +0 -7
  228. package/.bob/esm/normalize/capital-gains/section6.js +0 -9
  229. package/.bob/esm/normalize/capital-gains/securities.d.ts +0 -26
  230. package/.bob/esm/normalize/capital-gains/securities.js +0 -52
  231. package/.bob/esm/normalize/denormalize.d.ts +0 -42
  232. package/.bob/esm/normalize/denormalize.js +0 -354
  233. package/.bob/esm/normalize/derive.d.ts +0 -57
  234. package/.bob/esm/normalize/derive.js +0 -99
  235. package/.bob/esm/normalize/enums.d.ts +0 -58
  236. package/.bob/esm/normalize/enums.js +0 -64
  237. package/.bob/esm/normalize/fields.d.ts +0 -28
  238. package/.bob/esm/normalize/fields.js +0 -81
  239. package/.bob/esm/normalize/foreign.d.ts +0 -22
  240. package/.bob/esm/normalize/foreign.js +0 -81
  241. package/.bob/esm/normalize/main.d.ts +0 -24
  242. package/.bob/esm/normalize/main.js +0 -204
  243. package/.bob/esm/normalize/paths.d.ts +0 -74
  244. package/.bob/esm/normalize/paths.js +0 -161
  245. package/.bob/esm/normalize/phone.d.ts +0 -12
  246. package/.bob/esm/normalize/phone.js +0 -32
  247. package/.bob/esm/normalize/rd-investments.d.ts +0 -10
  248. package/.bob/esm/normalize/rd-investments.js +0 -22
  249. package/.bob/esm/normalize/related-companies.d.ts +0 -10
  250. package/.bob/esm/normalize/related-companies.js +0 -22
  251. package/.bob/esm/normalize/report.d.ts +0 -9
  252. package/.bob/esm/normalize/report.js +0 -50
  253. package/.bob/esm/normalize/shareholders.d.ts +0 -10
  254. package/.bob/esm/normalize/shareholders.js +0 -27
  255. package/.bob/esm/normalize/text.d.ts +0 -11
  256. package/.bob/esm/normalize/text.js +0 -37
  257. package/.bob/esm/normalize/today.d.ts +0 -4
  258. package/.bob/esm/normalize/today.js +0 -11
  259. package/.bob/esm/pipeline.d.ts +0 -13
  260. package/.bob/esm/pipeline.js +0 -34
  261. package/.bob/esm/response/codes.d.ts +0 -2
  262. package/.bob/esm/response/codes.js +0 -28
  263. package/.bob/esm/validate/capital-gains-rules.d.ts +0 -6
  264. package/.bob/esm/validate/capital-gains-rules.js +0 -159
  265. package/.bob/esm/validate/check-digit.d.ts +0 -10
  266. package/.bob/esm/validate/check-digit.js +0 -23
  267. package/.bob/esm/validate/engine.d.ts +0 -5
  268. package/.bob/esm/validate/engine.js +0 -32
  269. package/.bob/esm/validate/field-rules.d.ts +0 -4
  270. package/.bob/esm/validate/field-rules.js +0 -328
  271. package/.bob/esm/validate/foreign-rules.d.ts +0 -6
  272. package/.bob/esm/validate/foreign-rules.js +0 -168
  273. package/.bob/esm/validate/issue.d.ts +0 -51
  274. package/.bob/esm/validate/issue.js +0 -72
  275. package/.bob/esm/validate/main-rules.d.ts +0 -24
  276. package/.bob/esm/validate/main-rules.js +0 -420
  277. package/.bob/esm/validate/parse-rules.d.ts +0 -31
  278. package/.bob/esm/validate/parse-rules.js +0 -110
  279. package/.bob/esm/validate/rules.d.ts +0 -746
  280. package/.bob/esm/validate/rules.js +0 -676
  281. package/.bob/esm/validate/shape.d.ts +0 -19
  282. package/.bob/esm/validate/shape.js +0 -227
  283. package/.bob/esm/validate/shareholder-rules.d.ts +0 -6
  284. package/.bob/esm/validate/shareholder-rules.js +0 -80
  285. package/.bob/esm/validate/structure-rules.d.ts +0 -26
  286. package/.bob/esm/validate/structure-rules.js +0 -122
  287. package/.bob/tsconfig.tsbuildinfo +0 -1
  288. package/.gitattributes +0 -1
  289. package/CLAUDE.md +0 -39
  290. package/dist/cjs/index.js +0 -28
  291. package/dist/esm/index.js +0 -11
  292. package/documentation/IMPLEMENTATION_PLAN.md +0 -2258
  293. package/documentation/SPEC.md +0 -1803
  294. package/documentation/layout/2024/codes.csv +0 -261
  295. package/documentation/layout/2024/countries.csv +0 -256
  296. package/documentation/layout/2024/fields.csv +0 -271
  297. package/documentation/layout/2024/records.csv +0 -18
  298. package/documentation/layout/README.md +0 -87
  299. package/documentation/specifications/1214-2024.pdf +0 -0
  300. package/documentation/tools/extract_layout.py +0 -191
  301. package/scripts/generate-layout.ts +0 -23
  302. package/scripts/layout/csv.ts +0 -111
  303. package/scripts/layout/derived-codes.ts +0 -12
  304. package/scripts/layout/render.ts +0 -364
  305. package/scripts/layout/sources.ts +0 -51
  306. package/scripts/layout/values.ts +0 -42
  307. package/scripts/render-rules-table.ts +0 -66
  308. package/src/api/generate.ts +0 -169
  309. package/src/api/parse.ts +0 -58
  310. package/src/api/response.ts +0 -110
  311. package/src/api/validate.ts +0 -26
  312. package/src/codec/boolean.ts +0 -62
  313. package/src/codec/date.ts +0 -75
  314. package/src/codec/enum.ts +0 -28
  315. package/src/codec/numeric.ts +0 -208
  316. package/src/codec/padding.ts +0 -33
  317. package/src/codec/percent.ts +0 -35
  318. package/src/codec/phone.ts +0 -54
  319. package/src/codec/record.ts +0 -206
  320. package/src/codec/registry.ts +0 -27
  321. package/src/codec/sections.ts +0 -208
  322. package/src/codec/text.ts +0 -31
  323. package/src/codec/types.ts +0 -47
  324. package/src/codec/windows1255.ts +0 -38
  325. package/src/errors.ts +0 -114
  326. package/src/file/assemble.ts +0 -42
  327. package/src/file/control.ts +0 -59
  328. package/src/file/parse.ts +0 -620
  329. package/src/file/split.ts +0 -86
  330. package/src/index.ts +0 -70
  331. package/src/layout/2024/layout.generated.ts +0 -7238
  332. package/src/layout/2025/index.ts +0 -9
  333. package/src/layout/capital-gains.ts +0 -20
  334. package/src/layout/countries.ts +0 -7
  335. package/src/layout/freeze.ts +0 -13
  336. package/src/layout/registry.ts +0 -33
  337. package/src/layout/types.ts +0 -134
  338. package/src/model/codes.generated.ts +0 -1190
  339. package/src/model/index.ts +0 -4
  340. package/src/model/input.ts +0 -594
  341. package/src/model/normalized.ts +0 -38
  342. package/src/model/options.ts +0 -17
  343. package/src/model/schema.ts +0 -381
  344. package/src/normalize/canonical.ts +0 -374
  345. package/src/normalize/capital-gains/assets.ts +0 -112
  346. package/src/normalize/capital-gains/index.ts +0 -212
  347. package/src/normalize/capital-gains/no-withholding.ts +0 -46
  348. package/src/normalize/capital-gains/other.ts +0 -153
  349. package/src/normalize/capital-gains/section6.ts +0 -14
  350. package/src/normalize/capital-gains/securities.ts +0 -73
  351. package/src/normalize/denormalize.ts +0 -426
  352. package/src/normalize/derive.ts +0 -136
  353. package/src/normalize/enums.ts +0 -87
  354. package/src/normalize/fields.ts +0 -110
  355. package/src/normalize/foreign.ts +0 -114
  356. package/src/normalize/main.ts +0 -284
  357. package/src/normalize/paths.ts +0 -184
  358. package/src/normalize/phone.ts +0 -45
  359. package/src/normalize/rd-investments.ts +0 -38
  360. package/src/normalize/related-companies.ts +0 -37
  361. package/src/normalize/report.ts +0 -59
  362. package/src/normalize/shareholders.ts +0 -42
  363. package/src/normalize/text.ts +0 -40
  364. package/src/normalize/today.ts +0 -15
  365. package/src/pipeline.ts +0 -42
  366. package/src/response/codes.ts +0 -30
  367. package/src/validate/capital-gains-rules.ts +0 -199
  368. package/src/validate/check-digit.ts +0 -25
  369. package/src/validate/engine.ts +0 -45
  370. package/src/validate/field-rules.ts +0 -383
  371. package/src/validate/foreign-rules.ts +0 -274
  372. package/src/validate/issue.ts +0 -121
  373. package/src/validate/main-rules.ts +0 -678
  374. package/src/validate/parse-rules.ts +0 -169
  375. package/src/validate/rules.ts +0 -747
  376. package/src/validate/shape.ts +0 -278
  377. package/src/validate/shareholder-rules.ts +0 -92
  378. package/src/validate/structure-rules.ts +0 -136
  379. package/tests/api/batch.test.ts +0 -227
  380. package/tests/api/exports.test.ts +0 -355
  381. package/tests/api/generate.test.ts +0 -409
  382. package/tests/api/parse.test.ts +0 -789
  383. package/tests/api/response.test.ts +0 -152
  384. package/tests/api/validate.test.ts +0 -86
  385. package/tests/codec/numeric.test.ts +0 -325
  386. package/tests/codec/record.test.ts +0 -318
  387. package/tests/codec/registry.test.ts +0 -17
  388. package/tests/codec/sections.test.ts +0 -333
  389. package/tests/codec/text.test.ts +0 -454
  390. package/tests/codec/windows1255.test.ts +0 -46
  391. package/tests/docs/readme.test.ts +0 -69
  392. package/tests/edge-cases.test.ts +0 -359
  393. package/tests/errors.test.ts +0 -138
  394. package/tests/file/assemble.test.ts +0 -188
  395. package/tests/file/split.test.ts +0 -61
  396. package/tests/fixtures/builders.ts +0 -512
  397. package/tests/fixtures/files.ts +0 -78
  398. package/tests/fixtures/golden/README.md +0 -37
  399. package/tests/fixtures/golden/VERIFICATION.md +0 -72
  400. package/tests/fixtures/golden/batch-50.input.ts +0 -92
  401. package/tests/fixtures/golden/batch-50.opcn +0 -150
  402. package/tests/fixtures/golden/capital-gains-max.input.ts +0 -177
  403. package/tests/fixtures/golden/capital-gains-max.opcn +0 -17
  404. package/tests/fixtures/golden/cg-27.input.ts +0 -63
  405. package/tests/fixtures/golden/cg-27.opcn +0 -4
  406. package/tests/fixtures/golden/cg-50.input.ts +0 -59
  407. package/tests/fixtures/golden/cg-50.opcn +0 -4
  408. package/tests/fixtures/golden/cg-51.input.ts +0 -60
  409. package/tests/fixtures/golden/cg-51.opcn +0 -4
  410. package/tests/fixtures/golden/cg-54.input.ts +0 -53
  411. package/tests/fixtures/golden/cg-54.opcn +0 -4
  412. package/tests/fixtures/golden/cg-60.input.ts +0 -77
  413. package/tests/fixtures/golden/cg-60.opcn +0 -4
  414. package/tests/fixtures/golden/cg-63.input.ts +0 -51
  415. package/tests/fixtures/golden/cg-63.opcn +0 -4
  416. package/tests/fixtures/golden/cg-64.input.ts +0 -62
  417. package/tests/fixtures/golden/cg-64.opcn +0 -4
  418. package/tests/fixtures/golden/cg-65.input.ts +0 -79
  419. package/tests/fixtures/golden/cg-65.opcn +0 -4
  420. package/tests/fixtures/golden/cg-66.input.ts +0 -53
  421. package/tests/fixtures/golden/cg-66.opcn +0 -4
  422. package/tests/fixtures/golden/cg-77.input.ts +0 -109
  423. package/tests/fixtures/golden/cg-77.opcn +0 -4
  424. package/tests/fixtures/golden/foreign.input.ts +0 -202
  425. package/tests/fixtures/golden/foreign.opcn +0 -27
  426. package/tests/fixtures/golden/hebrew-edge.input.ts +0 -90
  427. package/tests/fixtures/golden/hebrew-edge.opcn +0 -8
  428. package/tests/fixtures/golden/kibbutz.input.ts +0 -31
  429. package/tests/fixtures/golden/kibbutz.opcn +0 -2
  430. package/tests/fixtures/golden/main-full.input.ts +0 -780
  431. package/tests/fixtures/golden/main-full.opcn +0 -101
  432. package/tests/fixtures/golden/minimal.input.ts +0 -37
  433. package/tests/fixtures/golden/minimal.opcn +0 -3
  434. package/tests/fixtures/golden/related-and-rd.input.ts +0 -59
  435. package/tests/fixtures/golden/related-and-rd.opcn +0 -11
  436. package/tests/fixtures/random.ts +0 -843
  437. package/tests/golden/fixtures.test.ts +0 -627
  438. package/tests/golden/golden.test.ts +0 -95
  439. package/tests/helpers/coverage.ts +0 -18
  440. package/tests/helpers/sample-values.ts +0 -114
  441. package/tests/layout/codegen-sync.test.ts +0 -19
  442. package/tests/layout/integrity.test.ts +0 -232
  443. package/tests/layout/registry.test.ts +0 -98
  444. package/tests/model/code-unions.test.ts +0 -91
  445. package/tests/model/schema.test.ts +0 -1031
  446. package/tests/normalize/canonical.test.ts +0 -728
  447. package/tests/normalize/capital-gains.test.ts +0 -1850
  448. package/tests/normalize/coverage.test.ts +0 -88
  449. package/tests/normalize/denormalize.test.ts +0 -318
  450. package/tests/normalize/enums.test.ts +0 -118
  451. package/tests/normalize/foreign.test.ts +0 -273
  452. package/tests/normalize/main.test.ts +0 -839
  453. package/tests/normalize/paths.test.ts +0 -257
  454. package/tests/normalize/rd-investments.test.ts +0 -99
  455. package/tests/normalize/related-companies.test.ts +0 -106
  456. package/tests/normalize/shareholders.test.ts +0 -117
  457. package/tests/normalize/text.test.ts +0 -86
  458. package/tests/pipeline.test.ts +0 -96
  459. package/tests/roundtrip/determinism.test.ts +0 -207
  460. package/tests/roundtrip/property.test.ts +0 -126
  461. package/tests/roundtrip/roundtrip.test.ts +0 -573
  462. package/tests/rules/cases.ts +0 -873
  463. package/tests/rules/rules.test.ts +0 -69
  464. package/tests/rules/spec-sync.test.ts +0 -80
  465. package/tests/scripts/csv.test.ts +0 -78
  466. package/tests/scripts/values.test.ts +0 -80
  467. package/tests/validate/capital-gains-rules.test.ts +0 -307
  468. package/tests/validate/check-digit.test.ts +0 -42
  469. package/tests/validate/field-rules.test.ts +0 -867
  470. package/tests/validate/foreign-rules.test.ts +0 -255
  471. package/tests/validate/issue.test.ts +0 -96
  472. package/tests/validate/main-rules.test.ts +0 -761
  473. package/tests/validate/parse-rules.test.ts +0 -293
  474. package/tests/validate/shareholder-rules.test.ts +0 -143
  475. package/tsconfig.json +0 -10
  476. package/tsconfig.typecheck.json +0 -9
  477. package/vitest.config.ts +0 -11
package/README.md CHANGED
@@ -1,337 +1,3 @@
1
- # @accounter/opcn1214-generator
1
+ # Temporary Holding Version
2
2
 
3
- Generator, validator and parser for SHAAM's **form 1214** (Israeli corporate annual return) OPCN
4
- file: the fixed-width file that representatives upload through OPCN or the identified-representative
5
- internet service.
6
-
7
- - **Validate** a typed report and get every error and warning at once, each with a stable rule ID
8
- and an input path.
9
- - **Generate** the windows-1255 file for one report, or an OPCN batch of up to 50 reports.
10
- - **Parse** a file (single report or batch) back into the typed input, and SHAAM's response file
11
- `shumot.shg` into one record per report.
12
- - Tax years **2024** and **2025** (2025 uses the 2024 layout until SHAAM publishes its 2025
13
- specification).
14
-
15
- The full developer specification is [`documentation/SPEC.md`](documentation/SPEC.md).
16
-
17
- ## Installation
18
-
19
- ```bash
20
- yarn add @accounter/opcn1214-generator
21
- ```
22
-
23
- ## Quick start
24
-
25
- Validate, then generate, then save `bytes` (windows-1255) as the file to upload. Do not write
26
- `text`: it is a JS string and would be saved in another encoding.
27
-
28
- <!-- test -->
29
-
30
- ```ts
31
- import { writeFileSync } from 'node:fs'
32
- import { tmpdir } from 'node:os'
33
- import { join } from 'node:path'
34
- import { generate1214, validate1214, type Report1214Input } from '@accounter/opcn1214-generator'
35
-
36
- const input: Report1214Input = {
37
- taxYear: 2024,
38
- company: {
39
- fileNumber: '514000009',
40
- registeredName: 'חברה לדוגמה בע"מ',
41
- mailingAddress: 'רחוב הרצל 1, תל אביב',
42
- businessAddress: 'רחוב הרצל 1, תל אביב',
43
- phone: { prefix: '03', number: '1234567' }
44
- },
45
- declarations: {
46
- hasTaxPlanningAction: false,
47
- hadRelatedPartyTransactions: false,
48
- controlsBodyOfPersons: false,
49
- holdsRightsInBodyOfPersons: false,
50
- appliesAccountingStandards: false,
51
- directorsReceivedOpinion: false,
52
- tookReportablePosition: false
53
- },
54
- // record 1000 code-amount pairs, keyed by code (the required codes of the layout)
55
- amounts: { '018': 4, '072': 0, '081': 1000, '094': 0, '263': 1 },
56
- shareholders: [
57
- {
58
- idNumber: '123456782',
59
- fullName: 'ישראל ישראלי',
60
- isControllingShareholder: true,
61
- dividendRightsPercent: 100
62
- }
63
- ]
64
- }
65
-
66
- const validation = validate1214(input) // never throws; every error and warning at once
67
- if (validation.valid) {
68
- const { bytes, fileName, warnings, summary } = generate1214(input)
69
- writeFileSync(join(tmpdir(), fileName), bytes) // e.g. 1214_514000009_2024.txt
70
- console.log(`${fileName}: ${summary.mainCodePairs} of 61 code pairs, ${warnings.length} warnings`)
71
- } else {
72
- for (const issue of validation.errors) {
73
- console.error(`${issue.ruleId} at ${issue.path}: ${issue.message}`)
74
- }
75
- }
76
- ```
77
-
78
- Without `meta.saveDate` the save date is today in Asia/Jerusalem; pass
79
- `{ today: () => '2025-03-31' }` as the second argument for reproducible output.
80
-
81
- ## Error handling
82
-
83
- Data problems are values: `validate1214` and `ParseResult.issues` return them and never throw. Every
84
- `Issue` has a stable `ruleId` and `path` (key UIs on those, not on `message`), a `severity`, and,
85
- where it applies, the record, field position and Hebrew field name. The recommended pattern (SPEC
86
- §11.4) validates first, so generation cannot throw a validation error:
87
-
88
- <!-- test -->
89
-
90
- ```ts
91
- import {
92
- generate1214,
93
- Opcn1214Error,
94
- parse1214,
95
- validate1214,
96
- type Report1214Input
97
- } from '@accounter/opcn1214-generator'
98
-
99
- function prepareUpload(input: unknown) {
100
- const result = validate1214(input)
101
- // show every error and warning in the UI at once
102
- if (!result.valid) return { errors: result.errors, warnings: result.warnings }
103
- // valid input: generate1214 cannot throw a validation error now
104
- const { bytes, fileName, warnings } = generate1214(input as Report1214Input)
105
- return { bytes, fileName, warnings }
106
- }
107
-
108
- const outcome = prepareUpload({ taxYear: 2024, company: { fileNumber: '514000009' } })
109
- if ('errors' in outcome) {
110
- for (const issue of outcome.errors) console.log(issue.ruleId, issue.path, issue.message)
111
- }
112
-
113
- // generate1214 / generate1214Batch throw Opcn1214ValidationError, parse1214 / parse1214Batch throw
114
- // Opcn1214ParseError; both extend Opcn1214Error and carry every issue found.
115
- try {
116
- parse1214('not an OPCN file\r\n')
117
- } catch (error) {
118
- if (!(error instanceof Opcn1214Error)) throw error // TypeError or Opcn1214InternalError: a bug
119
- console.log(
120
- error.name,
121
- error.issues.map(issue => `${issue.ruleId} (line ${issue.line})`)
122
- )
123
- }
124
- ```
125
-
126
- `getLayout` throws `Opcn1214UnsupportedYearError` for a year outside `supportedTaxYears()`.
127
- `Opcn1214InternalError` means a bug in this package.
128
-
129
- ## Parsing and batches
130
-
131
- `parse1214` reads a single-report file (bytes are decoded as windows-1255 by default) into the
132
- canonical `Report1214Input` and validates it: business-rule issues come back in `issues`, while
133
- structural problems throw `Opcn1214ParseError`. An OPCN batch holds up to 50 reports:
134
- `generate1214Batch` writes one file (issues carry `reportIndex`) and `parse1214Batch` reads one
135
- `ParseResult` per report.
136
-
137
- <!-- test -->
138
-
139
- ```ts
140
- import {
141
- generate1214,
142
- generate1214Batch,
143
- parse1214,
144
- parse1214Batch,
145
- type Report1214Input
146
- } from '@accounter/opcn1214-generator'
147
-
148
- const input: Report1214Input = {
149
- taxYear: 2024,
150
- company: {
151
- fileNumber: '514000009',
152
- registeredName: 'חברה לדוגמה בע"מ',
153
- mailingAddress: 'רחוב הרצל 1, תל אביב',
154
- businessAddress: 'רחוב הרצל 1, תל אביב',
155
- phone: { prefix: '03', number: '1234567' }
156
- },
157
- declarations: {
158
- hasTaxPlanningAction: false,
159
- hadRelatedPartyTransactions: false,
160
- controlsBodyOfPersons: false,
161
- holdsRightsInBodyOfPersons: false,
162
- appliesAccountingStandards: false,
163
- directorsReceivedOpinion: false,
164
- tookReportablePosition: false
165
- },
166
- amounts: { '018': 4, '072': 0, '081': 1000, '094': 0, '263': 1 },
167
- shareholders: [
168
- {
169
- idNumber: '123456782',
170
- fullName: 'ישראל ישראלי',
171
- isControllingShareholder: true,
172
- dividendRightsPercent: 100
173
- }
174
- ]
175
- }
176
-
177
- // Single report: parse(generate(x)) gives x back in canonical form.
178
- const { report, issues, saveDate } = parse1214(generate1214(input).bytes)
179
- console.log(report.company.fileNumber, saveDate, issues.length)
180
-
181
- // Batch: one file, up to 50 reports.
182
- const second: Report1214Input = { ...input, company: { ...input.company, fileNumber: '514010016' } }
183
- const batch = generate1214Batch([input, second])
184
- console.log(batch.fileName, batch.summary.reports) // 1214_batch_2.txt 2
185
- for (const parsed of parse1214Batch(batch.bytes)) console.log(parsed.report.company.fileNumber)
186
- ```
187
-
188
- ## Response file
189
-
190
- After transmission SHAAM returns `shumot.shg`, one line per report. `parseResponseFile` reads it
191
- (string or windows-1255 bytes) into one `ResponseRecord` per line; only code `00` is `accepted`.
192
-
193
- <!-- test -->
194
-
195
- ```ts
196
- import { parseResponseFile } from '@accounter/opcn1214-generator'
197
-
198
- const responses = parseResponseFile('514000009202400\r\n514010016202405\r\n')
199
- for (const { fileNumber, taxYear, code, meaning, accepted, detail } of responses) {
200
- console.log(fileNumber, taxYear, accepted ? 'accepted' : `${code}: ${meaning}`, detail ?? '')
201
- }
202
- // 514000009 2024 accepted
203
- // 514010016 2024 05: Report already filed
204
- ```
205
-
206
- ## Rules
207
-
208
- Every check has a stable ID. `RULES` exports the catalogue as data; SPEC §10 holds the same list
209
- with the conditions in full. **E** = error (blocks generation), **W** = warning. Source: **spec** =
210
- stated in SHAAM's PDF, **derived** = consistency check added by this package, **checker** = enforced
211
- by SHAAM's structure checker (shopcn) but not stated in the PDF.
212
-
213
- <!-- rules:start -->
214
-
215
- | Rule ID | Sev | Source | Scope | Description |
216
- | ---------------------------------------------------- | --- | ------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
217
- | `struct.taxYear.unsupported` | E | derived | input | taxYear is not one of supportedTaxYears(). |
218
- | `input.shape` | E | derived | input | Wrong JavaScript type, missing required property, unknown property, null, or array too long. |
219
- | `input.unknownCode` | E | spec | input | A code-map key (amounts, foreignAppendix.amounts, capitalGains[i].amounts) that is not a code of that record for the tax year, or a foreignAppendix.countryBreakdown key that is not a per-country code of record 2000. |
220
- | `input.derivedCode` | E | derived | input | A derived code (008, 028, 273, 277, 278, 280, 297; 3077: 501–505) passed in a code map; the message names the input property that controls it. |
221
- | `struct.relatedCompanies.max` | E | spec | 1010 | More than 3 related companies. |
222
- | `struct.shareholders.min` | E | spec | 1020 | No shareholders while declarations.isKibbutz is not true. |
223
- | `struct.shareholders.max` | E | spec | 1020 | More than 99 shareholders. |
224
- | `struct.rdInvestments.max` | E | spec | 1030 | More than 5 R&D investments. |
225
- | `struct.capitalGains.max` | E | spec | report | More than 14 capital-gains appendices (records 30xx); report the excess on 1000@962 with reasons 964–967 instead. |
226
- | `struct.mainCodePairs.max` | E | spec | 1000 | More than 61 code-amount pairs in record 1000 (after derivations). |
227
- | `struct.batch.size` | E | spec | input | A batch (generate1214Batch) with no reports or more than 50 reports. |
228
- | `field.required` | E | spec | report | A field or code with required=yes is absent (for codes that are not zeroAllowed, 0 counts as absent); inside a repeated slot only when the slot is in use. |
229
- | `field.numeric` | E | spec | report | A digit-string field (id9, shareholderId, digits) contains non-digits. |
230
- | `field.length` | E | spec | report | Normalized text longer than the field width, or a number with more digits than the width. |
231
- | `field.checkDigit` | E | checker | report | An identifier (id9, shareholderId) of 1–9 digits fails the Israeli check digit (left-padded to 9 digits, weights 1, 2, 1, 2, …); SHAAM rejects the file. |
232
- | `field.integer` | E | spec | report | An amount, amountX or num value is not an integer (with rounding 'halfUp', amounts are rounded instead). |
233
- | `field.decimals` | E | spec | report | An amountX100, percentX100, percentLiteral or rateX100 value has more than 2 decimals. |
234
- | `field.negative` | E | spec | report | A number is negative (losses have their own codes). |
235
- | `field.enum` | E | spec | report | An enum or rateX100 value is not one of the values of its field or code (the values of other kinds are documentation). |
236
- | `field.date` | E | spec | report | A date is not a real calendar date in ISO YYYY-MM-DD form. |
237
- | `field.percentRange` | E | spec | report | A percentage (percentX100, percentLiteral) is outside 1–100. |
238
- | `field.hebrewFirstLetter` | E | spec | report | A hebrewText value does not start with a Hebrew letter (U+05D0–U+05EA). |
239
- | `field.charset` | E | derived | report | A text value (after SPEC §4.3 normalization) contains a control character or a character not representable in windows-1255. |
240
- | `field.phonePrefix` | W | spec | report | A phone or fax prefix is not in the allowed list: it is dropped (SHAAM deletes it); for the required 1000@493 the follow-up field.required is the error. |
241
- | `field.phoneNumber` | E | derived | report | A phone or fax number is not exactly 7 digits (shorter numbers would be silently zero-padded). |
242
- | `main.withholdingFile.companyNumber` | E | checker | 1000 | The withholding file number (1000@225) does not start with 9 and the first 7 digits of the company file number (1000@137, left-padded to 9 digits); its 9th digit is the check digit (field.checkDigit). SHAAM rejects the file. |
243
- | `main.familyCompany.fileNumber` | E | spec | 1000 | A family company (836 marked) without the taxpayer file number (837). |
244
- | `main.familyCompany.code080` | E | spec | 1000 | A family company (836 marked) without code 080 (0 allowed). |
245
- | `main.houseCompany.code084` | E | spec | 1000 | A house company (846 marked) without code 084 (0 allowed). |
246
- | `main.investmentLaw.flag` | E | spec | 1000 | Code 101 or 102 filled but 849 (capital investment law benefits) not marked. |
247
- | `main.beneficiaryEnterprise.noticeDate` | E | spec | 1000 | 851 (beneficiary enterprise) marked without the notice date (852); guaranteed by the input type, checked for JS callers and parsed files. |
248
- | `main.beneficiaryEnterprise.noticeDateBeforeTaxYear` | E | checker | 1000 | The beneficiary-enterprise notice date (852) is before the start of the tax year: 1 January of taxYear, or the start of a special year ending on the balance-sheet date (864) when that is earlier. SHAAM rejects the file. |
249
- | `main.specialYear.balanceSheetDate` | E | spec | 1000 | 863 (special year) marked without the balance sheet date (864); guaranteed by the input type, checked for JS callers and parsed files. |
250
- | `main.kibbutz.code226` | E | spec | 1000 | isKibbutz (877 marked) but code 226 not filled (SPEC §15 A-13). |
251
- | `main.kibbutz.code226Other` | W | derived | 1000 | Code 226 = 9 ("other cooperative, not kibbutz") while isKibbutz (877 marked). |
252
- | `main.buildingIncome.code259` | E | spec | 1000 | hasBuildingIncome (884 = yes) without code 259. |
253
- | `main.cgReasons.otherText` | E | spec | 1000 | Capital-gains reason "other" (967) marked without its text (968). |
254
- | `main.reportablePositions.required` | E | spec | 1000 | tookReportablePosition (1030 = yes) and no reportable position numbers (1034–1046). |
255
- | `main.reportablePositions.max` | E | spec | 1000 | More than 5 reportable positions (only five fields exist, 1034–1046). |
256
- | `main.reportablePositions.unexpected` | W | derived | 1000 | Reportable positions (1034–1046) given while tookReportablePosition (1030) is no. |
257
- | `main.rd.records` | E | spec | 1000 | Code 165 > 0 but no R&D investment (1030) records. |
258
- | `main.rd.total` | W | derived | 1000 | The R&D investment amounts (1030) do not add up to code 165, compared in whole shekels. |
259
- | `main.capitalGains.flag` | E | derived | 1000 | declarations.hasCapitalGainsAppendix is false while capital-gains appendices exist (833 is derived from them as yes). |
260
- | `main.cgUntransmitted.reason` | W | derived | 1000 | capitalGainsSummary.untransmittedCount (962) > 0 and none of the reasons 964–967 marked. |
261
- | `main.cgUntransmitted.reasonWithoutCount` | W | derived | 1000 | A reason 964–967 marked while capitalGainsSummary.untransmittedCount (962) is 0 or absent. |
262
- | `main.appendixTotal.min` | W | derived | 1000 | capitalGainsSummary.totalAppendicesCount (960) is given (> 0) and lower than the transmitted appendices (2000 and 30xx records) plus capitalGainsSummary.untransmittedCount (962). |
263
- | `main.bankAccount.withNoBank` | W | derived | 1000 | noBankAccount (1064) marked while a bank account (codes 277/278/280) is given. |
264
- | `main.bankAccount.format` | E | spec | 1000 | bankAccount.bank is not exactly 2 digits, branch not exactly 3 digits, or account not 1–9 digits. |
265
- | `main.qualifyingCompany.purchaseAmounts` | W | derived | 1000 | qualifyingCompany.purchased (1065 = yes) but neither purchase amount (1066, 1078) given. |
266
- | `main.qualifyingCompany.amortizationAmount` | W | derived | 1000 | qualifyingCompany.amortizationClaimed (1090 = yes) but no amortization amount (1091; 0 counts as given). |
267
- | `main.attachments.code070` | W | derived | 1000 | attachments.donationReceiptsCount (954) > 0 but code 070 absent. |
268
- | `main.attachments.code010` | W | derived | 1000 | attachments.withholdingCertificatesCount (957) > 0 but code 010 absent. |
269
- | `shareholders.dividendRights.total` | E | spec | 1020 | At least one shareholder states dividendRightsPercent and the total is not 100.00 (computed in hundredths; SPEC §15 A-15). |
270
- | `shareholders.duplicateId` | W | derived | 1020 | The same shareholder idNumber twice (999999964 and 999999998 excluded). |
271
- | `foreign.otherIncome.description` | E | spec | 2000 | otherTaxableIncome (2000@187) > 0 without otherTaxableIncomeDescription (2000@137). |
272
- | `foreign.refund.amount` | W | derived | 2000 | taxRefundDeclaration (2000@247) is yes without a taxRefundDeclarationAmount (2000@248) > 0; 0 is written as absent. |
273
- | `foreign.breakdown.required` | E | spec | 2000 | A per-country code written in the 2000 section (442 = 0 included) without a countryBreakdown entry (record 2200). |
274
- | `foreign.breakdown.orphan` | E | spec | 2200 | A countryBreakdown entry for a code not written in the 2000 section. |
275
- | `foreign.breakdown.countries.min` | E | derived | 2200 | A country breakdown with no countries. |
276
- | `foreign.breakdown.countries.max` | E | spec | 2200 | More than 10 countries in one country breakdown. |
277
- | `foreign.breakdown.country.unknown` | E | spec | 2200 | A country code that is not in the country table of the tax year (countries.csv). |
278
- | `foreign.breakdown.country.unknownOnlyFor439` | E | spec | 2200 | The country code -88 (country unknown) in the breakdown of a code other than 439. |
279
- | `foreign.breakdown.country.duplicate` | W | derived | 2200 | The same country twice within one country breakdown. |
280
- | `cg.improvements.max` | E | spec | 3077 | More than 5 improvements in a 3077 appendix (only five slots exist, 247–416); report the excess via 962 with reason 965 instead. |
281
- | `cg.improvements.code50Amount` | W | derived | 3077 | An improvement without code50Amount (code 501–505), or a code50Amount with neither expense nor accumulated depreciation. |
282
- | `cg.improvements.expense` | E | checker | 3077 | An improvement of a 3077 appendix without an expense greater than 0, or with an accumulated depreciation above its expense. SHAAM counts only improvements with an expense against the improvement count (245) and rejects the file. |
283
- | `cg.virtualCurrency.wallet` | E | spec | 3077 | A 3077 appendix with code 071 = 1 (virtual currency) and no wallet address. |
284
- | `cg.codePairs.max` | E | checker | report | More than 20 code-amount pairs written in one capital-gains appendix (30xx record; omitted zero codes do not count); only 3060 and 3065 have more than 20 codes. SHAAM rejects the file. |
285
- | `parse.empty` | E | derived | parse | The file has no records. |
286
- | `parse.encoding` | E | derived | parse | Bytes that do not decode in the selected encoding (windows-1255, or UTF-8 when options.encoding says so). |
287
- | `parse.lineLength` | E | spec | parse | A line whose length is not the record length of its record type. |
288
- | `parse.formType` | E | spec | parse | Positions 1–4 of a line are not 1214. |
289
- | `parse.recordType` | E | spec | parse | Positions 5–8 of a line are not a record type of the layout. |
290
- | `parse.prefixFiller` | E | spec | parse | Positions 9–136 of a line are not all 0. |
291
- | `parse.order` | E | spec | parse | A record out of the SPEC §3.3 order (the file must start with 1000; a 2200 record must follow a 2000 record), or a second 1000 before a 9999. |
292
- | `parse.occurrences` | E | spec | parse | More records of a type than SPEC §3.2 allows (1010 > 3, 1020 > 99, 1030 > 5, 2000 > 1, 2200 > 30, capital-gains records 30xx > 14 together), or more than 50 reports in a batch file; minimums are business rules. |
293
- | `parse.control.missing` | E | spec | parse | The report is not terminated by a 9999 control record. |
294
- | `parse.control.counts` | E | spec | parse | A count of the 9999 control record differs from the records present. |
295
- | `parse.multipleReports` | E | derived | parse | parse1214 was given a file with more than one report (a 1000 record after a 9999 record); use parse1214Batch. |
296
- | `parse.numeric` | E | spec | parse | A non-digit in a numeric field or code value. |
297
- | `parse.date` | E | spec | parse | A date field that is not a valid DD/MM/YYYY date or all spaces. |
298
- | `parse.codeSection` | E | spec | parse | A code-amount section with an unknown code, a duplicate code, a truncated entry, or non-zero data after the last entry. |
299
- | `parse.fieldValue` | E | spec | parse | A header field that is well-formed for its type but not a value the field can hold: flag or yes/no digits other than the ones written, a phone prefix outside the allowed list, a 2200 code (2200@137) that is not a per-country code of record 2000 or that an earlier 2200 record already has. |
300
- | `parse.countrySection` | E | spec | parse | A country-amount section (record 2200) with an affiliation other than 1, a malformed country code, a truncated entry, more than 10 entries, or non-zero data after the last entry. |
301
- | `parse.derivedMismatch` | E | derived | parse | A derived value (SPEC §7.4) that disagrees with the value derived again from its source in the file: 832 vs a 2000 record, 833 = no with capital-gains records or untransmitted appendices, codes 008/028/273/277/278/280/297, 1010/1020 serial numbers, 1030 affiliation, 30xx transaction symbol, appendix and "מספר בתל"ם" sequence numbers, 3077@245 improvement count. |
302
-
303
- <!-- rules:end -->
304
-
305
- ## Versioning
306
-
307
- The package follows semver with this contract (SPEC §6.5):
308
-
309
- | Change | Version bump |
310
- | -------------------------------------------------------------- | ------------ |
311
- | Output bytes change for an input that was already valid | **major** |
312
- | A rule ID or issue `path` format changes or is removed | **major** |
313
- | A new **error** rule | **major** |
314
- | A new **warning** rule (may become an error in the next major) | minor |
315
- | A new supported tax year / layout | minor |
316
- | Message wording | patch |
317
-
318
- Golden files (byte-level fixtures) enforce the first row.
319
-
320
- ## Verification status
321
-
322
- Golden files are checked with SHAAM's structure checker (shopcn) before release; the status of each
323
- one is recorded in [`tests/fixtures/golden/VERIFICATION.md`](tests/fixtures/golden/VERIFICATION.md).
324
-
325
- ## Contents
326
-
327
- | Path | What it is |
328
- | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- |
329
- | [`documentation/SPEC.md`](documentation/SPEC.md) | Developer specification: format, API, input model, rules, tests |
330
- | [`documentation/layout/2024/`](documentation/layout/2024/) | Every record field and code of the 2024 layout as CSV (source of truth) |
331
- | [`documentation/layout/README.md`](documentation/layout/README.md) | CSV column reference and provenance |
332
- | [`documentation/specifications/1214-2024.pdf`](documentation/specifications/1214-2024.pdf) | SHAAM's normative specification (Hebrew, 71 pages) |
333
- | [`documentation/tools/extract_layout.py`](documentation/tools/extract_layout.py) | PDF → layout extractor and CSV diff, for yearly spec updates |
334
-
335
- ## License
336
-
337
- MIT
3
+ This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
package/package.json CHANGED
@@ -1,77 +1,6 @@
1
1
  {
2
2
  "name": "@accounter/opcn1214-generator",
3
- "version": "0.0.0-bootstrap.0",
4
- "type": "module",
5
- "description": "Fully typed application that generates, parses, and validates OPCN 1214 tax reports.",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/Urigo/accounter-fullstack.git",
9
- "directory": "packages/opcn1214-generator"
10
- },
11
- "homepage": "https://github.com/Urigo/accounter-fullstack/packages/opcn1214-generator#readme",
12
- "bugs": {
13
- "url": "https://github.com/Urigo/accounter-fullstack/issues"
14
- },
15
- "author": "Gil Gardosh <gilgardosh@gmail.com>",
16
- "license": "MIT",
17
- "engines": {
18
- "node": "^20.0.0 || >= 22"
19
- },
20
- "main": "dist/cjs/index.js",
21
- "module": "dist/esm/index.js",
22
- "exports": {
23
- ".": {
24
- "require": {
25
- "types": "./dist/typings/index.d.cts",
26
- "default": "./dist/cjs/index.js"
27
- },
28
- "import": {
29
- "types": "./dist/typings/index.d.ts",
30
- "default": "./dist/esm/index.js"
31
- },
32
- "default": {
33
- "types": "./dist/typings/index.d.ts",
34
- "default": "./dist/esm/index.js"
35
- }
36
- },
37
- "./package.json": "./package.json"
38
- },
39
- "typings": "dist/typings/index.d.ts",
40
- "keywords": [
41
- "1214",
42
- "opcn",
43
- "shaam",
44
- "accountancy",
45
- "israeli-tax",
46
- "tax-forms",
47
- "accounter"
48
- ],
49
- "scripts": {
50
- "build": "yarn lint && bob build",
51
- "generate:layout": "tsx scripts/generate-layout.ts",
52
- "lint": "eslint './src/**/*.{js,ts,tsx}' --ignore-pattern '**/*.generated.ts' --quiet --fix",
53
- "render:rules": "tsx scripts/render-rules-table.ts",
54
- "test": "vitest",
55
- "test:watch": "vitest --watch",
56
- "typecheck": "tsc -p tsconfig.typecheck.json"
57
- },
58
- "dependencies": {
59
- "iconv-lite": "0.7.3",
60
- "zod": "4.6.7"
61
- },
62
- "devDependencies": {
63
- "bob-the-bundler": "7.0.1",
64
- "eslint": "10.15.0",
65
- "prettier": "3.10.1",
66
- "tsx": "4.23.15",
67
- "typescript": "6.0.3",
68
- "vitest": "5.1.0"
69
- },
70
- "publishConfig": {
71
- "registry": "https://registry.npmjs.org",
72
- "access": "public"
73
- },
74
- "typescript": {
75
- "definition": "dist/typings/index.d.ts"
76
- }
3
+ "version": "0.0.0-stage",
4
+ "stub": true,
5
+ "description": "Temporary package placeholder for staged publishing"
77
6
  }
@@ -1,44 +0,0 @@
1
- import type { RecordType } from '../layout/types.js';
2
- import type { Report1214Input } from '../model/input.js';
3
- import type { GenerateOptions } from '../model/options.js';
4
- import { type Issue } from '../validate/issue.js';
5
- /** The outcome of generate1214 (SPEC §6.2). */
6
- export interface GenerateResult {
7
- /** The file as a JS string (CRLF line endings). */
8
- text: string;
9
- /** windows-1255: the artifact to upload. */
10
- bytes: Uint8Array;
11
- /**
12
- * Suggestion: `1214_<fileNumber>_<taxYear>.txt`, with the 9-digit file number as written; for a
13
- * batch, `1214_batch_<n>.txt`.
14
- */
15
- fileName: string;
16
- /** Warnings of the report (of every report of a batch, each with its `reportIndex`). */
17
- warnings: Issue[];
18
- summary: {
19
- reports: number;
20
- /** Records per type, 9999 included (summed over the reports of a batch). */
21
- records: Partial<Record<RecordType, number>>;
22
- /** Code-amount pairs written in record 1000 (of 61); for a batch, the most of any report. */
23
- mainCodePairs: number;
24
- /** Zero values left out of the file (SPEC §4.5); `reportIndex` in a batch only. */
25
- omittedZeroCodes: Array<{
26
- record: RecordType;
27
- recordIndex: number;
28
- code: string;
29
- reportIndex?: number;
30
- }>;
31
- };
32
- }
33
- /**
34
- * Validates, then generates. Throws Opcn1214ValidationError carrying every error and warning
35
- * (errors first) if any error-severity issue exists.
36
- */
37
- export declare function generate1214(input: Report1214Input, options?: GenerateOptions): GenerateResult;
38
- /**
39
- * OPCN batch (SPEC §3.1, §8.1): validates each report independently, then writes the reports in
40
- * input order, each with its own 9999 record. Issues carry the 0-based `reportIndex` of their
41
- * report. Throws Opcn1214ValidationError carrying struct.batch.size for 0 or more than 50 reports,
42
- * or every error and warning of every report (errors first) if any report has an error.
43
- */
44
- export declare function generate1214Batch(inputs: readonly Report1214Input[], options?: GenerateOptions): GenerateResult;
@@ -1,115 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate1214 = generate1214;
4
- exports.generate1214Batch = generate1214Batch;
5
- /** generate1214 and generate1214Batch (SPEC §6.1, §8.1): validation, then the file. */
6
- const errors_js_1 = require("../errors.js");
7
- const assemble_js_1 = require("../file/assemble.js");
8
- const registry_js_1 = require("../layout/registry.js");
9
- const pipeline_js_1 = require("../pipeline.js");
10
- const issue_js_1 = require("../validate/issue.js");
11
- const validate_js_1 = require("./validate.js");
12
- const FILE_NUMBER_KEY = 'company.fileNumber';
13
- /** The file number exactly as `mainLine` (the encoded 1000 record) holds it. */
14
- function writtenFileNumber(report, mainLine) {
15
- const field = report.layout.records['1000'].fields.find(def => def.key === FILE_NUMBER_KEY);
16
- if (!field) {
17
- throw new errors_js_1.Opcn1214InternalError(`Record 1000 has no ${FILE_NUMBER_KEY} field`);
18
- }
19
- return mainLine.slice(field.position - 1, field.position - 1 + field.length);
20
- }
21
- function countRecords(report, records = {}) {
22
- for (const recordType of [...report.records.map(record => record.recordType), '9999']) {
23
- records[recordType] = (records[recordType] ?? 0) + 1;
24
- }
25
- return records;
26
- }
27
- /**
28
- * Renders a report that has no errors. Throws Opcn1214InternalError when it has no record 1000.
29
- */
30
- function generateValid(report) {
31
- const rendered = (0, assemble_js_1.renderReport)(report);
32
- const main = report.records.find(record => record.recordType === '1000');
33
- if (!main || rendered.lines[0] === undefined) {
34
- throw new errors_js_1.Opcn1214InternalError('A valid report has no record 1000');
35
- }
36
- return { report, rendered, mainCodePairs: main.codes.size };
37
- }
38
- /**
39
- * Validates, then generates. Throws Opcn1214ValidationError carrying every error and warning
40
- * (errors first) if any error-severity issue exists.
41
- */
42
- function generate1214(input, options) {
43
- const { report, issues } = (0, pipeline_js_1.runPipeline)(input, options);
44
- const { errors, warnings } = (0, validate_js_1.splitIssues)(issues);
45
- if (errors.length > 0 || !report) {
46
- throw new errors_js_1.Opcn1214ValidationError([...errors, ...warnings]);
47
- }
48
- const { rendered, mainCodePairs } = generateValid(report);
49
- return {
50
- text: rendered.text,
51
- bytes: rendered.bytes,
52
- fileName: `1214_${writtenFileNumber(report, rendered.lines[0] ?? '')}_${report.taxYear}.txt`,
53
- warnings,
54
- summary: {
55
- reports: 1,
56
- records: countRecords(report),
57
- mainCodePairs,
58
- omittedZeroCodes: report.omittedZeroCodes.map(entry => ({ ...entry })),
59
- },
60
- };
61
- }
62
- function concatBytes(parts) {
63
- const bytes = new Uint8Array(parts.reduce((total, part) => total + part.length, 0));
64
- let offset = 0;
65
- for (const part of parts) {
66
- bytes.set(part, offset);
67
- offset += part.length;
68
- }
69
- return bytes;
70
- }
71
- /**
72
- * OPCN batch (SPEC §3.1, §8.1): validates each report independently, then writes the reports in
73
- * input order, each with its own 9999 record. Issues carry the 0-based `reportIndex` of their
74
- * report. Throws Opcn1214ValidationError carrying struct.batch.size for 0 or more than 50 reports,
75
- * or every error and warning of every report (errors first) if any report has an error.
76
- */
77
- function generate1214Batch(inputs, options) {
78
- if (inputs.length === 0 || inputs.length > registry_js_1.REPORTS_PER_FILE) {
79
- throw new errors_js_1.Opcn1214ValidationError([
80
- (0, issue_js_1.makeIssue)('struct.batch.size', {
81
- message: `A batch holds 1 to ${registry_js_1.REPORTS_PER_FILE} reports, not ${inputs.length}.`,
82
- path: '',
83
- value: inputs.length,
84
- expected: `1 to ${registry_js_1.REPORTS_PER_FILE}`,
85
- specRef: { page: 1 },
86
- }),
87
- ]);
88
- }
89
- const validated = inputs.map((input, reportIndex) => {
90
- const { report, issues } = (0, pipeline_js_1.runPipeline)(input, options);
91
- return { report, issues: issues.map(issue => ({ ...issue, reportIndex })) };
92
- });
93
- const { errors, warnings } = (0, validate_js_1.splitIssues)(validated.flatMap(({ issues }) => issues).sort(issue_js_1.compareIssues));
94
- const reports = validated.map(({ report }) => report);
95
- if (errors.length > 0 || !reports.every(report => report !== undefined)) {
96
- throw new errors_js_1.Opcn1214ValidationError([...errors, ...warnings]);
97
- }
98
- const generated = reports.map(generateValid);
99
- const records = {};
100
- for (const { report } of generated) {
101
- countRecords(report, records);
102
- }
103
- return {
104
- text: generated.map(({ rendered }) => rendered.text).join(''),
105
- bytes: concatBytes(generated.map(({ rendered }) => rendered.bytes)),
106
- fileName: `1214_batch_${generated.length}.txt`,
107
- warnings,
108
- summary: {
109
- reports: generated.length,
110
- records,
111
- mainCodePairs: Math.max(...generated.map(({ mainCodePairs }) => mainCodePairs)),
112
- omittedZeroCodes: generated.flatMap(({ report }, reportIndex) => report.omittedZeroCodes.map(entry => ({ ...entry, reportIndex }))),
113
- },
114
- };
115
- }