@accounter/opcn1214-generator 0.0.0-bootstrap.0 → 0.0.0-stage
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -336
- package/package.json +3 -74
- package/.bob/cjs/api/generate.d.ts +0 -44
- package/.bob/cjs/api/generate.js +0 -115
- package/.bob/cjs/api/parse.d.ts +0 -28
- package/.bob/cjs/api/parse.js +0 -38
- package/.bob/cjs/api/response.d.ts +0 -24
- package/.bob/cjs/api/response.js +0 -75
- package/.bob/cjs/api/validate.d.ts +0 -16
- package/.bob/cjs/api/validate.js +0 -15
- package/.bob/cjs/codec/boolean.d.ts +0 -7
- package/.bob/cjs/codec/boolean.js +0 -49
- package/.bob/cjs/codec/date.d.ts +0 -6
- package/.bob/cjs/codec/date.js +0 -68
- package/.bob/cjs/codec/enum.d.ts +0 -4
- package/.bob/cjs/codec/enum.js +0 -26
- package/.bob/cjs/codec/numeric.d.ts +0 -56
- package/.bob/cjs/codec/numeric.js +0 -186
- package/.bob/cjs/codec/padding.d.ts +0 -10
- package/.bob/cjs/codec/padding.js +0 -26
- package/.bob/cjs/codec/percent.d.ts +0 -6
- package/.bob/cjs/codec/percent.js +0 -33
- package/.bob/cjs/codec/phone.d.ts +0 -4
- package/.bob/cjs/codec/phone.js +0 -48
- package/.bob/cjs/codec/record.d.ts +0 -18
- package/.bob/cjs/codec/record.js +0 -176
- package/.bob/cjs/codec/registry.d.ts +0 -8
- package/.bob/cjs/codec/registry.js +0 -27
- package/.bob/cjs/codec/sections.d.ts +0 -41
- package/.bob/cjs/codec/sections.js +0 -177
- package/.bob/cjs/codec/text.d.ts +0 -5
- package/.bob/cjs/codec/text.js +0 -29
- package/.bob/cjs/codec/types.d.ts +0 -36
- package/.bob/cjs/codec/types.js +0 -16
- package/.bob/cjs/codec/windows1255.d.ts +0 -9
- package/.bob/cjs/codec/windows1255.js +0 -38
- package/.bob/cjs/errors.d.ts +0 -32
- package/.bob/cjs/errors.js +0 -103
- package/.bob/cjs/file/assemble.d.ts +0 -17
- package/.bob/cjs/file/assemble.js +0 -28
- package/.bob/cjs/file/control.d.ts +0 -13
- package/.bob/cjs/file/control.js +0 -45
- package/.bob/cjs/file/parse.d.ts +0 -18
- package/.bob/cjs/file/parse.js +0 -478
- package/.bob/cjs/file/split.d.ts +0 -17
- package/.bob/cjs/file/split.js +0 -71
- package/.bob/cjs/index.d.ts +0 -16
- package/.bob/cjs/index.js +0 -28
- package/.bob/cjs/layout/2024/layout.generated.d.ts +0 -6919
- package/.bob/cjs/layout/2024/layout.generated.js +0 -7224
- package/.bob/cjs/layout/2025/index.d.ts +0 -6
- package/.bob/cjs/layout/2025/index.js +0 -10
- package/.bob/cjs/layout/capital-gains.d.ts +0 -9
- package/.bob/cjs/layout/capital-gains.js +0 -15
- package/.bob/cjs/layout/countries.d.ts +0 -5
- package/.bob/cjs/layout/countries.js +0 -10
- package/.bob/cjs/layout/freeze.d.ts +0 -5
- package/.bob/cjs/layout/freeze.js +0 -16
- package/.bob/cjs/layout/registry.d.ts +0 -10
- package/.bob/cjs/layout/registry.js +0 -32
- package/.bob/cjs/layout/types.d.ts +0 -82
- package/.bob/cjs/layout/types.js +0 -35
- package/.bob/cjs/model/codes.generated.d.ts +0 -48
- package/.bob/cjs/model/codes.generated.js +0 -628
- package/.bob/cjs/model/index.d.ts +0 -3
- package/.bob/cjs/model/index.js +0 -5
- package/.bob/cjs/model/input.d.ts +0 -543
- package/.bob/cjs/model/input.js +0 -24
- package/.bob/cjs/model/normalized.d.ts +0 -43
- package/.bob/cjs/model/normalized.js +0 -0
- package/.bob/cjs/model/options.d.ts +0 -14
- package/.bob/cjs/model/options.js +0 -0
- package/.bob/cjs/model/schema.d.ts +0 -594
- package/.bob/cjs/model/schema.js +0 -339
- package/.bob/cjs/normalize/canonical.d.ts +0 -13
- package/.bob/cjs/normalize/canonical.js +0 -288
- package/.bob/cjs/normalize/capital-gains/assets.d.ts +0 -37
- package/.bob/cjs/normalize/capital-gains/assets.js +0 -94
- package/.bob/cjs/normalize/capital-gains/index.d.ts +0 -61
- package/.bob/cjs/normalize/capital-gains/index.js +0 -149
- package/.bob/cjs/normalize/capital-gains/no-withholding.d.ts +0 -18
- package/.bob/cjs/normalize/capital-gains/no-withholding.js +0 -36
- package/.bob/cjs/normalize/capital-gains/other.d.ts +0 -54
- package/.bob/cjs/normalize/capital-gains/other.js +0 -122
- package/.bob/cjs/normalize/capital-gains/section6.d.ts +0 -7
- package/.bob/cjs/normalize/capital-gains/section6.js +0 -13
- package/.bob/cjs/normalize/capital-gains/securities.d.ts +0 -26
- package/.bob/cjs/normalize/capital-gains/securities.js +0 -58
- package/.bob/cjs/normalize/denormalize.d.ts +0 -42
- package/.bob/cjs/normalize/denormalize.js +0 -359
- package/.bob/cjs/normalize/derive.d.ts +0 -57
- package/.bob/cjs/normalize/derive.js +0 -111
- package/.bob/cjs/normalize/enums.d.ts +0 -58
- package/.bob/cjs/normalize/enums.js +0 -69
- package/.bob/cjs/normalize/fields.d.ts +0 -28
- package/.bob/cjs/normalize/fields.js +0 -86
- package/.bob/cjs/normalize/foreign.d.ts +0 -22
- package/.bob/cjs/normalize/foreign.js +0 -85
- package/.bob/cjs/normalize/main.d.ts +0 -24
- package/.bob/cjs/normalize/main.js +0 -208
- package/.bob/cjs/normalize/paths.d.ts +0 -74
- package/.bob/cjs/normalize/paths.js +0 -169
- package/.bob/cjs/normalize/phone.d.ts +0 -12
- package/.bob/cjs/normalize/phone.js +0 -35
- package/.bob/cjs/normalize/rd-investments.d.ts +0 -10
- package/.bob/cjs/normalize/rd-investments.js +0 -25
- package/.bob/cjs/normalize/related-companies.d.ts +0 -10
- package/.bob/cjs/normalize/related-companies.js +0 -25
- package/.bob/cjs/normalize/report.d.ts +0 -9
- package/.bob/cjs/normalize/report.js +0 -53
- package/.bob/cjs/normalize/shareholders.d.ts +0 -10
- package/.bob/cjs/normalize/shareholders.js +0 -30
- package/.bob/cjs/normalize/text.d.ts +0 -11
- package/.bob/cjs/normalize/text.js +0 -41
- package/.bob/cjs/normalize/today.d.ts +0 -4
- package/.bob/cjs/normalize/today.js +0 -14
- package/.bob/cjs/pipeline.d.ts +0 -13
- package/.bob/cjs/pipeline.js +0 -37
- package/.bob/cjs/response/codes.d.ts +0 -2
- package/.bob/cjs/response/codes.js +0 -31
- package/.bob/cjs/validate/capital-gains-rules.d.ts +0 -6
- package/.bob/cjs/validate/capital-gains-rules.js +0 -162
- package/.bob/cjs/validate/check-digit.d.ts +0 -10
- package/.bob/cjs/validate/check-digit.js +0 -26
- package/.bob/cjs/validate/engine.d.ts +0 -5
- package/.bob/cjs/validate/engine.js +0 -35
- package/.bob/cjs/validate/field-rules.d.ts +0 -4
- package/.bob/cjs/validate/field-rules.js +0 -331
- package/.bob/cjs/validate/foreign-rules.d.ts +0 -6
- package/.bob/cjs/validate/foreign-rules.js +0 -171
- package/.bob/cjs/validate/issue.d.ts +0 -51
- package/.bob/cjs/validate/issue.js +0 -78
- package/.bob/cjs/validate/main-rules.d.ts +0 -24
- package/.bob/cjs/validate/main-rules.js +0 -425
- package/.bob/cjs/validate/parse-rules.d.ts +0 -31
- package/.bob/cjs/validate/parse-rules.js +0 -114
- package/.bob/cjs/validate/rules.d.ts +0 -746
- package/.bob/cjs/validate/rules.js +0 -680
- package/.bob/cjs/validate/shape.d.ts +0 -19
- package/.bob/cjs/validate/shape.js +0 -231
- package/.bob/cjs/validate/shareholder-rules.d.ts +0 -6
- package/.bob/cjs/validate/shareholder-rules.js +0 -83
- package/.bob/cjs/validate/structure-rules.d.ts +0 -26
- package/.bob/cjs/validate/structure-rules.js +0 -130
- package/.bob/esm/api/generate.d.ts +0 -44
- package/.bob/esm/api/generate.js +0 -111
- package/.bob/esm/api/parse.d.ts +0 -28
- package/.bob/esm/api/parse.js +0 -34
- package/.bob/esm/api/response.d.ts +0 -24
- package/.bob/esm/api/response.js +0 -72
- package/.bob/esm/api/validate.d.ts +0 -16
- package/.bob/esm/api/validate.js +0 -11
- package/.bob/esm/codec/boolean.d.ts +0 -7
- package/.bob/esm/codec/boolean.js +0 -46
- package/.bob/esm/codec/date.d.ts +0 -6
- package/.bob/esm/codec/date.js +0 -64
- package/.bob/esm/codec/enum.d.ts +0 -4
- package/.bob/esm/codec/enum.js +0 -23
- package/.bob/esm/codec/numeric.d.ts +0 -56
- package/.bob/esm/codec/numeric.js +0 -175
- package/.bob/esm/codec/padding.d.ts +0 -10
- package/.bob/esm/codec/padding.js +0 -21
- package/.bob/esm/codec/percent.d.ts +0 -6
- package/.bob/esm/codec/percent.js +0 -30
- package/.bob/esm/codec/phone.d.ts +0 -4
- package/.bob/esm/codec/phone.js +0 -45
- package/.bob/esm/codec/record.d.ts +0 -18
- package/.bob/esm/codec/record.js +0 -172
- package/.bob/esm/codec/registry.d.ts +0 -8
- package/.bob/esm/codec/registry.js +0 -23
- package/.bob/esm/codec/sections.d.ts +0 -41
- package/.bob/esm/codec/sections.js +0 -170
- package/.bob/esm/codec/text.d.ts +0 -5
- package/.bob/esm/codec/text.js +0 -26
- package/.bob/esm/codec/types.d.ts +0 -36
- package/.bob/esm/codec/types.js +0 -12
- package/.bob/esm/codec/windows1255.d.ts +0 -9
- package/.bob/esm/codec/windows1255.js +0 -32
- package/.bob/esm/errors.d.ts +0 -32
- package/.bob/esm/errors.js +0 -94
- package/.bob/esm/file/assemble.d.ts +0 -17
- package/.bob/esm/file/assemble.js +0 -25
- package/.bob/esm/file/control.d.ts +0 -13
- package/.bob/esm/file/control.js +0 -41
- package/.bob/esm/file/parse.d.ts +0 -18
- package/.bob/esm/file/parse.js +0 -474
- package/.bob/esm/file/split.d.ts +0 -17
- package/.bob/esm/file/split.js +0 -68
- package/.bob/esm/index.d.ts +0 -16
- package/.bob/esm/index.js +0 -11
- package/.bob/esm/layout/2024/layout.generated.d.ts +0 -6919
- package/.bob/esm/layout/2024/layout.generated.js +0 -7221
- package/.bob/esm/layout/2025/index.d.ts +0 -6
- package/.bob/esm/layout/2025/index.js +0 -7
- package/.bob/esm/layout/capital-gains.d.ts +0 -9
- package/.bob/esm/layout/capital-gains.js +0 -11
- package/.bob/esm/layout/countries.d.ts +0 -5
- package/.bob/esm/layout/countries.js +0 -7
- package/.bob/esm/layout/freeze.d.ts +0 -5
- package/.bob/esm/layout/freeze.js +0 -13
- package/.bob/esm/layout/registry.d.ts +0 -10
- package/.bob/esm/layout/registry.js +0 -27
- package/.bob/esm/layout/types.d.ts +0 -82
- package/.bob/esm/layout/types.js +0 -32
- package/.bob/esm/model/codes.generated.d.ts +0 -48
- package/.bob/esm/model/codes.generated.js +0 -625
- package/.bob/esm/model/index.d.ts +0 -3
- package/.bob/esm/model/index.js +0 -2
- package/.bob/esm/model/input.d.ts +0 -543
- package/.bob/esm/model/input.js +0 -21
- package/.bob/esm/model/normalized.d.ts +0 -43
- package/.bob/esm/model/normalized.js +0 -0
- package/.bob/esm/model/options.d.ts +0 -14
- package/.bob/esm/model/options.js +0 -0
- package/.bob/esm/model/schema.d.ts +0 -594
- package/.bob/esm/model/schema.js +0 -335
- package/.bob/esm/normalize/canonical.d.ts +0 -13
- package/.bob/esm/normalize/canonical.js +0 -285
- package/.bob/esm/normalize/capital-gains/assets.d.ts +0 -37
- package/.bob/esm/normalize/capital-gains/assets.js +0 -87
- package/.bob/esm/normalize/capital-gains/index.d.ts +0 -61
- package/.bob/esm/normalize/capital-gains/index.js +0 -142
- package/.bob/esm/normalize/capital-gains/no-withholding.d.ts +0 -18
- package/.bob/esm/normalize/capital-gains/no-withholding.js +0 -31
- package/.bob/esm/normalize/capital-gains/other.d.ts +0 -54
- package/.bob/esm/normalize/capital-gains/other.js +0 -112
- package/.bob/esm/normalize/capital-gains/section6.d.ts +0 -7
- package/.bob/esm/normalize/capital-gains/section6.js +0 -9
- package/.bob/esm/normalize/capital-gains/securities.d.ts +0 -26
- package/.bob/esm/normalize/capital-gains/securities.js +0 -52
- package/.bob/esm/normalize/denormalize.d.ts +0 -42
- package/.bob/esm/normalize/denormalize.js +0 -354
- package/.bob/esm/normalize/derive.d.ts +0 -57
- package/.bob/esm/normalize/derive.js +0 -99
- package/.bob/esm/normalize/enums.d.ts +0 -58
- package/.bob/esm/normalize/enums.js +0 -64
- package/.bob/esm/normalize/fields.d.ts +0 -28
- package/.bob/esm/normalize/fields.js +0 -81
- package/.bob/esm/normalize/foreign.d.ts +0 -22
- package/.bob/esm/normalize/foreign.js +0 -81
- package/.bob/esm/normalize/main.d.ts +0 -24
- package/.bob/esm/normalize/main.js +0 -204
- package/.bob/esm/normalize/paths.d.ts +0 -74
- package/.bob/esm/normalize/paths.js +0 -161
- package/.bob/esm/normalize/phone.d.ts +0 -12
- package/.bob/esm/normalize/phone.js +0 -32
- package/.bob/esm/normalize/rd-investments.d.ts +0 -10
- package/.bob/esm/normalize/rd-investments.js +0 -22
- package/.bob/esm/normalize/related-companies.d.ts +0 -10
- package/.bob/esm/normalize/related-companies.js +0 -22
- package/.bob/esm/normalize/report.d.ts +0 -9
- package/.bob/esm/normalize/report.js +0 -50
- package/.bob/esm/normalize/shareholders.d.ts +0 -10
- package/.bob/esm/normalize/shareholders.js +0 -27
- package/.bob/esm/normalize/text.d.ts +0 -11
- package/.bob/esm/normalize/text.js +0 -37
- package/.bob/esm/normalize/today.d.ts +0 -4
- package/.bob/esm/normalize/today.js +0 -11
- package/.bob/esm/pipeline.d.ts +0 -13
- package/.bob/esm/pipeline.js +0 -34
- package/.bob/esm/response/codes.d.ts +0 -2
- package/.bob/esm/response/codes.js +0 -28
- package/.bob/esm/validate/capital-gains-rules.d.ts +0 -6
- package/.bob/esm/validate/capital-gains-rules.js +0 -159
- package/.bob/esm/validate/check-digit.d.ts +0 -10
- package/.bob/esm/validate/check-digit.js +0 -23
- package/.bob/esm/validate/engine.d.ts +0 -5
- package/.bob/esm/validate/engine.js +0 -32
- package/.bob/esm/validate/field-rules.d.ts +0 -4
- package/.bob/esm/validate/field-rules.js +0 -328
- package/.bob/esm/validate/foreign-rules.d.ts +0 -6
- package/.bob/esm/validate/foreign-rules.js +0 -168
- package/.bob/esm/validate/issue.d.ts +0 -51
- package/.bob/esm/validate/issue.js +0 -72
- package/.bob/esm/validate/main-rules.d.ts +0 -24
- package/.bob/esm/validate/main-rules.js +0 -420
- package/.bob/esm/validate/parse-rules.d.ts +0 -31
- package/.bob/esm/validate/parse-rules.js +0 -110
- package/.bob/esm/validate/rules.d.ts +0 -746
- package/.bob/esm/validate/rules.js +0 -676
- package/.bob/esm/validate/shape.d.ts +0 -19
- package/.bob/esm/validate/shape.js +0 -227
- package/.bob/esm/validate/shareholder-rules.d.ts +0 -6
- package/.bob/esm/validate/shareholder-rules.js +0 -80
- package/.bob/esm/validate/structure-rules.d.ts +0 -26
- package/.bob/esm/validate/structure-rules.js +0 -122
- package/.bob/tsconfig.tsbuildinfo +0 -1
- package/.gitattributes +0 -1
- package/CLAUDE.md +0 -39
- package/dist/cjs/index.js +0 -28
- package/dist/esm/index.js +0 -11
- package/documentation/IMPLEMENTATION_PLAN.md +0 -2258
- package/documentation/SPEC.md +0 -1803
- package/documentation/layout/2024/codes.csv +0 -261
- package/documentation/layout/2024/countries.csv +0 -256
- package/documentation/layout/2024/fields.csv +0 -271
- package/documentation/layout/2024/records.csv +0 -18
- package/documentation/layout/README.md +0 -87
- package/documentation/specifications/1214-2024.pdf +0 -0
- package/documentation/tools/extract_layout.py +0 -191
- package/scripts/generate-layout.ts +0 -23
- package/scripts/layout/csv.ts +0 -111
- package/scripts/layout/derived-codes.ts +0 -12
- package/scripts/layout/render.ts +0 -364
- package/scripts/layout/sources.ts +0 -51
- package/scripts/layout/values.ts +0 -42
- package/scripts/render-rules-table.ts +0 -66
- package/src/api/generate.ts +0 -169
- package/src/api/parse.ts +0 -58
- package/src/api/response.ts +0 -110
- package/src/api/validate.ts +0 -26
- package/src/codec/boolean.ts +0 -62
- package/src/codec/date.ts +0 -75
- package/src/codec/enum.ts +0 -28
- package/src/codec/numeric.ts +0 -208
- package/src/codec/padding.ts +0 -33
- package/src/codec/percent.ts +0 -35
- package/src/codec/phone.ts +0 -54
- package/src/codec/record.ts +0 -206
- package/src/codec/registry.ts +0 -27
- package/src/codec/sections.ts +0 -208
- package/src/codec/text.ts +0 -31
- package/src/codec/types.ts +0 -47
- package/src/codec/windows1255.ts +0 -38
- package/src/errors.ts +0 -114
- package/src/file/assemble.ts +0 -42
- package/src/file/control.ts +0 -59
- package/src/file/parse.ts +0 -620
- package/src/file/split.ts +0 -86
- package/src/index.ts +0 -70
- package/src/layout/2024/layout.generated.ts +0 -7238
- package/src/layout/2025/index.ts +0 -9
- package/src/layout/capital-gains.ts +0 -20
- package/src/layout/countries.ts +0 -7
- package/src/layout/freeze.ts +0 -13
- package/src/layout/registry.ts +0 -33
- package/src/layout/types.ts +0 -134
- package/src/model/codes.generated.ts +0 -1190
- package/src/model/index.ts +0 -4
- package/src/model/input.ts +0 -594
- package/src/model/normalized.ts +0 -38
- package/src/model/options.ts +0 -17
- package/src/model/schema.ts +0 -381
- package/src/normalize/canonical.ts +0 -374
- package/src/normalize/capital-gains/assets.ts +0 -112
- package/src/normalize/capital-gains/index.ts +0 -212
- package/src/normalize/capital-gains/no-withholding.ts +0 -46
- package/src/normalize/capital-gains/other.ts +0 -153
- package/src/normalize/capital-gains/section6.ts +0 -14
- package/src/normalize/capital-gains/securities.ts +0 -73
- package/src/normalize/denormalize.ts +0 -426
- package/src/normalize/derive.ts +0 -136
- package/src/normalize/enums.ts +0 -87
- package/src/normalize/fields.ts +0 -110
- package/src/normalize/foreign.ts +0 -114
- package/src/normalize/main.ts +0 -284
- package/src/normalize/paths.ts +0 -184
- package/src/normalize/phone.ts +0 -45
- package/src/normalize/rd-investments.ts +0 -38
- package/src/normalize/related-companies.ts +0 -37
- package/src/normalize/report.ts +0 -59
- package/src/normalize/shareholders.ts +0 -42
- package/src/normalize/text.ts +0 -40
- package/src/normalize/today.ts +0 -15
- package/src/pipeline.ts +0 -42
- package/src/response/codes.ts +0 -30
- package/src/validate/capital-gains-rules.ts +0 -199
- package/src/validate/check-digit.ts +0 -25
- package/src/validate/engine.ts +0 -45
- package/src/validate/field-rules.ts +0 -383
- package/src/validate/foreign-rules.ts +0 -274
- package/src/validate/issue.ts +0 -121
- package/src/validate/main-rules.ts +0 -678
- package/src/validate/parse-rules.ts +0 -169
- package/src/validate/rules.ts +0 -747
- package/src/validate/shape.ts +0 -278
- package/src/validate/shareholder-rules.ts +0 -92
- package/src/validate/structure-rules.ts +0 -136
- package/tests/api/batch.test.ts +0 -227
- package/tests/api/exports.test.ts +0 -355
- package/tests/api/generate.test.ts +0 -409
- package/tests/api/parse.test.ts +0 -789
- package/tests/api/response.test.ts +0 -152
- package/tests/api/validate.test.ts +0 -86
- package/tests/codec/numeric.test.ts +0 -325
- package/tests/codec/record.test.ts +0 -318
- package/tests/codec/registry.test.ts +0 -17
- package/tests/codec/sections.test.ts +0 -333
- package/tests/codec/text.test.ts +0 -454
- package/tests/codec/windows1255.test.ts +0 -46
- package/tests/docs/readme.test.ts +0 -69
- package/tests/edge-cases.test.ts +0 -359
- package/tests/errors.test.ts +0 -138
- package/tests/file/assemble.test.ts +0 -188
- package/tests/file/split.test.ts +0 -61
- package/tests/fixtures/builders.ts +0 -512
- package/tests/fixtures/files.ts +0 -78
- package/tests/fixtures/golden/README.md +0 -37
- package/tests/fixtures/golden/VERIFICATION.md +0 -72
- package/tests/fixtures/golden/batch-50.input.ts +0 -92
- package/tests/fixtures/golden/batch-50.opcn +0 -150
- package/tests/fixtures/golden/capital-gains-max.input.ts +0 -177
- package/tests/fixtures/golden/capital-gains-max.opcn +0 -17
- package/tests/fixtures/golden/cg-27.input.ts +0 -63
- package/tests/fixtures/golden/cg-27.opcn +0 -4
- package/tests/fixtures/golden/cg-50.input.ts +0 -59
- package/tests/fixtures/golden/cg-50.opcn +0 -4
- package/tests/fixtures/golden/cg-51.input.ts +0 -60
- package/tests/fixtures/golden/cg-51.opcn +0 -4
- package/tests/fixtures/golden/cg-54.input.ts +0 -53
- package/tests/fixtures/golden/cg-54.opcn +0 -4
- package/tests/fixtures/golden/cg-60.input.ts +0 -77
- package/tests/fixtures/golden/cg-60.opcn +0 -4
- package/tests/fixtures/golden/cg-63.input.ts +0 -51
- package/tests/fixtures/golden/cg-63.opcn +0 -4
- package/tests/fixtures/golden/cg-64.input.ts +0 -62
- package/tests/fixtures/golden/cg-64.opcn +0 -4
- package/tests/fixtures/golden/cg-65.input.ts +0 -79
- package/tests/fixtures/golden/cg-65.opcn +0 -4
- package/tests/fixtures/golden/cg-66.input.ts +0 -53
- package/tests/fixtures/golden/cg-66.opcn +0 -4
- package/tests/fixtures/golden/cg-77.input.ts +0 -109
- package/tests/fixtures/golden/cg-77.opcn +0 -4
- package/tests/fixtures/golden/foreign.input.ts +0 -202
- package/tests/fixtures/golden/foreign.opcn +0 -27
- package/tests/fixtures/golden/hebrew-edge.input.ts +0 -90
- package/tests/fixtures/golden/hebrew-edge.opcn +0 -8
- package/tests/fixtures/golden/kibbutz.input.ts +0 -31
- package/tests/fixtures/golden/kibbutz.opcn +0 -2
- package/tests/fixtures/golden/main-full.input.ts +0 -780
- package/tests/fixtures/golden/main-full.opcn +0 -101
- package/tests/fixtures/golden/minimal.input.ts +0 -37
- package/tests/fixtures/golden/minimal.opcn +0 -3
- package/tests/fixtures/golden/related-and-rd.input.ts +0 -59
- package/tests/fixtures/golden/related-and-rd.opcn +0 -11
- package/tests/fixtures/random.ts +0 -843
- package/tests/golden/fixtures.test.ts +0 -627
- package/tests/golden/golden.test.ts +0 -95
- package/tests/helpers/coverage.ts +0 -18
- package/tests/helpers/sample-values.ts +0 -114
- package/tests/layout/codegen-sync.test.ts +0 -19
- package/tests/layout/integrity.test.ts +0 -232
- package/tests/layout/registry.test.ts +0 -98
- package/tests/model/code-unions.test.ts +0 -91
- package/tests/model/schema.test.ts +0 -1031
- package/tests/normalize/canonical.test.ts +0 -728
- package/tests/normalize/capital-gains.test.ts +0 -1850
- package/tests/normalize/coverage.test.ts +0 -88
- package/tests/normalize/denormalize.test.ts +0 -318
- package/tests/normalize/enums.test.ts +0 -118
- package/tests/normalize/foreign.test.ts +0 -273
- package/tests/normalize/main.test.ts +0 -839
- package/tests/normalize/paths.test.ts +0 -257
- package/tests/normalize/rd-investments.test.ts +0 -99
- package/tests/normalize/related-companies.test.ts +0 -106
- package/tests/normalize/shareholders.test.ts +0 -117
- package/tests/normalize/text.test.ts +0 -86
- package/tests/pipeline.test.ts +0 -96
- package/tests/roundtrip/determinism.test.ts +0 -207
- package/tests/roundtrip/property.test.ts +0 -126
- package/tests/roundtrip/roundtrip.test.ts +0 -573
- package/tests/rules/cases.ts +0 -873
- package/tests/rules/rules.test.ts +0 -69
- package/tests/rules/spec-sync.test.ts +0 -80
- package/tests/scripts/csv.test.ts +0 -78
- package/tests/scripts/values.test.ts +0 -80
- package/tests/validate/capital-gains-rules.test.ts +0 -307
- package/tests/validate/check-digit.test.ts +0 -42
- package/tests/validate/field-rules.test.ts +0 -867
- package/tests/validate/foreign-rules.test.ts +0 -255
- package/tests/validate/issue.test.ts +0 -96
- package/tests/validate/main-rules.test.ts +0 -761
- package/tests/validate/parse-rules.test.ts +0 -293
- package/tests/validate/shareholder-rules.test.ts +0 -143
- package/tsconfig.json +0 -10
- package/tsconfig.typecheck.json +0 -9
- package/vitest.config.ts +0 -11
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Golden files (SPEC §13.5): every tests/fixtures/golden/<name>.input.ts generates exactly the
|
|
3
|
-
* committed <name>.opcn, whose sha256 is recorded in VERIFICATION.md: with generate1214 when it
|
|
4
|
-
* exports `input`, with generate1214Batch when it exports `inputs` (a batch). UPDATE_GOLDEN=1
|
|
5
|
-
* rewrites the .opcn files instead (see tests/fixtures/golden/README.md).
|
|
6
|
-
*/
|
|
7
|
-
import { createHash } from 'node:crypto';
|
|
8
|
-
import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
9
|
-
import {
|
|
10
|
-
generate1214,
|
|
11
|
-
generate1214Batch,
|
|
12
|
-
validate1214,
|
|
13
|
-
type GenerateOptions,
|
|
14
|
-
type Report1214Input,
|
|
15
|
-
} from '../../src/index.js';
|
|
16
|
-
|
|
17
|
-
const GOLDEN_DIR = new URL('../fixtures/golden/', import.meta.url);
|
|
18
|
-
const INPUT_SUFFIX = '.input.ts';
|
|
19
|
-
const UPDATE = process.env['UPDATE_GOLDEN'] === '1';
|
|
20
|
-
|
|
21
|
-
/** A golden input module: one report (`input`) or a batch (`inputs`). */
|
|
22
|
-
type GoldenFixture = { options: GenerateOptions } & (
|
|
23
|
-
{ input: Report1214Input; inputs?: undefined } | { inputs: Report1214Input[]; input?: undefined }
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
async function loadFixture(name: string): Promise<GoldenFixture> {
|
|
27
|
-
return (await import(new URL(`${name}${INPUT_SUFFIX}`, GOLDEN_DIR).href)) as GoldenFixture;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** The reports of a fixture, in file order. */
|
|
31
|
-
function reportsOf(fixture: GoldenFixture): Report1214Input[] {
|
|
32
|
-
return fixture.inputs ?? [fixture.input];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** The bytes the generator writes for a fixture. */
|
|
36
|
-
function generateFixture(fixture: GoldenFixture): Uint8Array {
|
|
37
|
-
return fixture.inputs
|
|
38
|
-
? generate1214Batch(fixture.inputs, fixture.options).bytes
|
|
39
|
-
: generate1214(fixture.input, fixture.options).bytes;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const fixtureNames = readdirSync(GOLDEN_DIR)
|
|
43
|
-
.filter(file => file.endsWith(INPUT_SUFFIX))
|
|
44
|
-
.map(file => file.slice(0, -INPUT_SUFFIX.length))
|
|
45
|
-
.sort();
|
|
46
|
-
|
|
47
|
-
function sha256(bytes: Uint8Array): string {
|
|
48
|
-
return createHash('sha256').update(bytes).digest('hex');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** Fixture name → sha256, from the table of VERIFICATION.md. */
|
|
52
|
-
function verifiedHashes(): Map<string, string> {
|
|
53
|
-
const table = readFileSync(new URL('VERIFICATION.md', GOLDEN_DIR), 'utf8');
|
|
54
|
-
const hashes = new Map<string, string>();
|
|
55
|
-
for (const line of table.split('\n')) {
|
|
56
|
-
const cells = line
|
|
57
|
-
.split('|')
|
|
58
|
-
.slice(1, -1)
|
|
59
|
-
.map(cell => cell.trim().replaceAll('`', ''));
|
|
60
|
-
const [fixture, hash] = cells;
|
|
61
|
-
if (cells.length === 5 && fixture && hash && /^[0-9a-f]{64}$/.test(hash)) {
|
|
62
|
-
hashes.set(fixture, hash);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return hashes;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
describe('golden files', () => {
|
|
69
|
-
it('has at least one fixture, each listed in VERIFICATION.md, and no orphan rows', () => {
|
|
70
|
-
expect(fixtureNames.length).toBeGreaterThan(0);
|
|
71
|
-
expect([...verifiedHashes().keys()].sort()).toEqual(fixtureNames);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it.each(fixtureNames)('%s input validates with zero errors', async name => {
|
|
75
|
-
const fixture = await loadFixture(name);
|
|
76
|
-
for (const input of reportsOf(fixture)) {
|
|
77
|
-
expect(validate1214(input, fixture.options).errors).toEqual([]);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it.each(fixtureNames)('%s.opcn is generated byte for byte', async name => {
|
|
82
|
-
const fixture = await loadFixture(name);
|
|
83
|
-
const goldenUrl = new URL(`${name}.opcn`, GOLDEN_DIR);
|
|
84
|
-
const bytes = generateFixture(fixture);
|
|
85
|
-
if (UPDATE) {
|
|
86
|
-
writeFileSync(goldenUrl, bytes);
|
|
87
|
-
}
|
|
88
|
-
expect(existsSync(goldenUrl), `${name}.opcn is missing: run with UPDATE_GOLDEN=1`).toBe(true);
|
|
89
|
-
const golden = new Uint8Array(readFileSync(goldenUrl));
|
|
90
|
-
expect(Buffer.from(bytes).equals(Buffer.from(golden)), `${name}.opcn differs`).toBe(true);
|
|
91
|
-
expect(sha256(golden), `sha256 of ${name}.opcn vs VERIFICATION.md`).toBe(
|
|
92
|
-
verifiedHashes().get(name),
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalizer coverage (SPEC §13.3): which header keys of a record type the normalizer never
|
|
3
|
-
* produced a value for.
|
|
4
|
-
*/
|
|
5
|
-
import type { RecordDef } from '../../src/layout/types.js';
|
|
6
|
-
import type { NormalizedRecord } from '../../src/model/normalized.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The non-filler header keys of `def`, in position order, that have no value in any of the
|
|
10
|
-
* `records` of its type.
|
|
11
|
-
*/
|
|
12
|
-
export function unmappedHeaderKeys(def: RecordDef, records: readonly NormalizedRecord[]): string[] {
|
|
13
|
-
const own = records.filter(record => record.recordType === def.type);
|
|
14
|
-
return def.fields
|
|
15
|
-
.filter(field => field.kind !== 'filler')
|
|
16
|
-
.map(field => field.key)
|
|
17
|
-
.filter(key => own.every(record => record.values[key] === undefined));
|
|
18
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sample model values for the record codec tests: a valid, width-fitting, non-zero value for every
|
|
3
|
-
* field and code kind, so any record of any layout can be encoded and decoded.
|
|
4
|
-
*/
|
|
5
|
-
import type { Primitive } from '../../src/codec/types.js';
|
|
6
|
-
import type { CodeDef, FieldDef, FieldKind, RecordDef } from '../../src/layout/types.js';
|
|
7
|
-
import type { NormalizedRecord } from '../../src/model/normalized.js';
|
|
8
|
-
|
|
9
|
-
const DIGITS = '123456789012';
|
|
10
|
-
/** Starts with a Hebrew letter (alef, bet, gimel). */
|
|
11
|
-
const HEBREW = '\u05d0\u05d1\u05d2';
|
|
12
|
-
|
|
13
|
-
/** A non-zero digit string of exactly `width` digits (width ≤ 12). */
|
|
14
|
-
function digitsOf(width: number): string {
|
|
15
|
-
return DIGITS.slice(0, width);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function firstAllowed(def: FieldDef | CodeDef): number {
|
|
19
|
-
const first = def.values?.[0];
|
|
20
|
-
if (!first) {
|
|
21
|
-
throw new Error(`${def.record}: no allowed values for a ${def.kind}`);
|
|
22
|
-
}
|
|
23
|
-
return first.value;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const FIELD_SAMPLES: { [K in Exclude<FieldKind, 'filler'>]: (field: FieldDef) => Primitive } = {
|
|
27
|
-
text: field => `t${field.position}`,
|
|
28
|
-
hebrewText: () => HEBREW,
|
|
29
|
-
id9: () => '012345674',
|
|
30
|
-
shareholderId: () => '123456782',
|
|
31
|
-
digits: field => digitsOf(field.length),
|
|
32
|
-
year: () => 2024,
|
|
33
|
-
num: () => 7,
|
|
34
|
-
count: () => 3,
|
|
35
|
-
serial: () => 1,
|
|
36
|
-
const: firstAllowed,
|
|
37
|
-
foreignCode: () => 10,
|
|
38
|
-
amount: field => Number(digitsOf(Math.min(field.length, 9))),
|
|
39
|
-
amountX: () => 4321,
|
|
40
|
-
amountX100: () => 1234.56,
|
|
41
|
-
rateX100: firstAllowed,
|
|
42
|
-
percentX100: () => 10.23,
|
|
43
|
-
percentLiteral: () => 5.5,
|
|
44
|
-
date: () => '2024-12-31',
|
|
45
|
-
flag: () => true,
|
|
46
|
-
yesNo: () => true,
|
|
47
|
-
enum: firstAllowed,
|
|
48
|
-
phonePrefix: () => '052',
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/** The sample value of a header field; undefined for fillers (never stored). */
|
|
52
|
-
export function sampleFieldValue(field: FieldDef): Primitive {
|
|
53
|
-
return field.kind === 'filler' ? undefined : FIELD_SAMPLES[field.kind](field);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** The sample value of a code-amount code, in natural units. */
|
|
57
|
-
export function sampleCodeValue(code: CodeDef): number {
|
|
58
|
-
switch (code.kind) {
|
|
59
|
-
case 'amount':
|
|
60
|
-
case 'num':
|
|
61
|
-
return Number(digitsOf(Math.min(code.length, 9)));
|
|
62
|
-
case 'amountX100':
|
|
63
|
-
return 1234.56;
|
|
64
|
-
case 'rateX100':
|
|
65
|
-
case 'enum':
|
|
66
|
-
return firstAllowed(code);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** Codes of the sample: the first code of every kind the record has, then more up to three. */
|
|
71
|
-
function sampleCodes(def: RecordDef): Map<string, number> {
|
|
72
|
-
const picked: CodeDef[] = [];
|
|
73
|
-
for (const code of def.codes) {
|
|
74
|
-
if (!picked.some(other => other.kind === code.kind)) {
|
|
75
|
-
picked.push(code);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
for (const code of def.codes) {
|
|
79
|
-
if (picked.length >= 3) {
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
if (!picked.includes(code)) {
|
|
83
|
-
picked.push(code);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return new Map(picked.map(code => [code.code, sampleCodeValue(code)]));
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* A record with a sample value for every non-filler field; for code-amount records the codes of
|
|
91
|
-
* sampleCodes, for 2200 two countries (country keys as the decoder returns them).
|
|
92
|
-
*/
|
|
93
|
-
export function sampleRecord(def: RecordDef): NormalizedRecord {
|
|
94
|
-
const values: Record<string, Primitive> = {};
|
|
95
|
-
for (const field of def.fields) {
|
|
96
|
-
if (field.kind !== 'filler') {
|
|
97
|
-
values[field.key] = sampleFieldValue(field);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return {
|
|
101
|
-
recordType: def.type,
|
|
102
|
-
index: 0,
|
|
103
|
-
values,
|
|
104
|
-
codes: def.section?.kind === 'codeAmount' ? sampleCodes(def) : new Map(),
|
|
105
|
-
countries:
|
|
106
|
-
def.section?.kind === 'countryAmount'
|
|
107
|
-
? [
|
|
108
|
-
{ country: '040', income: 1234 },
|
|
109
|
-
{ country: '-88', income: 567_890 },
|
|
110
|
-
]
|
|
111
|
-
: [],
|
|
112
|
-
paths: {},
|
|
113
|
-
};
|
|
114
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { renderCodesModule, renderLayoutModule } from '../../scripts/layout/render.js';
|
|
3
|
-
import { latestLayoutYear, readLayoutSources } from '../../scripts/layout/sources.js';
|
|
4
|
-
|
|
5
|
-
const committed = (path: string) => readFileSync(new URL(path, import.meta.url), 'utf8');
|
|
6
|
-
|
|
7
|
-
describe('generated layout modules', () => {
|
|
8
|
-
it('src/layout/2024/layout.generated.ts is in sync with documentation/layout/2024/*.csv', async () => {
|
|
9
|
-
const rendered = await renderLayoutModule(2024, readLayoutSources(2024));
|
|
10
|
-
expect(rendered).toBe(committed('../../src/layout/2024/layout.generated.ts'));
|
|
11
|
-
}, 30_000);
|
|
12
|
-
|
|
13
|
-
it('src/model/codes.generated.ts is in sync with the newest layout', async () => {
|
|
14
|
-
const year = latestLayoutYear();
|
|
15
|
-
expect(year).toBe(2024);
|
|
16
|
-
const rendered = await renderCodesModule(year, readLayoutSources(year));
|
|
17
|
-
expect(rendered).toBe(committed('../../src/model/codes.generated.ts'));
|
|
18
|
-
}, 30_000);
|
|
19
|
-
});
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { parseCsvRecords } from '../../scripts/layout/csv.js';
|
|
3
|
-
import { countryKey } from '../../src/layout/countries.js';
|
|
4
|
-
import { getLayout } from '../../src/layout/registry.js';
|
|
5
|
-
import {
|
|
6
|
-
CODE_KINDS,
|
|
7
|
-
FIELD_KINDS,
|
|
8
|
-
type CodeKind,
|
|
9
|
-
type FieldKind,
|
|
10
|
-
type RecordDef,
|
|
11
|
-
} from '../../src/layout/types.js';
|
|
12
|
-
|
|
13
|
-
const PREFIX_LENGTH = 136;
|
|
14
|
-
const DERIVED_PREFIX = '(derived) ';
|
|
15
|
-
|
|
16
|
-
const layout = getLayout(2024);
|
|
17
|
-
const records: RecordDef[] = Object.values(layout.records);
|
|
18
|
-
const readCsv = (file: string) =>
|
|
19
|
-
parseCsvRecords(
|
|
20
|
-
readFileSync(new URL(`../../documentation/layout/2024/${file}`, import.meta.url), 'utf8'),
|
|
21
|
-
);
|
|
22
|
-
const csvFields = readCsv('fields.csv');
|
|
23
|
-
const csvCountries = readCsv('countries.csv');
|
|
24
|
-
|
|
25
|
-
/** `record:code` labels of the codes matching a predicate, sorted. */
|
|
26
|
-
function codeLabels(predicate: (code: RecordDef['codes'][number]) => boolean): string[] {
|
|
27
|
-
return records
|
|
28
|
-
.flatMap(record => record.codes)
|
|
29
|
-
.filter(predicate)
|
|
30
|
-
.map(code => `${code.record}:${code.code}`)
|
|
31
|
-
.sort();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
describe('layout 2024 — records and header fields', () => {
|
|
35
|
-
it('has all 17 record types with 270 header fields in total', () => {
|
|
36
|
-
expect(Object.keys(layout.records).sort()).toEqual([
|
|
37
|
-
'1000',
|
|
38
|
-
'1010',
|
|
39
|
-
'1020',
|
|
40
|
-
'1030',
|
|
41
|
-
'2000',
|
|
42
|
-
'2200',
|
|
43
|
-
'3027',
|
|
44
|
-
'3050',
|
|
45
|
-
'3051',
|
|
46
|
-
'3054',
|
|
47
|
-
'3060',
|
|
48
|
-
'3063',
|
|
49
|
-
'3064',
|
|
50
|
-
'3065',
|
|
51
|
-
'3066',
|
|
52
|
-
'3077',
|
|
53
|
-
'9999',
|
|
54
|
-
]);
|
|
55
|
-
expect(records.reduce((sum, record) => sum + record.fields.length, 0)).toBe(270);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('keys every record by its own type, with unique canonical orders 1..17', () => {
|
|
59
|
-
for (const [type, record] of Object.entries(layout.records)) {
|
|
60
|
-
expect(record.type).toBe(type);
|
|
61
|
-
}
|
|
62
|
-
expect(records.map(record => record.order).sort((a, b) => a - b)).toEqual(
|
|
63
|
-
Array.from({ length: 17 }, (_, i) => i + 1),
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
describe.each(records.map(record => [record.type, record] as const))('record %s', (_, record) => {
|
|
68
|
-
it('has header fields sorted by position, contiguous from 137 to the header end', () => {
|
|
69
|
-
expect(record.fields[0]?.position).toBe(PREFIX_LENGTH + 1);
|
|
70
|
-
let next = PREFIX_LENGTH + 1;
|
|
71
|
-
for (const field of record.fields) {
|
|
72
|
-
expect(field.record).toBe(record.type);
|
|
73
|
-
expect(field.position).toBe(next);
|
|
74
|
-
expect(field.length).toBeGreaterThan(0);
|
|
75
|
-
next = field.position + field.length;
|
|
76
|
-
}
|
|
77
|
-
expect(next - 1).toBe(PREFIX_LENGTH + record.headerLength);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('adds up prefix, header and section to the record length', () => {
|
|
81
|
-
expect(PREFIX_LENGTH + record.headerLength + (record.section?.length ?? 0)).toBe(
|
|
82
|
-
record.length,
|
|
83
|
-
);
|
|
84
|
-
if (record.section) {
|
|
85
|
-
expect(record.section.start).toBe(PREFIX_LENGTH + record.headerLength + 1);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('has unique keys (fillers aside)', () => {
|
|
90
|
-
const keys = record.fields.filter(field => field.kind !== 'filler').map(field => field.key);
|
|
91
|
-
expect(new Set(keys).size).toBe(keys.length);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('uses only known field kinds and no "(derived) " key prefix', () => {
|
|
95
|
-
const kinds: readonly string[] = FIELD_KINDS;
|
|
96
|
-
for (const field of record.fields) {
|
|
97
|
-
expect(kinds).toContain(field.kind satisfies FieldKind);
|
|
98
|
-
expect(field.key.startsWith(DERIVED_PREFIX)).toBe(false);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('marks exactly the "(derived) " rows of fields.csv as derived', () => {
|
|
104
|
-
const expected = csvFields
|
|
105
|
-
.filter(row => row.key?.startsWith(DERIVED_PREFIX))
|
|
106
|
-
.map(row => `${row.record}@${row.position}:${row.key?.slice(DERIVED_PREFIX.length)}`)
|
|
107
|
-
.sort();
|
|
108
|
-
const actual = records
|
|
109
|
-
.flatMap(record => record.fields)
|
|
110
|
-
.filter(field => field.derived)
|
|
111
|
-
.map(field => `${field.record}@${field.position}:${field.key}`)
|
|
112
|
-
.sort();
|
|
113
|
-
expect(expected).toHaveLength(37);
|
|
114
|
-
expect(actual).toEqual(expected);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('throws for a year without a layout', () => {
|
|
118
|
-
expect(() => getLayout(2023)).toThrow(/2023/);
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
describe('layout 2024 — code-amount sections', () => {
|
|
123
|
-
it('has 260 codes: 102 in 1000, 51 in 2000 and 107 in the capital-gains appendices', () => {
|
|
124
|
-
const count = (types: readonly string[]) =>
|
|
125
|
-
records
|
|
126
|
-
.filter(record => types.includes(record.type))
|
|
127
|
-
.reduce((sum, record) => sum + record.codes.length, 0);
|
|
128
|
-
expect(count(Object.keys(layout.records))).toBe(260);
|
|
129
|
-
expect(layout.records['1000'].codes).toHaveLength(102);
|
|
130
|
-
expect(layout.records['2000'].codes).toHaveLength(51);
|
|
131
|
-
expect(count(records.map(record => record.type).filter(type => type.startsWith('30')))).toBe(
|
|
132
|
-
107,
|
|
133
|
-
);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
describe.each(records.map(record => [record.type, record] as const))('record %s', (_, record) => {
|
|
137
|
-
it('has codes only when it has a code-amount section', () => {
|
|
138
|
-
if (record.section?.kind !== 'codeAmount') {
|
|
139
|
-
expect(record.codes).toEqual([]);
|
|
140
|
-
} else {
|
|
141
|
-
expect(record.codes.length).toBeGreaterThan(0);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('has unique 3-digit codes sorted ascending, each 1–12 wide with a known kind', () => {
|
|
146
|
-
const kinds: readonly string[] = CODE_KINDS;
|
|
147
|
-
const codes = record.codes.map(code => code.code);
|
|
148
|
-
expect(new Set(codes).size).toBe(codes.length);
|
|
149
|
-
expect(codes).toEqual([...codes].sort());
|
|
150
|
-
for (const code of record.codes) {
|
|
151
|
-
expect(code.record).toBe(record.type);
|
|
152
|
-
expect(code.code).toMatch(/^\d{3}$/);
|
|
153
|
-
expect(code.length).toBeGreaterThanOrEqual(1);
|
|
154
|
-
expect(code.length).toBeLessThanOrEqual(12);
|
|
155
|
-
expect(kinds).toContain(code.kind satisfies CodeKind);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('fits every code of the record into its section at once (D-10: no overflow)', () => {
|
|
160
|
-
if (record.section?.kind === 'codeAmount') {
|
|
161
|
-
const used = record.codes.reduce((sum, code) => sum + 3 + code.length, 0);
|
|
162
|
-
expect(used).toBeLessThanOrEqual(record.section.length);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('limits the section entries: 1000 → 61, 2200 → 10, otherwise its number of codes', () => {
|
|
167
|
-
if (record.section) {
|
|
168
|
-
const expected =
|
|
169
|
-
record.type === '1000' ? 61 : record.type === '2200' ? 10 : record.codes.length;
|
|
170
|
-
expect(record.section.maxEntries).toBe(expected);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it('flags exactly 23 codes of 2000 for a per-country breakdown, and no other code', () => {
|
|
176
|
-
const flagged = codeLabels(code => code.perCountryBreakdown);
|
|
177
|
-
expect(flagged).toHaveLength(23);
|
|
178
|
-
expect(flagged.every(label => label.startsWith('2000:'))).toBe(true);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('allows zero exactly for the codes listed in SPEC §4.5', () => {
|
|
182
|
-
expect(codeLabels(code => code.zeroAllowed)).toEqual(
|
|
183
|
-
[
|
|
184
|
-
...['032', '072', '080', '081', '084', '086', '094', '096', '097', '121', '159'].map(
|
|
185
|
-
code => `1000:${code}`,
|
|
186
|
-
),
|
|
187
|
-
'2000:442',
|
|
188
|
-
'3054:016',
|
|
189
|
-
].sort(),
|
|
190
|
-
);
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it('marks exactly the derived codes of SPEC §7.4', () => {
|
|
194
|
-
expect(codeLabels(code => code.derived)).toEqual(
|
|
195
|
-
[
|
|
196
|
-
...['008', '028', '273', '277', '278', '280', '297'].map(code => `1000:${code}`),
|
|
197
|
-
...['501', '502', '503', '504', '505'].map(code => `3077:${code}`),
|
|
198
|
-
].sort(),
|
|
199
|
-
);
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
describe('layout 2024 — countries and limits', () => {
|
|
204
|
-
it('has 255 unique countries keyed by 3-digit code, plus "-88"', () => {
|
|
205
|
-
expect(csvCountries).toHaveLength(255);
|
|
206
|
-
expect(layout.countries.size).toBe(255);
|
|
207
|
-
expect(new Set(csvCountries.map(row => countryKey(row.code ?? ''))).size).toBe(255);
|
|
208
|
-
for (const row of csvCountries) {
|
|
209
|
-
expect(layout.countries.get(countryKey(row.code ?? ''))).toBe(row.nameHe);
|
|
210
|
-
}
|
|
211
|
-
for (const key of layout.countries.keys()) {
|
|
212
|
-
expect(key === '-88' || /^\d{3}$/.test(key)).toBe(true);
|
|
213
|
-
}
|
|
214
|
-
expect(layout.countries.has('-88')).toBe(true);
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it('pads country codes to 3 digits and keeps "-88"', () => {
|
|
218
|
-
expect(countryKey('4')).toBe('004');
|
|
219
|
-
expect(countryKey('40')).toBe('040');
|
|
220
|
-
expect(countryKey('376')).toBe('376');
|
|
221
|
-
expect(countryKey('-88')).toBe('-88');
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it('exposes the per-file and per-record limits', () => {
|
|
225
|
-
expect(layout.limits).toEqual({
|
|
226
|
-
reportsPerFile: 50,
|
|
227
|
-
capitalGainsAppendices: 14,
|
|
228
|
-
mainCodePairs: 61,
|
|
229
|
-
countriesPerRecord: 10,
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Opcn1214UnsupportedYearError } from '../../src/errors.js';
|
|
2
|
-
import { getLayout, supportedTaxYears } from '../../src/layout/registry.js';
|
|
3
|
-
|
|
4
|
-
describe('layout registry', () => {
|
|
5
|
-
it('supports the tax years 2024 and 2025', () => {
|
|
6
|
-
expect(supportedTaxYears()).toEqual([2024, 2025]);
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it('returns the layout of the requested year', () => {
|
|
10
|
-
expect(getLayout(2024).taxYear).toBe(2024);
|
|
11
|
-
expect(getLayout(2025).taxYear).toBe(2025);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('reuses the 2024 layout for 2025, except taxYear (SPEC §14)', () => {
|
|
15
|
-
const layout2024 = getLayout(2024);
|
|
16
|
-
const layout2025 = getLayout(2025);
|
|
17
|
-
expect({ ...layout2025, taxYear: 2024 }).toEqual(layout2024);
|
|
18
|
-
expect(layout2025.records).toBe(layout2024.records);
|
|
19
|
-
expect(layout2025.countries).toBe(layout2024.countries);
|
|
20
|
-
expect(layout2025.limits).toBe(layout2024.limits);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it.each([2023, 2026])('throws Opcn1214UnsupportedYearError for %i', taxYear => {
|
|
24
|
-
let thrown: unknown;
|
|
25
|
-
try {
|
|
26
|
-
getLayout(taxYear);
|
|
27
|
-
} catch (error) {
|
|
28
|
-
thrown = error;
|
|
29
|
-
}
|
|
30
|
-
expect(thrown).toBeInstanceOf(Opcn1214UnsupportedYearError);
|
|
31
|
-
const error = thrown as Opcn1214UnsupportedYearError;
|
|
32
|
-
expect(error.taxYear).toBe(taxYear);
|
|
33
|
-
expect(error.message).toContain(String(taxYear));
|
|
34
|
-
expect(error.issues).toHaveLength(1);
|
|
35
|
-
expect(error.issues[0]).toMatchObject({
|
|
36
|
-
ruleId: 'struct.taxYear.unsupported',
|
|
37
|
-
severity: 'error',
|
|
38
|
-
path: 'taxYear',
|
|
39
|
-
value: taxYear,
|
|
40
|
-
expected: 'one of 2024, 2025',
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it.each(supportedTaxYears().map(taxYear => [taxYear]))(
|
|
45
|
-
'returns a deeply frozen layout for %i',
|
|
46
|
-
taxYear => {
|
|
47
|
-
const layout = getLayout(taxYear);
|
|
48
|
-
expect(Object.isFrozen(layout)).toBe(true);
|
|
49
|
-
expect(Object.isFrozen(layout.records)).toBe(true);
|
|
50
|
-
expect(Object.isFrozen(layout.limits)).toBe(true);
|
|
51
|
-
for (const record of Object.values(layout.records)) {
|
|
52
|
-
expect(Object.isFrozen(record)).toBe(true);
|
|
53
|
-
expect(Object.isFrozen(record.fields)).toBe(true);
|
|
54
|
-
expect(Object.isFrozen(record.codes)).toBe(true);
|
|
55
|
-
if (record.section) {
|
|
56
|
-
expect(Object.isFrozen(record.section)).toBe(true);
|
|
57
|
-
}
|
|
58
|
-
for (const def of [...record.fields, ...record.codes]) {
|
|
59
|
-
expect(Object.isFrozen(def)).toBe(true);
|
|
60
|
-
if (def.values) {
|
|
61
|
-
expect(Object.isFrozen(def.values)).toBe(true);
|
|
62
|
-
expect(def.values.every(value => Object.isFrozen(value))).toBe(true);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
it('returns a frozen list of supported years', () => {
|
|
70
|
-
expect(Object.isFrozen(supportedTaxYears())).toBe(true);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe('2024 layout: shopcn findings of FIX-2 (SPEC §15 A-29, A-31)', () => {
|
|
75
|
-
const records = getLayout(2024).records;
|
|
76
|
-
const field = (record: '1010' | '1030', key: string) =>
|
|
77
|
-
records[record].fields.find(def => def.key === key);
|
|
78
|
-
|
|
79
|
-
it.each([
|
|
80
|
-
['1010', 139],
|
|
81
|
-
['1030', 138],
|
|
82
|
-
] as const)('%s company name is hebrewText', (record, position) => {
|
|
83
|
-
expect(field(record, 'companyName')).toMatchObject({ position, kind: 'hebrewText' });
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('3077 code 092 is an enum whose only value is 1', () => {
|
|
87
|
-
expect(records['3077'].codes.find(def => def.code === '092')).toMatchObject({
|
|
88
|
-
kind: 'enum',
|
|
89
|
-
values: [{ value: 1 }],
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('1000@225 (withholding file) stays an id9', () => {
|
|
94
|
-
expect(
|
|
95
|
-
records['1000'].fields.find(def => def.key === 'company.withholdingFileNumber'),
|
|
96
|
-
).toMatchObject({ position: 225, kind: 'id9' });
|
|
97
|
-
});
|
|
98
|
-
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { getLayout } from '../../src/layout/registry.js';
|
|
2
|
-
import type { RecordType } from '../../src/layout/types.js';
|
|
3
|
-
import {
|
|
4
|
-
CAPITAL_GAINS_CODES,
|
|
5
|
-
CAPITAL_GAINS_SYMBOLS,
|
|
6
|
-
COUNTRY_BREAKDOWN_CODES,
|
|
7
|
-
COUNTRY_CODES,
|
|
8
|
-
DERIVED_MAIN_CODES,
|
|
9
|
-
FOREIGN_APPENDIX_CODES,
|
|
10
|
-
MAIN_FORM_CODES,
|
|
11
|
-
MAIN_FORM_INPUT_CODES,
|
|
12
|
-
type CapitalGainsCode,
|
|
13
|
-
type CapitalGainsSymbol,
|
|
14
|
-
type CountryBreakdownCode,
|
|
15
|
-
type CountryCode,
|
|
16
|
-
type DerivedMainCode,
|
|
17
|
-
type ForeignAppendixCode,
|
|
18
|
-
type MainFormCode,
|
|
19
|
-
type MainFormInputCode,
|
|
20
|
-
} from '../../src/model/index.js';
|
|
21
|
-
|
|
22
|
-
const layout = getLayout(2024);
|
|
23
|
-
const codesOf = (type: RecordType) => layout.records[type].codes;
|
|
24
|
-
|
|
25
|
-
describe('code unions — types', () => {
|
|
26
|
-
it('accepts input codes and rejects derived or foreign codes', () => {
|
|
27
|
-
expectTypeOf<'010'>().toExtend<MainFormInputCode>();
|
|
28
|
-
expectTypeOf<'008'>().toExtend<MainFormCode>();
|
|
29
|
-
expectTypeOf<'008'>().toExtend<DerivedMainCode>();
|
|
30
|
-
expectTypeOf<'008'>().not.toExtend<MainFormInputCode>();
|
|
31
|
-
expectTypeOf<'420'>().toExtend<CountryBreakdownCode>();
|
|
32
|
-
expectTypeOf<'401'>().toExtend<ForeignAppendixCode>();
|
|
33
|
-
expectTypeOf<'401'>().not.toExtend<CountryBreakdownCode>();
|
|
34
|
-
expectTypeOf<'501'>().toExtend<CapitalGainsCode<77>>();
|
|
35
|
-
expectTypeOf<'501'>().not.toExtend<CapitalGainsCode<27>>();
|
|
36
|
-
expectTypeOf<'-88'>().toExtend<CountryCode>();
|
|
37
|
-
expectTypeOf<'004'>().toExtend<CountryCode>();
|
|
38
|
-
expectTypeOf<'4'>().not.toExtend<CountryCode>();
|
|
39
|
-
expectTypeOf<CapitalGainsSymbol>().toEqualTypeOf<
|
|
40
|
-
27 | 50 | 51 | 54 | 60 | 63 | 64 | 65 | 66 | 77
|
|
41
|
-
>();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('types each runtime array exactly as its union', () => {
|
|
45
|
-
expectTypeOf<(typeof MAIN_FORM_CODES)[number]>().toEqualTypeOf<MainFormCode>();
|
|
46
|
-
expectTypeOf<(typeof DERIVED_MAIN_CODES)[number]>().toEqualTypeOf<DerivedMainCode>();
|
|
47
|
-
expectTypeOf<(typeof MAIN_FORM_INPUT_CODES)[number]>().toEqualTypeOf<MainFormInputCode>();
|
|
48
|
-
expectTypeOf<(typeof FOREIGN_APPENDIX_CODES)[number]>().toEqualTypeOf<ForeignAppendixCode>();
|
|
49
|
-
expectTypeOf<(typeof COUNTRY_BREAKDOWN_CODES)[number]>().toEqualTypeOf<CountryBreakdownCode>();
|
|
50
|
-
expectTypeOf<(typeof CAPITAL_GAINS_SYMBOLS)[number]>().toEqualTypeOf<CapitalGainsSymbol>();
|
|
51
|
-
expectTypeOf<(typeof CAPITAL_GAINS_CODES)[27][number]>().toEqualTypeOf<CapitalGainsCode<27>>();
|
|
52
|
-
expectTypeOf<(typeof CAPITAL_GAINS_CODES)[77][number]>().toEqualTypeOf<CapitalGainsCode<77>>();
|
|
53
|
-
expectTypeOf<(typeof COUNTRY_CODES)[number]>().toEqualTypeOf<CountryCode>();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
describe('code unions — runtime arrays match the layout', () => {
|
|
58
|
-
it('lists the 102 main-form codes, 7 of them derived and 95 input codes', () => {
|
|
59
|
-
const all = codesOf('1000');
|
|
60
|
-
expect(MAIN_FORM_CODES).toEqual(all.map(code => code.code));
|
|
61
|
-
expect(DERIVED_MAIN_CODES).toEqual(all.filter(code => code.derived).map(code => code.code));
|
|
62
|
-
expect(MAIN_FORM_INPUT_CODES).toEqual(all.filter(code => !code.derived).map(code => code.code));
|
|
63
|
-
expect(MAIN_FORM_CODES).toHaveLength(102);
|
|
64
|
-
expect(DERIVED_MAIN_CODES).toHaveLength(7);
|
|
65
|
-
expect(MAIN_FORM_INPUT_CODES).toHaveLength(95);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('lists the 51 foreign-appendix codes and the 23 with a per-country breakdown', () => {
|
|
69
|
-
const all = codesOf('2000');
|
|
70
|
-
expect(FOREIGN_APPENDIX_CODES).toEqual(all.map(code => code.code));
|
|
71
|
-
expect(COUNTRY_BREAKDOWN_CODES).toEqual(
|
|
72
|
-
all.filter(code => code.perCountryBreakdown).map(code => code.code),
|
|
73
|
-
);
|
|
74
|
-
expect(FOREIGN_APPENDIX_CODES).toHaveLength(51);
|
|
75
|
-
expect(COUNTRY_BREAKDOWN_CODES).toHaveLength(23);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('lists the codes of every capital-gains symbol', () => {
|
|
79
|
-
expect(CAPITAL_GAINS_SYMBOLS).toEqual([27, 50, 51, 54, 60, 63, 64, 65, 66, 77]);
|
|
80
|
-
for (const symbol of CAPITAL_GAINS_SYMBOLS) {
|
|
81
|
-
const type = `30${symbol}` as const satisfies RecordType;
|
|
82
|
-
expect(CAPITAL_GAINS_CODES[symbol]).toEqual(codesOf(type).map(code => code.code));
|
|
83
|
-
}
|
|
84
|
-
expect(Object.keys(CAPITAL_GAINS_CODES).map(Number)).toEqual([...CAPITAL_GAINS_SYMBOLS]);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('lists the 255 country codes as keyed in the layout', () => {
|
|
88
|
-
expect(COUNTRY_CODES).toEqual([...layout.countries.keys()]);
|
|
89
|
-
expect(COUNTRY_CODES).toHaveLength(255);
|
|
90
|
-
});
|
|
91
|
-
});
|