@accounter/opcn1214-generator 0.0.0-bootstrap.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/.bob/cjs/api/generate.d.ts +44 -0
- package/.bob/cjs/api/generate.js +115 -0
- package/.bob/cjs/api/parse.d.ts +28 -0
- package/.bob/cjs/api/parse.js +38 -0
- package/.bob/cjs/api/response.d.ts +24 -0
- package/.bob/cjs/api/response.js +75 -0
- package/.bob/cjs/api/validate.d.ts +16 -0
- package/.bob/cjs/api/validate.js +15 -0
- package/.bob/cjs/codec/boolean.d.ts +7 -0
- package/.bob/cjs/codec/boolean.js +49 -0
- package/.bob/cjs/codec/date.d.ts +6 -0
- package/.bob/cjs/codec/date.js +68 -0
- package/.bob/cjs/codec/enum.d.ts +4 -0
- package/.bob/cjs/codec/enum.js +26 -0
- package/.bob/cjs/codec/numeric.d.ts +56 -0
- package/.bob/cjs/codec/numeric.js +186 -0
- package/.bob/cjs/codec/padding.d.ts +10 -0
- package/.bob/cjs/codec/padding.js +26 -0
- package/.bob/cjs/codec/percent.d.ts +6 -0
- package/.bob/cjs/codec/percent.js +33 -0
- package/.bob/cjs/codec/phone.d.ts +4 -0
- package/.bob/cjs/codec/phone.js +48 -0
- package/.bob/cjs/codec/record.d.ts +18 -0
- package/.bob/cjs/codec/record.js +176 -0
- package/.bob/cjs/codec/registry.d.ts +8 -0
- package/.bob/cjs/codec/registry.js +27 -0
- package/.bob/cjs/codec/sections.d.ts +41 -0
- package/.bob/cjs/codec/sections.js +177 -0
- package/.bob/cjs/codec/text.d.ts +5 -0
- package/.bob/cjs/codec/text.js +29 -0
- package/.bob/cjs/codec/types.d.ts +36 -0
- package/.bob/cjs/codec/types.js +16 -0
- package/.bob/cjs/codec/windows1255.d.ts +9 -0
- package/.bob/cjs/codec/windows1255.js +38 -0
- package/.bob/cjs/errors.d.ts +32 -0
- package/.bob/cjs/errors.js +103 -0
- package/.bob/cjs/file/assemble.d.ts +17 -0
- package/.bob/cjs/file/assemble.js +28 -0
- package/.bob/cjs/file/control.d.ts +13 -0
- package/.bob/cjs/file/control.js +45 -0
- package/.bob/cjs/file/parse.d.ts +18 -0
- package/.bob/cjs/file/parse.js +478 -0
- package/.bob/cjs/file/split.d.ts +17 -0
- package/.bob/cjs/file/split.js +71 -0
- package/.bob/cjs/index.d.ts +16 -0
- package/.bob/cjs/index.js +28 -0
- package/.bob/cjs/layout/2024/layout.generated.d.ts +6919 -0
- package/.bob/cjs/layout/2024/layout.generated.js +7224 -0
- package/.bob/cjs/layout/2025/index.d.ts +6 -0
- package/.bob/cjs/layout/2025/index.js +10 -0
- package/.bob/cjs/layout/capital-gains.d.ts +9 -0
- package/.bob/cjs/layout/capital-gains.js +15 -0
- package/.bob/cjs/layout/countries.d.ts +5 -0
- package/.bob/cjs/layout/countries.js +10 -0
- package/.bob/cjs/layout/freeze.d.ts +5 -0
- package/.bob/cjs/layout/freeze.js +16 -0
- package/.bob/cjs/layout/registry.d.ts +10 -0
- package/.bob/cjs/layout/registry.js +32 -0
- package/.bob/cjs/layout/types.d.ts +82 -0
- package/.bob/cjs/layout/types.js +35 -0
- package/.bob/cjs/model/codes.generated.d.ts +48 -0
- package/.bob/cjs/model/codes.generated.js +628 -0
- package/.bob/cjs/model/index.d.ts +3 -0
- package/.bob/cjs/model/index.js +5 -0
- package/.bob/cjs/model/input.d.ts +543 -0
- package/.bob/cjs/model/input.js +24 -0
- package/.bob/cjs/model/normalized.d.ts +43 -0
- package/.bob/cjs/model/normalized.js +0 -0
- package/.bob/cjs/model/options.d.ts +14 -0
- package/.bob/cjs/model/options.js +0 -0
- package/.bob/cjs/model/schema.d.ts +594 -0
- package/.bob/cjs/model/schema.js +339 -0
- package/.bob/cjs/normalize/canonical.d.ts +13 -0
- package/.bob/cjs/normalize/canonical.js +288 -0
- package/.bob/cjs/normalize/capital-gains/assets.d.ts +37 -0
- package/.bob/cjs/normalize/capital-gains/assets.js +94 -0
- package/.bob/cjs/normalize/capital-gains/index.d.ts +61 -0
- package/.bob/cjs/normalize/capital-gains/index.js +149 -0
- package/.bob/cjs/normalize/capital-gains/no-withholding.d.ts +18 -0
- package/.bob/cjs/normalize/capital-gains/no-withholding.js +36 -0
- package/.bob/cjs/normalize/capital-gains/other.d.ts +54 -0
- package/.bob/cjs/normalize/capital-gains/other.js +122 -0
- package/.bob/cjs/normalize/capital-gains/section6.d.ts +7 -0
- package/.bob/cjs/normalize/capital-gains/section6.js +13 -0
- package/.bob/cjs/normalize/capital-gains/securities.d.ts +26 -0
- package/.bob/cjs/normalize/capital-gains/securities.js +58 -0
- package/.bob/cjs/normalize/denormalize.d.ts +42 -0
- package/.bob/cjs/normalize/denormalize.js +359 -0
- package/.bob/cjs/normalize/derive.d.ts +57 -0
- package/.bob/cjs/normalize/derive.js +111 -0
- package/.bob/cjs/normalize/enums.d.ts +58 -0
- package/.bob/cjs/normalize/enums.js +69 -0
- package/.bob/cjs/normalize/fields.d.ts +28 -0
- package/.bob/cjs/normalize/fields.js +86 -0
- package/.bob/cjs/normalize/foreign.d.ts +22 -0
- package/.bob/cjs/normalize/foreign.js +85 -0
- package/.bob/cjs/normalize/main.d.ts +24 -0
- package/.bob/cjs/normalize/main.js +208 -0
- package/.bob/cjs/normalize/paths.d.ts +74 -0
- package/.bob/cjs/normalize/paths.js +169 -0
- package/.bob/cjs/normalize/phone.d.ts +12 -0
- package/.bob/cjs/normalize/phone.js +35 -0
- package/.bob/cjs/normalize/rd-investments.d.ts +10 -0
- package/.bob/cjs/normalize/rd-investments.js +25 -0
- package/.bob/cjs/normalize/related-companies.d.ts +10 -0
- package/.bob/cjs/normalize/related-companies.js +25 -0
- package/.bob/cjs/normalize/report.d.ts +9 -0
- package/.bob/cjs/normalize/report.js +53 -0
- package/.bob/cjs/normalize/shareholders.d.ts +10 -0
- package/.bob/cjs/normalize/shareholders.js +30 -0
- package/.bob/cjs/normalize/text.d.ts +11 -0
- package/.bob/cjs/normalize/text.js +41 -0
- package/.bob/cjs/normalize/today.d.ts +4 -0
- package/.bob/cjs/normalize/today.js +14 -0
- package/.bob/cjs/pipeline.d.ts +13 -0
- package/.bob/cjs/pipeline.js +37 -0
- package/.bob/cjs/response/codes.d.ts +2 -0
- package/.bob/cjs/response/codes.js +31 -0
- package/.bob/cjs/validate/capital-gains-rules.d.ts +6 -0
- package/.bob/cjs/validate/capital-gains-rules.js +162 -0
- package/.bob/cjs/validate/check-digit.d.ts +10 -0
- package/.bob/cjs/validate/check-digit.js +26 -0
- package/.bob/cjs/validate/engine.d.ts +5 -0
- package/.bob/cjs/validate/engine.js +35 -0
- package/.bob/cjs/validate/field-rules.d.ts +4 -0
- package/.bob/cjs/validate/field-rules.js +331 -0
- package/.bob/cjs/validate/foreign-rules.d.ts +6 -0
- package/.bob/cjs/validate/foreign-rules.js +171 -0
- package/.bob/cjs/validate/issue.d.ts +51 -0
- package/.bob/cjs/validate/issue.js +78 -0
- package/.bob/cjs/validate/main-rules.d.ts +24 -0
- package/.bob/cjs/validate/main-rules.js +425 -0
- package/.bob/cjs/validate/parse-rules.d.ts +31 -0
- package/.bob/cjs/validate/parse-rules.js +114 -0
- package/.bob/cjs/validate/rules.d.ts +746 -0
- package/.bob/cjs/validate/rules.js +680 -0
- package/.bob/cjs/validate/shape.d.ts +19 -0
- package/.bob/cjs/validate/shape.js +231 -0
- package/.bob/cjs/validate/shareholder-rules.d.ts +6 -0
- package/.bob/cjs/validate/shareholder-rules.js +83 -0
- package/.bob/cjs/validate/structure-rules.d.ts +26 -0
- package/.bob/cjs/validate/structure-rules.js +130 -0
- package/.bob/esm/api/generate.d.ts +44 -0
- package/.bob/esm/api/generate.js +111 -0
- package/.bob/esm/api/parse.d.ts +28 -0
- package/.bob/esm/api/parse.js +34 -0
- package/.bob/esm/api/response.d.ts +24 -0
- package/.bob/esm/api/response.js +72 -0
- package/.bob/esm/api/validate.d.ts +16 -0
- package/.bob/esm/api/validate.js +11 -0
- package/.bob/esm/codec/boolean.d.ts +7 -0
- package/.bob/esm/codec/boolean.js +46 -0
- package/.bob/esm/codec/date.d.ts +6 -0
- package/.bob/esm/codec/date.js +64 -0
- package/.bob/esm/codec/enum.d.ts +4 -0
- package/.bob/esm/codec/enum.js +23 -0
- package/.bob/esm/codec/numeric.d.ts +56 -0
- package/.bob/esm/codec/numeric.js +175 -0
- package/.bob/esm/codec/padding.d.ts +10 -0
- package/.bob/esm/codec/padding.js +21 -0
- package/.bob/esm/codec/percent.d.ts +6 -0
- package/.bob/esm/codec/percent.js +30 -0
- package/.bob/esm/codec/phone.d.ts +4 -0
- package/.bob/esm/codec/phone.js +45 -0
- package/.bob/esm/codec/record.d.ts +18 -0
- package/.bob/esm/codec/record.js +172 -0
- package/.bob/esm/codec/registry.d.ts +8 -0
- package/.bob/esm/codec/registry.js +23 -0
- package/.bob/esm/codec/sections.d.ts +41 -0
- package/.bob/esm/codec/sections.js +170 -0
- package/.bob/esm/codec/text.d.ts +5 -0
- package/.bob/esm/codec/text.js +26 -0
- package/.bob/esm/codec/types.d.ts +36 -0
- package/.bob/esm/codec/types.js +12 -0
- package/.bob/esm/codec/windows1255.d.ts +9 -0
- package/.bob/esm/codec/windows1255.js +32 -0
- package/.bob/esm/errors.d.ts +32 -0
- package/.bob/esm/errors.js +94 -0
- package/.bob/esm/file/assemble.d.ts +17 -0
- package/.bob/esm/file/assemble.js +25 -0
- package/.bob/esm/file/control.d.ts +13 -0
- package/.bob/esm/file/control.js +41 -0
- package/.bob/esm/file/parse.d.ts +18 -0
- package/.bob/esm/file/parse.js +474 -0
- package/.bob/esm/file/split.d.ts +17 -0
- package/.bob/esm/file/split.js +68 -0
- package/.bob/esm/index.d.ts +16 -0
- package/.bob/esm/index.js +11 -0
- package/.bob/esm/layout/2024/layout.generated.d.ts +6919 -0
- package/.bob/esm/layout/2024/layout.generated.js +7221 -0
- package/.bob/esm/layout/2025/index.d.ts +6 -0
- package/.bob/esm/layout/2025/index.js +7 -0
- package/.bob/esm/layout/capital-gains.d.ts +9 -0
- package/.bob/esm/layout/capital-gains.js +11 -0
- package/.bob/esm/layout/countries.d.ts +5 -0
- package/.bob/esm/layout/countries.js +7 -0
- package/.bob/esm/layout/freeze.d.ts +5 -0
- package/.bob/esm/layout/freeze.js +13 -0
- package/.bob/esm/layout/registry.d.ts +10 -0
- package/.bob/esm/layout/registry.js +27 -0
- package/.bob/esm/layout/types.d.ts +82 -0
- package/.bob/esm/layout/types.js +32 -0
- package/.bob/esm/model/codes.generated.d.ts +48 -0
- package/.bob/esm/model/codes.generated.js +625 -0
- package/.bob/esm/model/index.d.ts +3 -0
- package/.bob/esm/model/index.js +2 -0
- package/.bob/esm/model/input.d.ts +543 -0
- package/.bob/esm/model/input.js +21 -0
- package/.bob/esm/model/normalized.d.ts +43 -0
- package/.bob/esm/model/normalized.js +0 -0
- package/.bob/esm/model/options.d.ts +14 -0
- package/.bob/esm/model/options.js +0 -0
- package/.bob/esm/model/schema.d.ts +594 -0
- package/.bob/esm/model/schema.js +335 -0
- package/.bob/esm/normalize/canonical.d.ts +13 -0
- package/.bob/esm/normalize/canonical.js +285 -0
- package/.bob/esm/normalize/capital-gains/assets.d.ts +37 -0
- package/.bob/esm/normalize/capital-gains/assets.js +87 -0
- package/.bob/esm/normalize/capital-gains/index.d.ts +61 -0
- package/.bob/esm/normalize/capital-gains/index.js +142 -0
- package/.bob/esm/normalize/capital-gains/no-withholding.d.ts +18 -0
- package/.bob/esm/normalize/capital-gains/no-withholding.js +31 -0
- package/.bob/esm/normalize/capital-gains/other.d.ts +54 -0
- package/.bob/esm/normalize/capital-gains/other.js +112 -0
- package/.bob/esm/normalize/capital-gains/section6.d.ts +7 -0
- package/.bob/esm/normalize/capital-gains/section6.js +9 -0
- package/.bob/esm/normalize/capital-gains/securities.d.ts +26 -0
- package/.bob/esm/normalize/capital-gains/securities.js +52 -0
- package/.bob/esm/normalize/denormalize.d.ts +42 -0
- package/.bob/esm/normalize/denormalize.js +354 -0
- package/.bob/esm/normalize/derive.d.ts +57 -0
- package/.bob/esm/normalize/derive.js +99 -0
- package/.bob/esm/normalize/enums.d.ts +58 -0
- package/.bob/esm/normalize/enums.js +64 -0
- package/.bob/esm/normalize/fields.d.ts +28 -0
- package/.bob/esm/normalize/fields.js +81 -0
- package/.bob/esm/normalize/foreign.d.ts +22 -0
- package/.bob/esm/normalize/foreign.js +81 -0
- package/.bob/esm/normalize/main.d.ts +24 -0
- package/.bob/esm/normalize/main.js +204 -0
- package/.bob/esm/normalize/paths.d.ts +74 -0
- package/.bob/esm/normalize/paths.js +161 -0
- package/.bob/esm/normalize/phone.d.ts +12 -0
- package/.bob/esm/normalize/phone.js +32 -0
- package/.bob/esm/normalize/rd-investments.d.ts +10 -0
- package/.bob/esm/normalize/rd-investments.js +22 -0
- package/.bob/esm/normalize/related-companies.d.ts +10 -0
- package/.bob/esm/normalize/related-companies.js +22 -0
- package/.bob/esm/normalize/report.d.ts +9 -0
- package/.bob/esm/normalize/report.js +50 -0
- package/.bob/esm/normalize/shareholders.d.ts +10 -0
- package/.bob/esm/normalize/shareholders.js +27 -0
- package/.bob/esm/normalize/text.d.ts +11 -0
- package/.bob/esm/normalize/text.js +37 -0
- package/.bob/esm/normalize/today.d.ts +4 -0
- package/.bob/esm/normalize/today.js +11 -0
- package/.bob/esm/pipeline.d.ts +13 -0
- package/.bob/esm/pipeline.js +34 -0
- package/.bob/esm/response/codes.d.ts +2 -0
- package/.bob/esm/response/codes.js +28 -0
- package/.bob/esm/validate/capital-gains-rules.d.ts +6 -0
- package/.bob/esm/validate/capital-gains-rules.js +159 -0
- package/.bob/esm/validate/check-digit.d.ts +10 -0
- package/.bob/esm/validate/check-digit.js +23 -0
- package/.bob/esm/validate/engine.d.ts +5 -0
- package/.bob/esm/validate/engine.js +32 -0
- package/.bob/esm/validate/field-rules.d.ts +4 -0
- package/.bob/esm/validate/field-rules.js +328 -0
- package/.bob/esm/validate/foreign-rules.d.ts +6 -0
- package/.bob/esm/validate/foreign-rules.js +168 -0
- package/.bob/esm/validate/issue.d.ts +51 -0
- package/.bob/esm/validate/issue.js +72 -0
- package/.bob/esm/validate/main-rules.d.ts +24 -0
- package/.bob/esm/validate/main-rules.js +420 -0
- package/.bob/esm/validate/parse-rules.d.ts +31 -0
- package/.bob/esm/validate/parse-rules.js +110 -0
- package/.bob/esm/validate/rules.d.ts +746 -0
- package/.bob/esm/validate/rules.js +676 -0
- package/.bob/esm/validate/shape.d.ts +19 -0
- package/.bob/esm/validate/shape.js +227 -0
- package/.bob/esm/validate/shareholder-rules.d.ts +6 -0
- package/.bob/esm/validate/shareholder-rules.js +80 -0
- package/.bob/esm/validate/structure-rules.d.ts +26 -0
- package/.bob/esm/validate/structure-rules.js +122 -0
- package/.bob/tsconfig.tsbuildinfo +1 -0
- package/.gitattributes +1 -0
- package/CLAUDE.md +39 -0
- package/README.md +337 -0
- package/dist/cjs/index.js +28 -0
- package/dist/esm/index.js +11 -0
- package/documentation/IMPLEMENTATION_PLAN.md +2258 -0
- package/documentation/SPEC.md +1803 -0
- package/documentation/layout/2024/codes.csv +261 -0
- package/documentation/layout/2024/countries.csv +256 -0
- package/documentation/layout/2024/fields.csv +271 -0
- package/documentation/layout/2024/records.csv +18 -0
- package/documentation/layout/README.md +87 -0
- package/documentation/specifications/1214-2024.pdf +0 -0
- package/documentation/tools/extract_layout.py +191 -0
- package/package.json +77 -0
- package/scripts/generate-layout.ts +23 -0
- package/scripts/layout/csv.ts +111 -0
- package/scripts/layout/derived-codes.ts +12 -0
- package/scripts/layout/render.ts +364 -0
- package/scripts/layout/sources.ts +51 -0
- package/scripts/layout/values.ts +42 -0
- package/scripts/render-rules-table.ts +66 -0
- package/src/api/generate.ts +169 -0
- package/src/api/parse.ts +58 -0
- package/src/api/response.ts +110 -0
- package/src/api/validate.ts +26 -0
- package/src/codec/boolean.ts +62 -0
- package/src/codec/date.ts +75 -0
- package/src/codec/enum.ts +28 -0
- package/src/codec/numeric.ts +208 -0
- package/src/codec/padding.ts +33 -0
- package/src/codec/percent.ts +35 -0
- package/src/codec/phone.ts +54 -0
- package/src/codec/record.ts +206 -0
- package/src/codec/registry.ts +27 -0
- package/src/codec/sections.ts +208 -0
- package/src/codec/text.ts +31 -0
- package/src/codec/types.ts +47 -0
- package/src/codec/windows1255.ts +38 -0
- package/src/errors.ts +114 -0
- package/src/file/assemble.ts +42 -0
- package/src/file/control.ts +59 -0
- package/src/file/parse.ts +620 -0
- package/src/file/split.ts +86 -0
- package/src/index.ts +70 -0
- package/src/layout/2024/layout.generated.ts +7238 -0
- package/src/layout/2025/index.ts +9 -0
- package/src/layout/capital-gains.ts +20 -0
- package/src/layout/countries.ts +7 -0
- package/src/layout/freeze.ts +13 -0
- package/src/layout/registry.ts +33 -0
- package/src/layout/types.ts +134 -0
- package/src/model/codes.generated.ts +1190 -0
- package/src/model/index.ts +4 -0
- package/src/model/input.ts +594 -0
- package/src/model/normalized.ts +38 -0
- package/src/model/options.ts +17 -0
- package/src/model/schema.ts +381 -0
- package/src/normalize/canonical.ts +374 -0
- package/src/normalize/capital-gains/assets.ts +112 -0
- package/src/normalize/capital-gains/index.ts +212 -0
- package/src/normalize/capital-gains/no-withholding.ts +46 -0
- package/src/normalize/capital-gains/other.ts +153 -0
- package/src/normalize/capital-gains/section6.ts +14 -0
- package/src/normalize/capital-gains/securities.ts +73 -0
- package/src/normalize/denormalize.ts +426 -0
- package/src/normalize/derive.ts +136 -0
- package/src/normalize/enums.ts +87 -0
- package/src/normalize/fields.ts +110 -0
- package/src/normalize/foreign.ts +114 -0
- package/src/normalize/main.ts +284 -0
- package/src/normalize/paths.ts +184 -0
- package/src/normalize/phone.ts +45 -0
- package/src/normalize/rd-investments.ts +38 -0
- package/src/normalize/related-companies.ts +37 -0
- package/src/normalize/report.ts +59 -0
- package/src/normalize/shareholders.ts +42 -0
- package/src/normalize/text.ts +40 -0
- package/src/normalize/today.ts +15 -0
- package/src/pipeline.ts +42 -0
- package/src/response/codes.ts +30 -0
- package/src/validate/capital-gains-rules.ts +199 -0
- package/src/validate/check-digit.ts +25 -0
- package/src/validate/engine.ts +45 -0
- package/src/validate/field-rules.ts +383 -0
- package/src/validate/foreign-rules.ts +274 -0
- package/src/validate/issue.ts +121 -0
- package/src/validate/main-rules.ts +678 -0
- package/src/validate/parse-rules.ts +169 -0
- package/src/validate/rules.ts +747 -0
- package/src/validate/shape.ts +278 -0
- package/src/validate/shareholder-rules.ts +92 -0
- package/src/validate/structure-rules.ts +136 -0
- package/tests/api/batch.test.ts +227 -0
- package/tests/api/exports.test.ts +355 -0
- package/tests/api/generate.test.ts +409 -0
- package/tests/api/parse.test.ts +789 -0
- package/tests/api/response.test.ts +152 -0
- package/tests/api/validate.test.ts +86 -0
- package/tests/codec/numeric.test.ts +325 -0
- package/tests/codec/record.test.ts +318 -0
- package/tests/codec/registry.test.ts +17 -0
- package/tests/codec/sections.test.ts +333 -0
- package/tests/codec/text.test.ts +454 -0
- package/tests/codec/windows1255.test.ts +46 -0
- package/tests/docs/readme.test.ts +69 -0
- package/tests/edge-cases.test.ts +359 -0
- package/tests/errors.test.ts +138 -0
- package/tests/file/assemble.test.ts +188 -0
- package/tests/file/split.test.ts +61 -0
- package/tests/fixtures/builders.ts +512 -0
- package/tests/fixtures/files.ts +78 -0
- package/tests/fixtures/golden/README.md +37 -0
- package/tests/fixtures/golden/VERIFICATION.md +72 -0
- package/tests/fixtures/golden/batch-50.input.ts +92 -0
- package/tests/fixtures/golden/batch-50.opcn +150 -0
- package/tests/fixtures/golden/capital-gains-max.input.ts +177 -0
- package/tests/fixtures/golden/capital-gains-max.opcn +17 -0
- package/tests/fixtures/golden/cg-27.input.ts +63 -0
- package/tests/fixtures/golden/cg-27.opcn +4 -0
- package/tests/fixtures/golden/cg-50.input.ts +59 -0
- package/tests/fixtures/golden/cg-50.opcn +4 -0
- package/tests/fixtures/golden/cg-51.input.ts +60 -0
- package/tests/fixtures/golden/cg-51.opcn +4 -0
- package/tests/fixtures/golden/cg-54.input.ts +53 -0
- package/tests/fixtures/golden/cg-54.opcn +4 -0
- package/tests/fixtures/golden/cg-60.input.ts +77 -0
- package/tests/fixtures/golden/cg-60.opcn +4 -0
- package/tests/fixtures/golden/cg-63.input.ts +51 -0
- package/tests/fixtures/golden/cg-63.opcn +4 -0
- package/tests/fixtures/golden/cg-64.input.ts +62 -0
- package/tests/fixtures/golden/cg-64.opcn +4 -0
- package/tests/fixtures/golden/cg-65.input.ts +79 -0
- package/tests/fixtures/golden/cg-65.opcn +4 -0
- package/tests/fixtures/golden/cg-66.input.ts +53 -0
- package/tests/fixtures/golden/cg-66.opcn +4 -0
- package/tests/fixtures/golden/cg-77.input.ts +109 -0
- package/tests/fixtures/golden/cg-77.opcn +4 -0
- package/tests/fixtures/golden/foreign.input.ts +202 -0
- package/tests/fixtures/golden/foreign.opcn +27 -0
- package/tests/fixtures/golden/hebrew-edge.input.ts +90 -0
- package/tests/fixtures/golden/hebrew-edge.opcn +8 -0
- package/tests/fixtures/golden/kibbutz.input.ts +31 -0
- package/tests/fixtures/golden/kibbutz.opcn +2 -0
- package/tests/fixtures/golden/main-full.input.ts +780 -0
- package/tests/fixtures/golden/main-full.opcn +101 -0
- package/tests/fixtures/golden/minimal.input.ts +37 -0
- package/tests/fixtures/golden/minimal.opcn +3 -0
- package/tests/fixtures/golden/related-and-rd.input.ts +59 -0
- package/tests/fixtures/golden/related-and-rd.opcn +11 -0
- package/tests/fixtures/random.ts +843 -0
- package/tests/golden/fixtures.test.ts +627 -0
- package/tests/golden/golden.test.ts +95 -0
- package/tests/helpers/coverage.ts +18 -0
- package/tests/helpers/sample-values.ts +114 -0
- package/tests/layout/codegen-sync.test.ts +19 -0
- package/tests/layout/integrity.test.ts +232 -0
- package/tests/layout/registry.test.ts +98 -0
- package/tests/model/code-unions.test.ts +91 -0
- package/tests/model/schema.test.ts +1031 -0
- package/tests/normalize/canonical.test.ts +728 -0
- package/tests/normalize/capital-gains.test.ts +1850 -0
- package/tests/normalize/coverage.test.ts +88 -0
- package/tests/normalize/denormalize.test.ts +318 -0
- package/tests/normalize/enums.test.ts +118 -0
- package/tests/normalize/foreign.test.ts +273 -0
- package/tests/normalize/main.test.ts +839 -0
- package/tests/normalize/paths.test.ts +257 -0
- package/tests/normalize/rd-investments.test.ts +99 -0
- package/tests/normalize/related-companies.test.ts +106 -0
- package/tests/normalize/shareholders.test.ts +117 -0
- package/tests/normalize/text.test.ts +86 -0
- package/tests/pipeline.test.ts +96 -0
- package/tests/roundtrip/determinism.test.ts +207 -0
- package/tests/roundtrip/property.test.ts +126 -0
- package/tests/roundtrip/roundtrip.test.ts +573 -0
- package/tests/rules/cases.ts +873 -0
- package/tests/rules/rules.test.ts +69 -0
- package/tests/rules/spec-sync.test.ts +80 -0
- package/tests/scripts/csv.test.ts +78 -0
- package/tests/scripts/values.test.ts +80 -0
- package/tests/validate/capital-gains-rules.test.ts +307 -0
- package/tests/validate/check-digit.test.ts +42 -0
- package/tests/validate/field-rules.test.ts +867 -0
- package/tests/validate/foreign-rules.test.ts +255 -0
- package/tests/validate/issue.test.ts +96 -0
- package/tests/validate/main-rules.test.ts +761 -0
- package/tests/validate/parse-rules.test.ts +293 -0
- package/tests/validate/shareholder-rules.test.ts +143 -0
- package/tsconfig.json +10 -0
- package/tsconfig.typecheck.json +9 -0
- package/vitest.config.ts +11 -0
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public input model (SPEC §7). Conventions (SPEC §7.1): money in ILS, dates as ISO `YYYY-MM-DD`
|
|
3
|
+
* strings, identification numbers as digit strings, booleans for flags and yes/no fields, code maps
|
|
4
|
+
* keyed by the 3-digit code string.
|
|
5
|
+
*/
|
|
6
|
+
import type { CapitalGainsCode, CountryBreakdownCode, CountryCode, ForeignAppendixCode, MainFormInputCode } from './codes.generated.js';
|
|
7
|
+
/** An ISO calendar date, `YYYY-MM-DD` (SPEC §7.2). */
|
|
8
|
+
export type IsoDate = string;
|
|
9
|
+
/** Tax years with a layout (SPEC §7.2, §14). */
|
|
10
|
+
export type SupportedTaxYear = 2024 | 2025;
|
|
11
|
+
/** Allowed phone prefixes (SPEC §4.2, p.6–7). */
|
|
12
|
+
export declare const PHONE_PREFIXES: readonly ["02", "03", "04", "08", "09", "072", "073", "074", "076", "077", "050", "052", "053", "054", "055", "057", "058", "059"];
|
|
13
|
+
/** Allowed phone prefixes (SPEC §4.2, §7.2). */
|
|
14
|
+
export type PhonePrefix = (typeof PHONE_PREFIXES)[number];
|
|
15
|
+
/** A phone or fax number (SPEC §7.2). */
|
|
16
|
+
export interface Phone {
|
|
17
|
+
prefix: PhonePrefix;
|
|
18
|
+
/** Exactly 7 digits. */
|
|
19
|
+
number: string;
|
|
20
|
+
}
|
|
21
|
+
/** One OPCN 1214 report (SPEC §7.2). */
|
|
22
|
+
export interface Report1214Input {
|
|
23
|
+
/** 1000@146; selects the layout. */
|
|
24
|
+
taxYear: SupportedTaxYear;
|
|
25
|
+
meta?: {
|
|
26
|
+
/** 1000@150, ≤ 15 characters, default 'ACCOUNTER'. */
|
|
27
|
+
softwareName?: string;
|
|
28
|
+
/** 1000@165, default `options.today()` (SPEC §7.4). */
|
|
29
|
+
saveDate?: IsoDate;
|
|
30
|
+
};
|
|
31
|
+
company: CompanyDetails;
|
|
32
|
+
/** "המסייע/ת במילוי הדו"ח", 1000@563–831. */
|
|
33
|
+
preparer?: PreparerDetails;
|
|
34
|
+
declarations: Declarations;
|
|
35
|
+
/** "הכנסה חייבת אחרת בארץ ובחו"ל", 1000@887–953. */
|
|
36
|
+
otherTaxableIncome?: {
|
|
37
|
+
/** 887; must start with a Hebrew letter. */
|
|
38
|
+
source?: string;
|
|
39
|
+
/** 937. */
|
|
40
|
+
amount?: number;
|
|
41
|
+
/** 949: 1–100, ≤ 2 decimals (written × 100, SPEC §15 A-2). */
|
|
42
|
+
ratePercent?: number;
|
|
43
|
+
};
|
|
44
|
+
/** Numbers of certificates attached to the report, 1000@954–959. */
|
|
45
|
+
attachments?: {
|
|
46
|
+
/** 954: donation receipts for code 070 (section 46). */
|
|
47
|
+
donationReceiptsCount?: number;
|
|
48
|
+
/** 957: withholding certificates for code 010. */
|
|
49
|
+
withholdingCertificatesCount?: number;
|
|
50
|
+
};
|
|
51
|
+
/** Capital-gains appendices, transmitted and not, 1000@960–1017. */
|
|
52
|
+
capitalGainsSummary?: {
|
|
53
|
+
/** 960: all appendices, transmitted and not. */
|
|
54
|
+
totalAppendicesCount?: number;
|
|
55
|
+
/** 962 (→ 833 = yes when > 0, SPEC §7.4). */
|
|
56
|
+
untransmittedCount?: number;
|
|
57
|
+
/** 964–968: why appendices were not transmitted. */
|
|
58
|
+
reasons?: {
|
|
59
|
+
/** 964. */
|
|
60
|
+
lossOrNoGain?: boolean;
|
|
61
|
+
/** 965. */
|
|
62
|
+
overFiveImprovementBalances?: boolean;
|
|
63
|
+
/** 966. */
|
|
64
|
+
over14Appendices?: boolean;
|
|
65
|
+
/** 967. */
|
|
66
|
+
other?: boolean;
|
|
67
|
+
/** 968: required when `other`. */
|
|
68
|
+
otherText?: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/** "חברה מזכה" (part A of the form), 1000@1065–1102. */
|
|
72
|
+
qualifyingCompany?: {
|
|
73
|
+
/** 1065 (yes/no). */
|
|
74
|
+
purchased?: boolean;
|
|
75
|
+
/** 1066. */
|
|
76
|
+
israeliPurchaseAmount?: number;
|
|
77
|
+
/** 1078. */
|
|
78
|
+
foreignPurchaseAmount?: number;
|
|
79
|
+
/** 1090 (yes/no). */
|
|
80
|
+
amortizationClaimed?: boolean;
|
|
81
|
+
/** 1091: may be 0, which is written (SPEC §15 A-21). */
|
|
82
|
+
amortizationAmount?: number;
|
|
83
|
+
};
|
|
84
|
+
/** → codes 277/278/280 = 1 (SPEC §7.4); only when changing the account on file. */
|
|
85
|
+
bankAccount?: {
|
|
86
|
+
/** Exactly 2 digits. */
|
|
87
|
+
bank: string;
|
|
88
|
+
/** Exactly 3 digits. */
|
|
89
|
+
branch: string;
|
|
90
|
+
/** 1–9 digits. */
|
|
91
|
+
account: string;
|
|
92
|
+
};
|
|
93
|
+
/** Record 1000 code-amount section; derived codes (SPEC §7.4) are not accepted. */
|
|
94
|
+
amounts: Partial<Record<MainFormInputCode, number>>;
|
|
95
|
+
/** Records 1010: at most 3 (struct.relatedCompanies.max). */
|
|
96
|
+
relatedCompanies?: RelatedCompany[];
|
|
97
|
+
/** Records 1020: 1–99 (0 allowed only for a kibbutz). */
|
|
98
|
+
shareholders: Shareholder[];
|
|
99
|
+
/** Records 1030: at most 5 (struct.rdInvestments.max); their total is code 165. */
|
|
100
|
+
rdInvestments?: RdInvestment[];
|
|
101
|
+
/** Record 2000 (0–1); its presence derives 1000@832 and 9999@143 (SPEC §7.4). */
|
|
102
|
+
foreignAppendix?: ForeignAppendix;
|
|
103
|
+
/**
|
|
104
|
+
* Records 30xx: at most 14 in total (struct.capitalGains.max); they derive 1000@833, code 028 and
|
|
105
|
+
* 9999@145 (SPEC §7.4). Written grouped by record type, input order within a type (SPEC §3.3).
|
|
106
|
+
*/
|
|
107
|
+
capitalGains?: CapitalGainsAppendix[];
|
|
108
|
+
}
|
|
109
|
+
/** Company identity (SPEC §7.2), record 1000@137–512. */
|
|
110
|
+
export interface CompanyDetails {
|
|
111
|
+
/** 1000@137 "מספר תיק". */
|
|
112
|
+
fileNumber: string;
|
|
113
|
+
/** 1000@175, ≤ 50 (SHAAM replaces it with the registry name if different). */
|
|
114
|
+
registeredName: string;
|
|
115
|
+
/**
|
|
116
|
+
* 1000@225 "תיק ניכויים": 9, the first 7 digits of `fileNumber` and a check digit (SPEC §15
|
|
117
|
+
* A-28; 514000009 → 951400001).
|
|
118
|
+
*/
|
|
119
|
+
withholdingFileNumber?: string;
|
|
120
|
+
/** 1000@234. */
|
|
121
|
+
vatFileNumber?: string;
|
|
122
|
+
/** 1000@243. */
|
|
123
|
+
occupationDescription?: string;
|
|
124
|
+
/** 1000@293. */
|
|
125
|
+
mailingAddress: string;
|
|
126
|
+
/** 1000@343. */
|
|
127
|
+
businessAddress: string;
|
|
128
|
+
/** 1000@393, where the books are kept. */
|
|
129
|
+
booksAddress?: string;
|
|
130
|
+
/** 1000@443. */
|
|
131
|
+
email?: string;
|
|
132
|
+
/** 1000@493/496. */
|
|
133
|
+
phone: Phone;
|
|
134
|
+
/** 1000@503/506. */
|
|
135
|
+
fax?: Phone;
|
|
136
|
+
}
|
|
137
|
+
/** The person or office that helped fill in the report (SPEC §7.2), 1000@563–831. */
|
|
138
|
+
export interface PreparerDetails {
|
|
139
|
+
/** 1000@563. */
|
|
140
|
+
officeName?: string;
|
|
141
|
+
/** 1000@613. */
|
|
142
|
+
contactName?: string;
|
|
143
|
+
/** 1000@663. */
|
|
144
|
+
name?: string;
|
|
145
|
+
/** 1000@713. */
|
|
146
|
+
profession?: string;
|
|
147
|
+
/** 1000@763 "מספר עוסק מורשה (מסייע)". */
|
|
148
|
+
licensedDealerNumber?: string;
|
|
149
|
+
/** 1000@772. */
|
|
150
|
+
address?: string;
|
|
151
|
+
/** 1000@822/825. */
|
|
152
|
+
phone?: Phone;
|
|
153
|
+
}
|
|
154
|
+
/** Declarations of record 1000 (SPEC §7.2). */
|
|
155
|
+
export interface Declarations {
|
|
156
|
+
/** 878. */
|
|
157
|
+
hasTaxPlanningAction: boolean;
|
|
158
|
+
/** 879. */
|
|
159
|
+
hadRelatedPartyTransactions: boolean;
|
|
160
|
+
/** 880. */
|
|
161
|
+
controlsBodyOfPersons: boolean;
|
|
162
|
+
/** 881. */
|
|
163
|
+
holdsRightsInBodyOfPersons: boolean;
|
|
164
|
+
/** 882 (→ code 008 = 1). */
|
|
165
|
+
appliesAccountingStandards: boolean;
|
|
166
|
+
/** 1029 (→ code 273). */
|
|
167
|
+
directorsReceivedOpinion: boolean;
|
|
168
|
+
/** 1030 (→ code 273). */
|
|
169
|
+
tookReportablePosition: boolean;
|
|
170
|
+
/** 1034–1046: up to 5 position numbers (form 1346), 1–999. */
|
|
171
|
+
reportablePositions?: number[];
|
|
172
|
+
/** 834 (→ code 297 = 8 / 9). */
|
|
173
|
+
form6111Obligation?: 'obliged' | 'notObliged' | 'notRelevant';
|
|
174
|
+
/** 835. */
|
|
175
|
+
financialStatementsAttached?: boolean;
|
|
176
|
+
/** 836 + 837 (+ code 080 required). */
|
|
177
|
+
familyCompany?: {
|
|
178
|
+
representativeFileNumber: string;
|
|
179
|
+
};
|
|
180
|
+
/** 846 (+ code 084 required). */
|
|
181
|
+
isHouseCompany?: boolean;
|
|
182
|
+
/** 847. */
|
|
183
|
+
form1343Attached?: boolean;
|
|
184
|
+
/** 848. */
|
|
185
|
+
form1344Attached?: boolean;
|
|
186
|
+
/** 849 (required when code 101 or 102 is filled). */
|
|
187
|
+
claimsCapitalInvestmentLawBenefits?: boolean;
|
|
188
|
+
/** 850. */
|
|
189
|
+
preferredEnterprise?: boolean;
|
|
190
|
+
/** 851 + 852; the notice date may not precede the tax year (SPEC §15 A-33). */
|
|
191
|
+
beneficiaryEnterprise?: {
|
|
192
|
+
noticeDate: IsoDate;
|
|
193
|
+
};
|
|
194
|
+
/** 862. */
|
|
195
|
+
dividendDistributed?: boolean;
|
|
196
|
+
/** 863 + 864. */
|
|
197
|
+
specialYear?: {
|
|
198
|
+
balanceSheetDate: IsoDate;
|
|
199
|
+
};
|
|
200
|
+
/** 874. */
|
|
201
|
+
foreignInvestors?: boolean;
|
|
202
|
+
/** 875 → 1/2/3. */
|
|
203
|
+
consolidatedReport?: 'consolidatedUnderSection23' | 'consolidatesWithParent' | 'notRelevant';
|
|
204
|
+
/** 876. */
|
|
205
|
+
partnerInPartnership?: boolean;
|
|
206
|
+
/** 877. */
|
|
207
|
+
isKibbutz?: boolean;
|
|
208
|
+
/** 883 (yes/no). */
|
|
209
|
+
requestsAdvancePayments?: boolean;
|
|
210
|
+
/** 884 (yes/no; → code 259 required). */
|
|
211
|
+
hasBuildingIncome?: boolean;
|
|
212
|
+
/** 886. */
|
|
213
|
+
isTrustBeneficiary?: boolean;
|
|
214
|
+
/** 1031. */
|
|
215
|
+
nonDeductibleSalaryExpenses?: boolean;
|
|
216
|
+
/** 1032. */
|
|
217
|
+
fewMembersCompany62A?: boolean;
|
|
218
|
+
/** 1033 (yes/no). */
|
|
219
|
+
partOfMultinationalGroup?: boolean;
|
|
220
|
+
/** 1064. */
|
|
221
|
+
noBankAccount?: boolean;
|
|
222
|
+
/** 833: forces "yes" when capital-gains appendices exist but none are transmitted (otherwise
|
|
223
|
+
* derived from the appendices and `capitalGainsSummary.untransmittedCount`, SPEC §7.4). */
|
|
224
|
+
hasCapitalGainsAppendix?: boolean;
|
|
225
|
+
}
|
|
226
|
+
/** A related company in Israel or abroad, record 1010 (SPEC §7.2). */
|
|
227
|
+
export interface RelatedCompany {
|
|
228
|
+
/** 1010@139, ≤ 50, starting with a Hebrew letter (SPEC §15 A-29). */
|
|
229
|
+
companyName: string;
|
|
230
|
+
/** 1010@189 "מספר תיק חברה". */
|
|
231
|
+
companyFileNumber?: string;
|
|
232
|
+
/** 1010@198 → 1..8 in this order. */
|
|
233
|
+
relationType: 'parent' | 'subsidiary' | 'partnership' | 'kibbutzRelatedCorporation' | 'jointlyControlled' | 'granddaughter' | 'grandmother' | 'other';
|
|
234
|
+
/** 1010@199: the assessing office of the company's file, 2 digits. */
|
|
235
|
+
assessingOfficeCode?: number;
|
|
236
|
+
}
|
|
237
|
+
/** One shareholder, record 1020 (SPEC §7.2). */
|
|
238
|
+
export interface Shareholder {
|
|
239
|
+
/** 9 digits, or 999999964 / 999999998. */
|
|
240
|
+
idNumber: string;
|
|
241
|
+
/** Must start with a Hebrew letter. */
|
|
242
|
+
fullName: string;
|
|
243
|
+
isControllingShareholder: boolean;
|
|
244
|
+
/** All shareholders must total 100. */
|
|
245
|
+
dividendRightsPercent?: number;
|
|
246
|
+
votingRightsPercent?: number;
|
|
247
|
+
otherRightsPercent?: number;
|
|
248
|
+
isMaterialShareholder?: boolean;
|
|
249
|
+
salaryMonths1To9?: number;
|
|
250
|
+
salaryMonths10To12?: number;
|
|
251
|
+
otherPayments?: number;
|
|
252
|
+
}
|
|
253
|
+
/** An investment in an R&D company, record 1030 (SPEC §7.2); affiliation 1030@137 is derived. */
|
|
254
|
+
export interface RdInvestment {
|
|
255
|
+
/** 1030@138, ≤ 50, starting with a Hebrew letter (SPEC §15 A-29). */
|
|
256
|
+
companyName: string;
|
|
257
|
+
/** 1030@188 "מספר תיק חברה". */
|
|
258
|
+
companyFileNumber?: string;
|
|
259
|
+
/** 1030@197, whole shekels. */
|
|
260
|
+
investmentAmount: number;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The foreign appendix "נספח חו"ל", record 2000 (SPEC §7.2). Header amounts are whole shekels;
|
|
264
|
+
* an optional amount of 0 is written as absent.
|
|
265
|
+
*/
|
|
266
|
+
export interface ForeignAppendix {
|
|
267
|
+
/** 2000@137, ≤ 50; required when `otherTaxableIncome` > 0 (foreign.otherIncome.description). */
|
|
268
|
+
otherTaxableIncomeDescription?: string;
|
|
269
|
+
/** 2000@187 "הכנסה חייבת אחרת". */
|
|
270
|
+
otherTaxableIncome?: number;
|
|
271
|
+
/** 2000@199, foreign tax paid on the other taxable income. */
|
|
272
|
+
foreignTaxPaidOnOtherIncome?: number;
|
|
273
|
+
/** 2000@211, total foreign taxable income. */
|
|
274
|
+
totalForeignTaxableIncome?: number;
|
|
275
|
+
/** 2000@223, total foreign loss. */
|
|
276
|
+
totalForeignLoss?: number;
|
|
277
|
+
/** 2000@235, participation exemption of an Israeli holding company. */
|
|
278
|
+
participationExemptionHoldingCompany?: number;
|
|
279
|
+
/** 2000@247 "הצהרה – החזר מסים" (required yes/no). */
|
|
280
|
+
taxRefundDeclaration: boolean;
|
|
281
|
+
/** 2000@248; expected when `taxRefundDeclaration` (foreign.refund.amount). */
|
|
282
|
+
taxRefundDeclarationAmount?: number;
|
|
283
|
+
/** Record 2000 code-amount section; a 0 is written only for the zeroAllowed code 442 (SPEC §4.5). */
|
|
284
|
+
amounts: Partial<Record<ForeignAppendixCode, number>>;
|
|
285
|
+
/**
|
|
286
|
+
* Records 2200, one per per-country code written in `amounts` (SPEC §3.6): required for each such
|
|
287
|
+
* code (foreign.breakdown.required) and allowed only for them (foreign.breakdown.orphan).
|
|
288
|
+
*/
|
|
289
|
+
countryBreakdown?: Partial<Record<CountryBreakdownCode, CountryBreakdown>>;
|
|
290
|
+
}
|
|
291
|
+
/** The income of one foreign-appendix code by country, record 2200 (SPEC §3.6, §7.2). */
|
|
292
|
+
export interface CountryBreakdown {
|
|
293
|
+
/** 2200@140, total deductions, offsets and exemptions of the code. */
|
|
294
|
+
deductionsOffsetsAndExemptions?: number;
|
|
295
|
+
/** The 2200 country-amount section: 1–10 countries, each at most once. */
|
|
296
|
+
countries: CountryIncome[];
|
|
297
|
+
}
|
|
298
|
+
/** One entry of a country breakdown; its affiliation (always 1) is derived (SPEC §7.4). */
|
|
299
|
+
export interface CountryIncome {
|
|
300
|
+
/**
|
|
301
|
+
* A code of countries.csv, zero-padded to 3 digits when written (`'40'` → `'040'`); `'-88'`
|
|
302
|
+
* (country unknown) only for code 439 (foreign.breakdown.country.unknownOnlyFor439).
|
|
303
|
+
*/
|
|
304
|
+
country: CountryCode;
|
|
305
|
+
/** Income before deductions, offsets and exemptions, whole shekels. */
|
|
306
|
+
income: number;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* A capital-gains appendix, discriminated by its transaction symbol (record 30xx = 3000 + symbol,
|
|
310
|
+
* SPEC §3.7). Its transaction symbol (30xx@137) and appendix number (30xx@139) are derived
|
|
311
|
+
* (SPEC §7.4).
|
|
312
|
+
*/
|
|
313
|
+
export type CapitalGainsAppendix = SharesAppendix | BettermentTaxAppendix | ForcedVirtualCurrencyAppendix | OilPartnershipAppendix | SecuritiesAppendix | Section6SecuritiesAppendix | ReitAppendix | NoWithholding1322Appendix | NoWithholding1326Appendix | OtherTransactionsAppendix;
|
|
314
|
+
/**
|
|
315
|
+
* A withholding agent of a securities appendix (records 3060, 3064, 3065): one of the four slots
|
|
316
|
+
* "מנכה", "סניף", "חשבון" (3060/3064: 146–313, 3065: 147–314; SPEC §7.3). An empty slot is
|
|
317
|
+
* written as absent.
|
|
318
|
+
*/
|
|
319
|
+
export interface Withholder {
|
|
320
|
+
/** "מנכה", up to 30 characters; must start with a Hebrew letter (field.hebrewFirstLetter). */
|
|
321
|
+
name?: string;
|
|
322
|
+
/** "סניף", up to 3 digits, zero-padded when written ('12' → '012'). */
|
|
323
|
+
branch?: string;
|
|
324
|
+
/** "חשבון", up to 9 digits, zero-padded when written. */
|
|
325
|
+
account?: string;
|
|
326
|
+
}
|
|
327
|
+
/** Capital gains from securities, record 3060 (SPEC §7.2, p.43–45). */
|
|
328
|
+
export interface SecuritiesAppendix {
|
|
329
|
+
symbol: 60;
|
|
330
|
+
/** 30xx@142 "נכס חו"ל" (yes/no). */
|
|
331
|
+
foreignAsset?: boolean;
|
|
332
|
+
/** 30xx@143 "מכירה לצד קשור" (yes/no). */
|
|
333
|
+
soldToRelatedParty?: boolean;
|
|
334
|
+
/** 30xx@144 "רכישה מצד קשור" (yes/no). */
|
|
335
|
+
boughtFromRelatedParty?: boolean;
|
|
336
|
+
/** 30xx@145 "רווח מקרן השקעות" (yes/no, SPEC §15 A-8). */
|
|
337
|
+
gainFromInvestmentFund?: boolean;
|
|
338
|
+
/** 30xx@146–313: at most 4 withholding agents (input.shape), keyed `withholders[i].*`. */
|
|
339
|
+
withholders?: Withholder[];
|
|
340
|
+
/** 30xx@314, losses carried forward, whole shekels. */
|
|
341
|
+
lossesCarriedForward?: number;
|
|
342
|
+
/** Record 3060 code-amount section; no code of 3060 is zeroAllowed (SPEC §4.5). */
|
|
343
|
+
amounts: Partial<Record<CapitalGainsCode<60>, number>>;
|
|
344
|
+
}
|
|
345
|
+
/** Capital gains from securities under section 6, record 3063 (SPEC §7.2). */
|
|
346
|
+
export interface Section6SecuritiesAppendix {
|
|
347
|
+
symbol: 63;
|
|
348
|
+
/** 3063@142 "נכס חו"ל" (yes/no). */
|
|
349
|
+
foreignAsset?: boolean;
|
|
350
|
+
/** 3063@143, losses carried forward, whole shekels. */
|
|
351
|
+
lossesCarriedForward?: number;
|
|
352
|
+
/** Record 3063 code-amount section; no code of 3063 is zeroAllowed (SPEC §4.5). */
|
|
353
|
+
amounts: Partial<Record<CapitalGainsCode<63>, number>>;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Capital gains from real-estate investment trust units, record 3064 (SPEC §7.2, p.48–49): the
|
|
357
|
+
* header of record 3060 with its own codes.
|
|
358
|
+
*/
|
|
359
|
+
export interface ReitAppendix extends Omit<SecuritiesAppendix, 'symbol' | 'amounts'> {
|
|
360
|
+
symbol: 64;
|
|
361
|
+
/** Record 3064 code-amount section; no code of 3064 is zeroAllowed (SPEC §4.5). */
|
|
362
|
+
amounts: Partial<Record<CapitalGainsCode<64>, number>>;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* "מס במקור" of records 3065 (146) and 3066 (143): tax was not withheld on gains accrued in the
|
|
366
|
+
* first (January–June, → 2) or second (July–December, → 3) half of the tax year (SPEC §15 A-18);
|
|
367
|
+
* absent → 0.
|
|
368
|
+
*/
|
|
369
|
+
export type WithholdingStatus = 'notWithheldFirstHalf' | 'notWithheldSecondHalf';
|
|
370
|
+
/**
|
|
371
|
+
* Capital gains from securities without tax withholding, form 1322, record 3065 (SPEC §7.2,
|
|
372
|
+
* p.50–52): the header of record 3060 with a withholding status; its "מספר בתל"ם" sequence
|
|
373
|
+
* (3065@325) is derived (SPEC §7.4).
|
|
374
|
+
*/
|
|
375
|
+
export interface NoWithholding1322Appendix extends Omit<SecuritiesAppendix, 'symbol' | 'amounts'> {
|
|
376
|
+
symbol: 65;
|
|
377
|
+
/** 3065@146 "מס במקור": notWithheldFirstHalf → 2, notWithheldSecondHalf → 3, absent → 0. */
|
|
378
|
+
withholdingStatus?: WithholdingStatus;
|
|
379
|
+
/** Record 3065 code-amount section; no code of 3065 is zeroAllowed (SPEC §4.5). */
|
|
380
|
+
amounts: Partial<Record<CapitalGainsCode<65>, number>>;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Capital gains from securities without tax withholding, form 1326, record 3066 (SPEC §7.2,
|
|
384
|
+
* p.53–54); its "מספר בתל"ם" sequence (3066@154) is derived (SPEC §7.4).
|
|
385
|
+
*/
|
|
386
|
+
export interface NoWithholding1326Appendix {
|
|
387
|
+
symbol: 66;
|
|
388
|
+
/** 3066@142 "נכס חו"ל" (yes/no). */
|
|
389
|
+
foreignAsset?: boolean;
|
|
390
|
+
/** 3066@143 "מס במקור": notWithheldFirstHalf → 2, notWithheldSecondHalf → 3, absent → 0. */
|
|
391
|
+
withholdingStatus?: WithholdingStatus;
|
|
392
|
+
/** 3066@144, losses carried forward, whole shekels. */
|
|
393
|
+
lossesCarriedForward?: number;
|
|
394
|
+
/** Record 3066 code-amount section; no code of 3066 is zeroAllowed (SPEC §4.5). */
|
|
395
|
+
amounts: Partial<Record<CapitalGainsCode<66>, number>>;
|
|
396
|
+
}
|
|
397
|
+
/** "מקום הנכס" of records 3027 (193), 3051 (192) and 3077 (193): abroad → 1, israel → 2 (SPEC §7.2). */
|
|
398
|
+
export type AssetLocation = 'abroad' | 'israel';
|
|
399
|
+
/**
|
|
400
|
+
* Capital gains from shares, record 3027 (SPEC §7.2, p.34–36). Every date is optional; its
|
|
401
|
+
* "מספר בתל"ם" sequence (3027@255) is derived (SPEC §7.4).
|
|
402
|
+
*/
|
|
403
|
+
export interface SharesAppendix {
|
|
404
|
+
symbol: 27;
|
|
405
|
+
/** 3027@142 "הפקעה" (yes/no). */
|
|
406
|
+
expropriation?: boolean;
|
|
407
|
+
/** 3027@143 "פרטי הנכס", up to 50 characters; must start with a Hebrew letter. */
|
|
408
|
+
assetDetails?: string;
|
|
409
|
+
/** 3027@193 "מקום הנכס": abroad → 1, israel → 2. */
|
|
410
|
+
assetLocation?: AssetLocation;
|
|
411
|
+
/** 3027@194 "צד קשור" (yes/no). */
|
|
412
|
+
relatedParty?: boolean;
|
|
413
|
+
/** 3027@195 "שם הרוכש", up to 30 characters. */
|
|
414
|
+
buyerName?: string;
|
|
415
|
+
/** The dates of codes 15 (3027@225), 20 (235) and 53 (245), written DD/MM/YYYY. */
|
|
416
|
+
dates?: {
|
|
417
|
+
code15?: IsoDate;
|
|
418
|
+
code20?: IsoDate;
|
|
419
|
+
code53?: IsoDate;
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
422
|
+
* Record 3027 code-amount section: 020, 053 and 027 take agorot (written ×100), 018 is the rate
|
|
423
|
+
* 23 or 50 (written ×100); no code of 3027 is zeroAllowed (SPEC §4.5).
|
|
424
|
+
*/
|
|
425
|
+
amounts: Partial<Record<CapitalGainsCode<27>, number>>;
|
|
426
|
+
}
|
|
427
|
+
/** Capital gains from an asset sale under betterment tax, record 3050 (SPEC §7.2, p.37–38). */
|
|
428
|
+
export interface BettermentTaxAppendix {
|
|
429
|
+
symbol: 50;
|
|
430
|
+
/** 3050@142 "הפקעה" (yes/no). */
|
|
431
|
+
expropriation?: boolean;
|
|
432
|
+
/** 3050@143 "פרטי הנכס", up to 50 characters; must start with a Hebrew letter. */
|
|
433
|
+
assetDetails?: string;
|
|
434
|
+
/** 3050@193 "תאריך קניה" (required), written DD/MM/YYYY. */
|
|
435
|
+
purchaseDate: IsoDate;
|
|
436
|
+
/** The date of code 15 (3050@203, required), written DD/MM/YYYY. */
|
|
437
|
+
dates: {
|
|
438
|
+
code15: IsoDate;
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* Record 3050 code-amount section: 014 is 10 or 20, 018 the rate 23 or 50 (written ×100); no
|
|
442
|
+
* code of 3050 is zeroAllowed (SPEC §4.5).
|
|
443
|
+
*/
|
|
444
|
+
amounts: Partial<Record<CapitalGainsCode<50>, number>>;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* A forced virtual-currency transaction, record 3051 (SPEC §7.2, p.39–40; virtual currency is
|
|
448
|
+
* normally reported with symbol 77, SPEC §3.7). Its "מספר בתל"ם" sequence (3051@234) is derived
|
|
449
|
+
* (SPEC §7.4).
|
|
450
|
+
*/
|
|
451
|
+
export interface ForcedVirtualCurrencyAppendix {
|
|
452
|
+
symbol: 51;
|
|
453
|
+
/** 3051@142 "פרטי הנכס", up to 50 characters; must start with a Hebrew letter. */
|
|
454
|
+
assetDetails?: string;
|
|
455
|
+
/** 3051@192 "מקום הנכס": abroad → 1, israel → 2. */
|
|
456
|
+
assetLocation?: AssetLocation;
|
|
457
|
+
/** 3051@193 "צד קשור" (yes/no). */
|
|
458
|
+
relatedParty?: boolean;
|
|
459
|
+
/** 3051@194 "שם הרוכש", up to 30 characters; must start with a Hebrew letter. */
|
|
460
|
+
buyerName?: string;
|
|
461
|
+
/** The date of code 15 (3051@224, required), written DD/MM/YYYY. */
|
|
462
|
+
dates: {
|
|
463
|
+
code15: IsoDate;
|
|
464
|
+
};
|
|
465
|
+
/** 3051@236 and @386: one or two virtual wallet addresses, up to 150 characters each. */
|
|
466
|
+
walletAddresses?: [string] | [string, string];
|
|
467
|
+
/**
|
|
468
|
+
* Record 3051 code-amount section: 071 (= 1) and 016 are required (field.required); no code of
|
|
469
|
+
* 3051 is zeroAllowed (SPEC §4.5).
|
|
470
|
+
*/
|
|
471
|
+
amounts: Partial<Record<CapitalGainsCode<51>, number>>;
|
|
472
|
+
}
|
|
473
|
+
/** Capital gains from an oil-partnership asset, record 3054 (SPEC §7.2, p.41–42). */
|
|
474
|
+
export interface OilPartnershipAppendix {
|
|
475
|
+
symbol: 54;
|
|
476
|
+
/** 3054@142 "פרטי הנכס", up to 50 characters; must start with a Hebrew letter. */
|
|
477
|
+
assetDetails?: string;
|
|
478
|
+
/** 3054@192 "תאריך קניה" (required), written DD/MM/YYYY. */
|
|
479
|
+
purchaseDate: IsoDate;
|
|
480
|
+
/** The date of code 15 (3054@202, required), written DD/MM/YYYY. */
|
|
481
|
+
dates: {
|
|
482
|
+
code15: IsoDate;
|
|
483
|
+
};
|
|
484
|
+
/** Record 3054 code-amount section: 016 is zeroAllowed (written when 0, SPEC §4.5). */
|
|
485
|
+
amounts: Partial<Record<CapitalGainsCode<54>, number>>;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Capital gains from other transactions, record 3077 (SPEC §7.2, p.55–59; virtual currency is
|
|
489
|
+
* normally reported here, with code 071, SPEC §3.7). Its improvement count (3077@245), code-50
|
|
490
|
+
* amounts (codes 501–505) and "מספר בתל"ם" sequence (3077@487) are derived (SPEC §7.4).
|
|
491
|
+
*/
|
|
492
|
+
export interface OtherTransactionsAppendix {
|
|
493
|
+
symbol: 77;
|
|
494
|
+
/** 3077@142 "הפקעה" (yes/no). */
|
|
495
|
+
expropriation?: boolean;
|
|
496
|
+
/** 3077@143 "פרטי הנכס", up to 50 characters. */
|
|
497
|
+
assetDetails?: string;
|
|
498
|
+
/** 3077@193 "מקום הנכס": abroad → 1, israel → 2. */
|
|
499
|
+
assetLocation?: AssetLocation;
|
|
500
|
+
/** 3077@194 "צד קשור" (yes/no). */
|
|
501
|
+
relatedParty?: boolean;
|
|
502
|
+
/** 3077@195 "שם הרוכש", up to 30 characters. */
|
|
503
|
+
buyerName?: string;
|
|
504
|
+
/** The dates of codes 15 (3077@225) and 20 (235), both required, written DD/MM/YYYY. */
|
|
505
|
+
dates: {
|
|
506
|
+
code15: IsoDate;
|
|
507
|
+
code20: IsoDate;
|
|
508
|
+
};
|
|
509
|
+
/**
|
|
510
|
+
* Improvements ("יתרות השבחה"), written slot by slot (3077@247–416, keys `improvements[i].*`);
|
|
511
|
+
* only five slots exist (cg.improvements.max), and their number is 3077@245.
|
|
512
|
+
*/
|
|
513
|
+
improvements?: Array<{
|
|
514
|
+
/**
|
|
515
|
+
* "סכום ההוצאה על ההשבחה", written ×100 (agorot allowed). Required, greater than 0: SHAAM
|
|
516
|
+
* counts only improvements with an expense (cg.improvements.expense, SPEC §15 A-32).
|
|
517
|
+
*/
|
|
518
|
+
expense?: number;
|
|
519
|
+
/** "סכום הפחת שנצבר", written ×100 (agorot allowed); at most `expense`. */
|
|
520
|
+
accumulatedDepreciation?: number;
|
|
521
|
+
/** "תאריך של קוד 50", written DD/MM/YYYY. */
|
|
522
|
+
date: IsoDate;
|
|
523
|
+
/** The code-50 amount of the improvement: code 501 … 505 by slot, written ×100. */
|
|
524
|
+
code50Amount?: number;
|
|
525
|
+
}>;
|
|
526
|
+
/** The asset bought in replacement: details (3077@417), purchase date (467) and price (477). */
|
|
527
|
+
replacementAsset?: {
|
|
528
|
+
details?: string;
|
|
529
|
+
purchaseDate?: IsoDate;
|
|
530
|
+
price?: number;
|
|
531
|
+
};
|
|
532
|
+
/**
|
|
533
|
+
* 3077@489 and @639: one or two virtual wallet addresses, up to 150 characters each; required
|
|
534
|
+
* when code 071 = 1 (cg.virtualCurrency.wallet).
|
|
535
|
+
*/
|
|
536
|
+
walletAddresses?: [string] | [string, string];
|
|
537
|
+
/**
|
|
538
|
+
* Record 3077 code-amount section without the derived codes 501–505: 020/027/040 take agorot
|
|
539
|
+
* (written ×100), 018 is the rate 23 or 50 (written ×100), 092 is 1 (SPEC §15 A-31),
|
|
540
|
+
* 071 = 1 marks virtual currency; no code of 3077 is zeroAllowed (SPEC §4.5).
|
|
541
|
+
*/
|
|
542
|
+
amounts: Partial<Record<Exclude<CapitalGainsCode<77>, '501' | '502' | '503' | '504' | '505'>, number>>;
|
|
543
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Allowed phone prefixes (SPEC §4.2, p.6–7). */
|
|
2
|
+
export const PHONE_PREFIXES = [
|
|
3
|
+
'02',
|
|
4
|
+
'03',
|
|
5
|
+
'04',
|
|
6
|
+
'08',
|
|
7
|
+
'09',
|
|
8
|
+
'072',
|
|
9
|
+
'073',
|
|
10
|
+
'074',
|
|
11
|
+
'076',
|
|
12
|
+
'077',
|
|
13
|
+
'050',
|
|
14
|
+
'052',
|
|
15
|
+
'053',
|
|
16
|
+
'054',
|
|
17
|
+
'055',
|
|
18
|
+
'057',
|
|
19
|
+
'058',
|
|
20
|
+
'059',
|
|
21
|
+
];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The internal model between the public input and the file (IMPLEMENTATION_PLAN.md §1.2). The
|
|
3
|
+
* normalizer and the parser produce it; codecs, rules and file assembly only see this model.
|
|
4
|
+
*/
|
|
5
|
+
import type { Primitive } from '../codec/types.js';
|
|
6
|
+
import type { RecordType, YearLayout } from '../layout/types.js';
|
|
7
|
+
import type { Issue } from '../validate/issue.js';
|
|
8
|
+
/** One record of a report, with its values in model units (value conventions: plan §1.2). */
|
|
9
|
+
export interface NormalizedRecord {
|
|
10
|
+
recordType: RecordType;
|
|
11
|
+
/** 0-based among records of the same type. */
|
|
12
|
+
index: number;
|
|
13
|
+
/**
|
|
14
|
+
* Capital-gains records (30xx) only: the 0-based index of the appendix in `capitalGains`, which
|
|
15
|
+
* pathFor needs because the records are grouped by type (SPEC §3.3), so `index` differs from it.
|
|
16
|
+
* The parser sets it to the record's index among all capital-gains records of the file.
|
|
17
|
+
*/
|
|
18
|
+
inputIndex?: number;
|
|
19
|
+
/** FieldDef.key → value (derived keys included). */
|
|
20
|
+
values: Record<string, Primitive>;
|
|
21
|
+
/** Code-amount section, natural units. */
|
|
22
|
+
codes: Map<string, number>;
|
|
23
|
+
/** Country-amount section: 2200 only, otherwise []. */
|
|
24
|
+
countries: Array<{
|
|
25
|
+
country: string;
|
|
26
|
+
income: number;
|
|
27
|
+
}>;
|
|
28
|
+
/** key | `code:${code}` | `countries[${i}].country` | `countries[${i}].income` → input path. */
|
|
29
|
+
paths: Record<string, string>;
|
|
30
|
+
}
|
|
31
|
+
/** One report: its records in canonical order (SPEC §3.3), 9999 excluded. */
|
|
32
|
+
export interface NormalizedReport {
|
|
33
|
+
taxYear: number;
|
|
34
|
+
layout: YearLayout;
|
|
35
|
+
records: NormalizedRecord[];
|
|
36
|
+
/** Raised while normalizing (e.g. phone prefix dropped). */
|
|
37
|
+
notices: Issue[];
|
|
38
|
+
omittedZeroCodes: Array<{
|
|
39
|
+
record: RecordType;
|
|
40
|
+
recordIndex: number;
|
|
41
|
+
code: string;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Options of validation and generation (SPEC §6.2). */
|
|
2
|
+
import type { IsoDate } from './input.js';
|
|
3
|
+
export interface ValidateOptions {
|
|
4
|
+
/** How non-integer amounts are handled. Default 'reject' (error field.integer). */
|
|
5
|
+
rounding?: 'reject' | 'halfUp';
|
|
6
|
+
/** Used when input.meta.saveDate is absent. Default: today in Asia/Jerusalem. */
|
|
7
|
+
today?: () => IsoDate;
|
|
8
|
+
}
|
|
9
|
+
export type GenerateOptions = ValidateOptions;
|
|
10
|
+
/** Options of parsing (SPEC §6.2). */
|
|
11
|
+
export interface ParseOptions {
|
|
12
|
+
/** Encoding of a Uint8Array input. Default 'windows-1255'. Strings are taken as already decoded. */
|
|
13
|
+
encoding?: 'windows-1255' | 'utf-8';
|
|
14
|
+
}
|
|
File without changes
|