@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,9 @@
|
|
|
1
|
+
import { LAYOUT_2024 } from '../2024/layout.generated.js';
|
|
2
|
+
import { deepFreeze } from '../freeze.js';
|
|
3
|
+
import type { YearLayout } from '../types.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Tax year 2025 reuses the 2024 layout until SHAAM's 2025 specification is added (SPEC §14):
|
|
7
|
+
* same records, codes, countries and limits; only `taxYear` differs.
|
|
8
|
+
*/
|
|
9
|
+
export const LAYOUT_2025: YearLayout = deepFreeze({ ...LAYOUT_2024, taxYear: 2025 });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Record types of the capital-gains appendices (SPEC §3.7): record 30xx for symbol xx. */
|
|
2
|
+
import { CAPITAL_GAINS_SYMBOLS, type CapitalGainsSymbol } from '../model/codes.generated.js';
|
|
3
|
+
import type { RecordType } from './types.js';
|
|
4
|
+
|
|
5
|
+
/** The record type of a capital-gains appendix: 3000 + its transaction symbol. */
|
|
6
|
+
export type CapitalGainsRecordType = `30${CapitalGainsSymbol}` & RecordType;
|
|
7
|
+
|
|
8
|
+
/** The record type of the capital-gains appendices of `symbol` (SPEC §3.7). */
|
|
9
|
+
export function capitalGainsRecordType(symbol: CapitalGainsSymbol): CapitalGainsRecordType {
|
|
10
|
+
return `30${symbol}`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const CAPITAL_GAINS_RECORD_TYPES: ReadonlySet<RecordType> = new Set(
|
|
14
|
+
CAPITAL_GAINS_SYMBOLS.map(capitalGainsRecordType),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
/** True for the ten capital-gains record types (3027 … 3077). */
|
|
18
|
+
export function isCapitalGainsRecordType(type: RecordType): type is CapitalGainsRecordType {
|
|
19
|
+
return CAPITAL_GAINS_RECORD_TYPES.has(type);
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key of a country code in `YearLayout.countries` (SPEC §3.6): codes are zero-padded to 3 digits
|
|
3
|
+
* (`'40'` → `'040'`) and the special code `-88` ("country unknown") stays as is.
|
|
4
|
+
*/
|
|
5
|
+
export function countryKey(code: string): string {
|
|
6
|
+
return code === '-88' ? code : code.padStart(3, '0');
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Freezes a value and every object reachable through its own properties. A Map is frozen as an
|
|
3
|
+
* object only (its entries stay mutable at runtime); layouts expose it as a ReadonlyMap.
|
|
4
|
+
*/
|
|
5
|
+
export function deepFreeze<T>(value: T): T {
|
|
6
|
+
if (typeof value === 'object' && value !== null && !Object.isFrozen(value)) {
|
|
7
|
+
Object.freeze(value);
|
|
8
|
+
for (const child of Object.values(value)) {
|
|
9
|
+
deepFreeze(child);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Opcn1214UnsupportedYearError } from '../errors.js';
|
|
2
|
+
import { LAYOUT_2024 } from './2024/layout.generated.js';
|
|
3
|
+
import { LAYOUT_2025 } from './2025/index.js';
|
|
4
|
+
import { deepFreeze } from './freeze.js';
|
|
5
|
+
import type { YearLayout } from './types.js';
|
|
6
|
+
|
|
7
|
+
/** Tax year → layout (SPEC §14), deep-frozen at module load. */
|
|
8
|
+
const LAYOUTS: ReadonlyMap<number, YearLayout> = new Map<number, YearLayout>([
|
|
9
|
+
[2024, deepFreeze<YearLayout>(LAYOUT_2024)],
|
|
10
|
+
[2025, LAYOUT_2025],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const SUPPORTED_TAX_YEARS: readonly number[] = Object.freeze([...LAYOUTS.keys()]);
|
|
14
|
+
|
|
15
|
+
/** The tax years with a layout, ascending. */
|
|
16
|
+
export function supportedTaxYears(): readonly number[] {
|
|
17
|
+
return SUPPORTED_TAX_YEARS;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Returns the layout of a supported tax year; throws Opcn1214UnsupportedYearError otherwise. */
|
|
21
|
+
export function getLayout(taxYear: number): YearLayout {
|
|
22
|
+
const layout = LAYOUTS.get(taxYear);
|
|
23
|
+
if (!layout) {
|
|
24
|
+
throw new Opcn1214UnsupportedYearError(taxYear, SUPPORTED_TAX_YEARS);
|
|
25
|
+
}
|
|
26
|
+
return layout;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Reports per OPCN file (SPEC §3.1, p.1), the same for every year (YearLayout.limits): a batch
|
|
31
|
+
* holds 1 to this many reports, whatever their tax years.
|
|
32
|
+
*/
|
|
33
|
+
export const REPORTS_PER_FILE: YearLayout['limits']['reportsPerFile'] = 50;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout types (SPEC §5.4). The runtime layout of each tax year is generated from
|
|
3
|
+
* documentation/layout/<year>/*.csv into src/layout/<year>/layout.generated.ts.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type RecordType =
|
|
7
|
+
| '1000'
|
|
8
|
+
| '1010'
|
|
9
|
+
| '1020'
|
|
10
|
+
| '1030'
|
|
11
|
+
| '2000'
|
|
12
|
+
| '2200'
|
|
13
|
+
| '3027'
|
|
14
|
+
| '3050'
|
|
15
|
+
| '3051'
|
|
16
|
+
| '3054'
|
|
17
|
+
| '3060'
|
|
18
|
+
| '3063'
|
|
19
|
+
| '3064'
|
|
20
|
+
| '3065'
|
|
21
|
+
| '3066'
|
|
22
|
+
| '3077'
|
|
23
|
+
| '9999';
|
|
24
|
+
|
|
25
|
+
/** Semantic kinds of header fields (SPEC §4.2). */
|
|
26
|
+
export const FIELD_KINDS = [
|
|
27
|
+
'text',
|
|
28
|
+
'hebrewText',
|
|
29
|
+
'id9',
|
|
30
|
+
'shareholderId',
|
|
31
|
+
'year',
|
|
32
|
+
'num',
|
|
33
|
+
'digits',
|
|
34
|
+
'amount',
|
|
35
|
+
'amountX',
|
|
36
|
+
'amountX100',
|
|
37
|
+
'rateX100',
|
|
38
|
+
'percentX100',
|
|
39
|
+
'percentLiteral',
|
|
40
|
+
'date',
|
|
41
|
+
'flag',
|
|
42
|
+
'yesNo',
|
|
43
|
+
'enum',
|
|
44
|
+
'phonePrefix',
|
|
45
|
+
'foreignCode',
|
|
46
|
+
'serial',
|
|
47
|
+
'count',
|
|
48
|
+
'const',
|
|
49
|
+
'filler',
|
|
50
|
+
] as const;
|
|
51
|
+
|
|
52
|
+
export type FieldKind = (typeof FIELD_KINDS)[number];
|
|
53
|
+
|
|
54
|
+
/** Kinds of code-amount section values (SPEC §3.5). */
|
|
55
|
+
export const CODE_KINDS = ['amount', 'amountX100', 'rateX100', 'enum', 'num'] as const;
|
|
56
|
+
|
|
57
|
+
export type CodeKind = (typeof CODE_KINDS)[number];
|
|
58
|
+
|
|
59
|
+
export type Requirement = 'yes' | 'no' | 'conditional';
|
|
60
|
+
|
|
61
|
+
export interface EnumValue {
|
|
62
|
+
readonly value: number;
|
|
63
|
+
readonly label?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface FieldDef {
|
|
67
|
+
readonly record: RecordType;
|
|
68
|
+
/** 1-based start position. */
|
|
69
|
+
readonly position: number;
|
|
70
|
+
readonly length: number;
|
|
71
|
+
readonly type: 'numeric' | 'alphanumeric';
|
|
72
|
+
readonly required: Requirement;
|
|
73
|
+
/** Canonical key, without the `(derived) ` prefix of the CSV. */
|
|
74
|
+
readonly key: string;
|
|
75
|
+
/** True for rows whose CSV key starts with `(derived) ` (computed by the package, SPEC §7.4). */
|
|
76
|
+
readonly derived: boolean;
|
|
77
|
+
readonly kind: FieldKind;
|
|
78
|
+
readonly values?: readonly EnumValue[];
|
|
79
|
+
readonly nameHe: string;
|
|
80
|
+
readonly specPage: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface CodeDef {
|
|
84
|
+
readonly record: RecordType;
|
|
85
|
+
/** 3 digits. */
|
|
86
|
+
readonly code: string;
|
|
87
|
+
readonly length: number;
|
|
88
|
+
readonly required: Requirement;
|
|
89
|
+
readonly kind: CodeKind;
|
|
90
|
+
readonly values?: readonly EnumValue[];
|
|
91
|
+
readonly zeroAllowed: boolean;
|
|
92
|
+
readonly perCountryBreakdown: boolean;
|
|
93
|
+
readonly derived: boolean;
|
|
94
|
+
readonly notesHe: string;
|
|
95
|
+
readonly specPage: number;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface RecordDef {
|
|
99
|
+
readonly type: RecordType;
|
|
100
|
+
/** Canonical order within a report (SPEC §3.3). */
|
|
101
|
+
readonly order: number;
|
|
102
|
+
readonly length: number;
|
|
103
|
+
readonly headerLength: number;
|
|
104
|
+
readonly section?: {
|
|
105
|
+
readonly kind: 'codeAmount' | 'countryAmount';
|
|
106
|
+
readonly start: number;
|
|
107
|
+
readonly length: number;
|
|
108
|
+
/** Maximum entries: 1000 → 61 (p.13); 2200 → 10 (p.31); other records → their number of codes. */
|
|
109
|
+
readonly maxEntries: number;
|
|
110
|
+
};
|
|
111
|
+
readonly minOccurs: number;
|
|
112
|
+
readonly maxOccurs: number;
|
|
113
|
+
/** Sorted by position, contiguous from 137 to the end of the header. */
|
|
114
|
+
readonly fields: readonly FieldDef[];
|
|
115
|
+
readonly codes: readonly CodeDef[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface YearLayout {
|
|
119
|
+
readonly taxYear: number;
|
|
120
|
+
readonly records: Readonly<Record<RecordType, RecordDef>>;
|
|
121
|
+
/** Country code (3 digits, or `-88`; see `countryKey`) → Hebrew name (record 2200). */
|
|
122
|
+
readonly countries: ReadonlyMap<string, string>;
|
|
123
|
+
/** Fixed limits of the 1214 file (SPEC §3.1, §3.5–§3.7). */
|
|
124
|
+
readonly limits: {
|
|
125
|
+
/** Reports per OPCN file. */
|
|
126
|
+
readonly reportsPerFile: 50;
|
|
127
|
+
/** Capital-gains appendices (30xx records) per report, all symbols together. */
|
|
128
|
+
readonly capitalGainsAppendices: 14;
|
|
129
|
+
/** Code-amount entries in record 1000. */
|
|
130
|
+
readonly mainCodePairs: 61;
|
|
131
|
+
/** Country entries in one 2200 record. */
|
|
132
|
+
readonly countriesPerRecord: 10;
|
|
133
|
+
};
|
|
134
|
+
}
|