@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
package/README.md
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# @accounter/opcn1214-generator
|
|
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
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RULES = exports.Opcn1214ValidationError = exports.Opcn1214UnsupportedYearError = exports.Opcn1214ParseError = exports.Opcn1214InternalError = exports.Opcn1214Error = exports.supportedTaxYears = exports.getLayout = exports.validate1214 = exports.parseResponseFile = exports.parse1214Batch = exports.parse1214 = exports.generate1214Batch = exports.generate1214 = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @accounter/opcn1214-generator: SHAAM form 1214 (OPCN) generator, validator and parser.
|
|
6
|
+
* Public API (SPEC §6.4).
|
|
7
|
+
*/
|
|
8
|
+
var generate_js_1 = require("./api/generate.js");
|
|
9
|
+
Object.defineProperty(exports, "generate1214", { enumerable: true, get: function () { return generate_js_1.generate1214; } });
|
|
10
|
+
Object.defineProperty(exports, "generate1214Batch", { enumerable: true, get: function () { return generate_js_1.generate1214Batch; } });
|
|
11
|
+
var parse_js_1 = require("./api/parse.js");
|
|
12
|
+
Object.defineProperty(exports, "parse1214", { enumerable: true, get: function () { return parse_js_1.parse1214; } });
|
|
13
|
+
Object.defineProperty(exports, "parse1214Batch", { enumerable: true, get: function () { return parse_js_1.parse1214Batch; } });
|
|
14
|
+
var response_js_1 = require("./api/response.js");
|
|
15
|
+
Object.defineProperty(exports, "parseResponseFile", { enumerable: true, get: function () { return response_js_1.parseResponseFile; } });
|
|
16
|
+
var validate_js_1 = require("./api/validate.js");
|
|
17
|
+
Object.defineProperty(exports, "validate1214", { enumerable: true, get: function () { return validate_js_1.validate1214; } });
|
|
18
|
+
var registry_js_1 = require("./layout/registry.js");
|
|
19
|
+
Object.defineProperty(exports, "getLayout", { enumerable: true, get: function () { return registry_js_1.getLayout; } });
|
|
20
|
+
Object.defineProperty(exports, "supportedTaxYears", { enumerable: true, get: function () { return registry_js_1.supportedTaxYears; } });
|
|
21
|
+
var errors_js_1 = require("./errors.js");
|
|
22
|
+
Object.defineProperty(exports, "Opcn1214Error", { enumerable: true, get: function () { return errors_js_1.Opcn1214Error; } });
|
|
23
|
+
Object.defineProperty(exports, "Opcn1214InternalError", { enumerable: true, get: function () { return errors_js_1.Opcn1214InternalError; } });
|
|
24
|
+
Object.defineProperty(exports, "Opcn1214ParseError", { enumerable: true, get: function () { return errors_js_1.Opcn1214ParseError; } });
|
|
25
|
+
Object.defineProperty(exports, "Opcn1214UnsupportedYearError", { enumerable: true, get: function () { return errors_js_1.Opcn1214UnsupportedYearError; } });
|
|
26
|
+
Object.defineProperty(exports, "Opcn1214ValidationError", { enumerable: true, get: function () { return errors_js_1.Opcn1214ValidationError; } });
|
|
27
|
+
var rules_js_1 = require("./validate/rules.js");
|
|
28
|
+
Object.defineProperty(exports, "RULES", { enumerable: true, get: function () { return rules_js_1.RULES; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @accounter/opcn1214-generator: SHAAM form 1214 (OPCN) generator, validator and parser.
|
|
3
|
+
* Public API (SPEC §6.4).
|
|
4
|
+
*/
|
|
5
|
+
export { generate1214, generate1214Batch } from './api/generate.js';
|
|
6
|
+
export { parse1214, parse1214Batch } from './api/parse.js';
|
|
7
|
+
export { parseResponseFile } from './api/response.js';
|
|
8
|
+
export { validate1214 } from './api/validate.js';
|
|
9
|
+
export { getLayout, supportedTaxYears } from './layout/registry.js';
|
|
10
|
+
export { Opcn1214Error, Opcn1214InternalError, Opcn1214ParseError, Opcn1214UnsupportedYearError, Opcn1214ValidationError, } from './errors.js';
|
|
11
|
+
export { RULES } from './validate/rules.js';
|