@temboplus/frontend-core 0.4.3 → 1.0.1-beta.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/README.md +62 -173
- package/dist/coverage/coverage.types.d.ts +24 -0
- package/dist/coverage/index.d.ts +3 -0
- package/dist/coverage/tembo-coverage.d.ts +59 -0
- package/dist/domain/amount/amount.d.ts +476 -0
- package/dist/domain/amount/amount.helpers.d.ts +64 -0
- package/dist/domain/amount/amount.schema.d.ts +34 -0
- package/dist/domain/amount/index.d.ts +4 -0
- package/dist/domain/bank/bank.d.ts +59 -0
- package/dist/domain/bank/bank.helpers.d.ts +29 -0
- package/dist/domain/bank/bank.schema.d.ts +39 -0
- package/dist/domain/bank/bank.types.d.ts +9 -0
- package/dist/domain/bank/index.d.ts +4 -0
- package/dist/domain/channel/channel.d.ts +40 -0
- package/dist/domain/channel/channel.enums.d.ts +14 -0
- package/dist/domain/channel/channel.types.d.ts +12 -0
- package/dist/domain/channel/index.d.ts +3 -0
- package/dist/domain/country/country.d.ts +73 -0
- package/dist/domain/country/country.enums.d.ts +45 -0
- package/dist/domain/country/country.helpers.d.ts +6 -0
- package/dist/domain/country/country.schema.d.ts +73 -0
- package/{script/src/models/country/types.d.ts → dist/domain/country/country.types.d.ts} +18 -1
- package/dist/domain/country/index.d.ts +4 -0
- package/dist/domain/currency/currency.d.ts +62 -0
- package/dist/domain/currency/currency.helpers.d.ts +4 -0
- package/dist/domain/currency/currency.schema.d.ts +24 -0
- package/{script/src/models/currency/types.d.ts → dist/domain/currency/currency.types.d.ts} +7 -2
- package/dist/domain/currency/index.d.ts +4 -0
- package/{esm/src/models → dist/domain}/index.d.ts +3 -2
- package/dist/domain/mobile-money-provider/index.d.ts +4 -0
- package/dist/domain/mobile-money-provider/mobile-money-provider.d.ts +53 -0
- package/dist/domain/mobile-money-provider/mobile-money-provider.helpers.d.ts +5 -0
- package/dist/domain/mobile-money-provider/mobile-money-provider.schema.d.ts +22 -0
- package/dist/domain/mobile-money-provider/mobile-money-provider.types.d.ts +21 -0
- package/dist/domain/phone-number/index.d.ts +4 -0
- package/dist/domain/phone-number/phone-number.d.ts +57 -0
- package/dist/domain/phone-number/phone-number.helpers.d.ts +67 -0
- package/dist/domain/phone-number/phone-number.parser.d.ts +43 -0
- package/dist/domain/phone-number/phone-number.schema.d.ts +21 -0
- package/dist/domain/phone-number/phone-number.types.d.ts +72 -0
- package/dist/factories/amount.factory.d.ts +50 -0
- package/dist/factories/bank.factory.d.ts +47 -0
- package/dist/factories/country.factory.d.ts +40 -0
- package/dist/factories/currency.factory.d.ts +40 -0
- package/dist/factories/index.d.ts +7 -0
- package/dist/factories/mobile-money-provider.factory.d.ts +43 -0
- package/dist/factories/phone-number.factory.d.ts +31 -0
- package/dist/factories/transaction-limit.factory.d.ts +36 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/registries/bank.registry.d.ts +36 -0
- package/dist/registries/country.registry.d.ts +45 -0
- package/dist/registries/currency.registry.d.ts +33 -0
- package/dist/registries/index.d.ts +5 -0
- package/dist/registries/mobile-money-provider.registry.d.ts +48 -0
- package/dist/registries/transaction-limit.registry.d.ts +30 -0
- package/dist/repositories/bank.repository.d.ts +30 -0
- package/dist/repositories/country.repository.d.ts +31 -0
- package/dist/repositories/currency.repository.d.ts +28 -0
- package/dist/repositories/index.d.ts +5 -0
- package/dist/repositories/mobile-money-provider.repository.d.ts +53 -0
- package/dist/repositories/transaction-limit.repository.d.ts +31 -0
- package/{script/src → dist}/utils/id.d.ts +7 -3
- package/{esm/src/utils/index.js → dist/utils/index.d.ts} +1 -0
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/text.d.ts +103 -0
- package/{script/src → dist}/utils/time.d.ts +9 -4
- package/package.json +46 -23
- package/LICENSE +0 -7
- package/esm/_dnt.test_shims.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/_constants.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/_diff.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/_format.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_almost_equals.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_array_includes.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_equals.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_exists.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_false.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_greater.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_greater_or_equal.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_instance_of.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_is_error.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_less.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_less_or_equal.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_match.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_not_equals.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_not_instance_of.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_not_match.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_not_strict_equals.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_object_match.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_rejects.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_strict_equals.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_string_includes.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assert_throws.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/assertion_error.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/equal.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/fail.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/mod.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/unimplemented.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/assert/unreachable.d.ts.map +0 -1
- package/esm/deps/deno.land/std@0.217.0/fmt/colors.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +0 -1
- package/esm/mod.d.ts +0 -5
- package/esm/mod.d.ts.map +0 -1
- package/esm/mod.js +0 -4
- package/esm/package.json +0 -3
- package/esm/src/config/config_service.d.ts +0 -11
- package/esm/src/config/config_service.d.ts.map +0 -1
- package/esm/src/config/config_service.js +0 -19
- package/esm/src/config/index.d.ts +0 -2
- package/esm/src/config/index.d.ts.map +0 -1
- package/esm/src/config/index.js +0 -1
- package/esm/src/data/banks_tz.d.ts +0 -7
- package/esm/src/data/banks_tz.d.ts.map +0 -1
- package/esm/src/data/banks_tz.js +0 -197
- package/esm/src/data/countries.d.ts +0 -39
- package/esm/src/data/countries.d.ts.map +0 -1
- package/esm/src/data/countries.js +0 -2475
- package/esm/src/data/currencies.d.ts +0 -1901
- package/esm/src/data/currencies.d.ts.map +0 -1
- package/esm/src/data/currencies.js +0 -1073
- package/esm/src/data/phone_patterns.d.ts +0 -3809
- package/esm/src/data/phone_patterns.d.ts.map +0 -1
- package/esm/src/data/phone_patterns.js +0 -2325
- package/esm/src/models/amount/amount.d.ts +0 -53
- package/esm/src/models/amount/amount.d.ts.map +0 -1
- package/esm/src/models/amount/amount.js +0 -190
- package/esm/src/models/amount/amount.test.d.ts.map +0 -1
- package/esm/src/models/amount/antd_validator.d.ts +0 -40
- package/esm/src/models/amount/antd_validator.d.ts.map +0 -1
- package/esm/src/models/amount/antd_validator.js +0 -58
- package/esm/src/models/amount/antd_validator.test.d.ts.map +0 -1
- package/esm/src/models/amount/index.d.ts +0 -3
- package/esm/src/models/amount/index.d.ts.map +0 -1
- package/esm/src/models/amount/index.js +0 -2
- package/esm/src/models/bank/antd_validator.d.ts +0 -11
- package/esm/src/models/bank/antd_validator.d.ts.map +0 -1
- package/esm/src/models/bank/antd_validator.js +0 -26
- package/esm/src/models/bank/antd_validator.test.d.ts.map +0 -1
- package/esm/src/models/bank/bank.d.ts +0 -257
- package/esm/src/models/bank/bank.d.ts.map +0 -1
- package/esm/src/models/bank/bank.js +0 -450
- package/esm/src/models/bank/bank.test.d.ts.map +0 -1
- package/esm/src/models/bank/index.d.ts +0 -5
- package/esm/src/models/bank/index.d.ts.map +0 -1
- package/esm/src/models/bank/index.js +0 -4
- package/esm/src/models/bank/types.d.ts +0 -7
- package/esm/src/models/bank/types.d.ts.map +0 -1
- package/esm/src/models/bank/types.js +0 -45
- package/esm/src/models/bank/utils.d.ts +0 -8
- package/esm/src/models/bank/utils.d.ts.map +0 -1
- package/esm/src/models/bank/utils.js +0 -9
- package/esm/src/models/country/country.d.ts +0 -822
- package/esm/src/models/country/country.d.ts.map +0 -1
- package/esm/src/models/country/country.js +0 -737
- package/esm/src/models/country/country.test.d.ts.map +0 -1
- package/esm/src/models/country/index.d.ts +0 -4
- package/esm/src/models/country/index.d.ts.map +0 -1
- package/esm/src/models/country/index.js +0 -3
- package/esm/src/models/country/types.d.ts +0 -63
- package/esm/src/models/country/types.d.ts.map +0 -1
- package/esm/src/models/country/types.js +0 -105
- package/esm/src/models/country/utils.d.ts +0 -21
- package/esm/src/models/country/utils.d.ts.map +0 -1
- package/esm/src/models/country/utils.js +0 -25
- package/esm/src/models/currency/currency.d.ts +0 -465
- package/esm/src/models/currency/currency.d.ts.map +0 -1
- package/esm/src/models/currency/currency.js +0 -471
- package/esm/src/models/currency/currency.test.d.ts.map +0 -1
- package/esm/src/models/currency/index.d.ts +0 -4
- package/esm/src/models/currency/index.d.ts.map +0 -1
- package/esm/src/models/currency/index.js +0 -3
- package/esm/src/models/currency/types.d.ts +0 -21
- package/esm/src/models/currency/types.d.ts.map +0 -1
- package/esm/src/models/currency/types.js +0 -28
- package/esm/src/models/currency/utils.d.ts +0 -8
- package/esm/src/models/currency/utils.d.ts.map +0 -1
- package/esm/src/models/currency/utils.js +0 -9
- package/esm/src/models/index.d.ts.map +0 -1
- package/esm/src/models/index.js +0 -5
- package/esm/src/models/phone_number/format.d.ts +0 -13
- package/esm/src/models/phone_number/format.d.ts.map +0 -1
- package/esm/src/models/phone_number/format.js +0 -13
- package/esm/src/models/phone_number/global/phone_number.d.ts +0 -162
- package/esm/src/models/phone_number/global/phone_number.d.ts.map +0 -1
- package/esm/src/models/phone_number/global/phone_number.js +0 -459
- package/esm/src/models/phone_number/global/phone_number.test.d.ts.map +0 -1
- package/esm/src/models/phone_number/global/service.d.ts +0 -267
- package/esm/src/models/phone_number/global/service.d.ts.map +0 -1
- package/esm/src/models/phone_number/global/service.js +0 -498
- package/esm/src/models/phone_number/global/service.test.d.ts.map +0 -1
- package/esm/src/models/phone_number/index.d.ts +0 -6
- package/esm/src/models/phone_number/index.d.ts.map +0 -1
- package/esm/src/models/phone_number/index.js +0 -5
- package/esm/src/models/phone_number/tz/antd_validator.d.ts +0 -77
- package/esm/src/models/phone_number/tz/antd_validator.d.ts.map +0 -1
- package/esm/src/models/phone_number/tz/antd_validator.js +0 -90
- package/esm/src/models/phone_number/tz/antdvalidator.test.d.ts.map +0 -1
- package/esm/src/models/phone_number/tz/network_operator.d.ts +0 -30
- package/esm/src/models/phone_number/tz/network_operator.d.ts.map +0 -1
- package/esm/src/models/phone_number/tz/network_operator.js +0 -47
- package/esm/src/models/phone_number/tz/phone_number.d.ts +0 -141
- package/esm/src/models/phone_number/tz/phone_number.d.ts.map +0 -1
- package/esm/src/models/phone_number/tz/phone_number.js +0 -290
- package/esm/src/models/phone_number/tz/phone_number.test.d.ts.map +0 -1
- package/esm/src/reports/index.d.ts +0 -2
- package/esm/src/reports/index.d.ts.map +0 -1
- package/esm/src/reports/index.js +0 -1
- package/esm/src/reports/report_manager.d.ts +0 -146
- package/esm/src/reports/report_manager.d.ts.map +0 -1
- package/esm/src/reports/report_manager.js +0 -326
- package/esm/src/utils/id.d.ts +0 -12
- package/esm/src/utils/id.d.ts.map +0 -1
- package/esm/src/utils/id.js +0 -19
- package/esm/src/utils/index.d.ts +0 -4
- package/esm/src/utils/index.d.ts.map +0 -1
- package/esm/src/utils/text.d.ts +0 -32
- package/esm/src/utils/text.d.ts.map +0 -1
- package/esm/src/utils/text.js +0 -68
- package/esm/src/utils/text.test.d.ts.map +0 -1
- package/esm/src/utils/time.d.ts +0 -21
- package/esm/src/utils/time.d.ts.map +0 -1
- package/esm/src/utils/time.js +0 -34
- package/script/_dnt.test_shims.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/_constants.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/_diff.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/_format.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_almost_equals.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_array_includes.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_equals.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_exists.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_false.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_greater.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_greater_or_equal.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_instance_of.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_is_error.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_less.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_less_or_equal.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_match.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_not_equals.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_not_instance_of.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_not_match.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_not_strict_equals.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_object_match.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_rejects.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_strict_equals.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_string_includes.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assert_throws.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/assertion_error.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/equal.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/fail.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/mod.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/unimplemented.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/assert/unreachable.d.ts.map +0 -1
- package/script/deps/deno.land/std@0.217.0/fmt/colors.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +0 -1
- package/script/mod.d.ts +0 -5
- package/script/mod.d.ts.map +0 -1
- package/script/mod.js +0 -20
- package/script/package.json +0 -3
- package/script/src/config/config_service.d.ts +0 -11
- package/script/src/config/config_service.d.ts.map +0 -1
- package/script/src/config/config_service.js +0 -23
- package/script/src/config/index.d.ts +0 -2
- package/script/src/config/index.d.ts.map +0 -1
- package/script/src/config/index.js +0 -17
- package/script/src/data/banks_tz.d.ts +0 -7
- package/script/src/data/banks_tz.d.ts.map +0 -1
- package/script/src/data/banks_tz.js +0 -199
- package/script/src/data/countries.d.ts +0 -39
- package/script/src/data/countries.d.ts.map +0 -1
- package/script/src/data/countries.js +0 -2477
- package/script/src/data/currencies.d.ts +0 -1901
- package/script/src/data/currencies.d.ts.map +0 -1
- package/script/src/data/currencies.js +0 -1075
- package/script/src/data/phone_patterns.d.ts +0 -3809
- package/script/src/data/phone_patterns.d.ts.map +0 -1
- package/script/src/data/phone_patterns.js +0 -2327
- package/script/src/models/amount/amount.d.ts +0 -53
- package/script/src/models/amount/amount.d.ts.map +0 -1
- package/script/src/models/amount/amount.js +0 -194
- package/script/src/models/amount/amount.test.d.ts.map +0 -1
- package/script/src/models/amount/antd_validator.d.ts +0 -40
- package/script/src/models/amount/antd_validator.d.ts.map +0 -1
- package/script/src/models/amount/antd_validator.js +0 -62
- package/script/src/models/amount/antd_validator.test.d.ts.map +0 -1
- package/script/src/models/amount/index.d.ts +0 -3
- package/script/src/models/amount/index.d.ts.map +0 -1
- package/script/src/models/amount/index.js +0 -18
- package/script/src/models/bank/antd_validator.d.ts +0 -11
- package/script/src/models/bank/antd_validator.d.ts.map +0 -1
- package/script/src/models/bank/antd_validator.js +0 -30
- package/script/src/models/bank/antd_validator.test.d.ts.map +0 -1
- package/script/src/models/bank/bank.d.ts +0 -257
- package/script/src/models/bank/bank.d.ts.map +0 -1
- package/script/src/models/bank/bank.js +0 -458
- package/script/src/models/bank/bank.test.d.ts.map +0 -1
- package/script/src/models/bank/index.d.ts +0 -5
- package/script/src/models/bank/index.d.ts.map +0 -1
- package/script/src/models/bank/index.js +0 -20
- package/script/src/models/bank/types.d.ts +0 -7
- package/script/src/models/bank/types.d.ts.map +0 -1
- package/script/src/models/bank/types.js +0 -48
- package/script/src/models/bank/utils.d.ts +0 -8
- package/script/src/models/bank/utils.d.ts.map +0 -1
- package/script/src/models/bank/utils.js +0 -12
- package/script/src/models/country/country.d.ts +0 -822
- package/script/src/models/country/country.d.ts.map +0 -1
- package/script/src/models/country/country.js +0 -745
- package/script/src/models/country/country.test.d.ts.map +0 -1
- package/script/src/models/country/index.d.ts +0 -4
- package/script/src/models/country/index.d.ts.map +0 -1
- package/script/src/models/country/index.js +0 -19
- package/script/src/models/country/types.d.ts.map +0 -1
- package/script/src/models/country/types.js +0 -108
- package/script/src/models/country/utils.d.ts +0 -21
- package/script/src/models/country/utils.d.ts.map +0 -1
- package/script/src/models/country/utils.js +0 -30
- package/script/src/models/currency/currency.d.ts +0 -465
- package/script/src/models/currency/currency.d.ts.map +0 -1
- package/script/src/models/currency/currency.js +0 -479
- package/script/src/models/currency/currency.test.d.ts.map +0 -1
- package/script/src/models/currency/index.d.ts +0 -4
- package/script/src/models/currency/index.d.ts.map +0 -1
- package/script/src/models/currency/index.js +0 -19
- package/script/src/models/currency/types.d.ts.map +0 -1
- package/script/src/models/currency/types.js +0 -31
- package/script/src/models/currency/utils.d.ts +0 -8
- package/script/src/models/currency/utils.d.ts.map +0 -1
- package/script/src/models/currency/utils.js +0 -12
- package/script/src/models/index.d.ts +0 -6
- package/script/src/models/index.d.ts.map +0 -1
- package/script/src/models/index.js +0 -21
- package/script/src/models/phone_number/format.d.ts +0 -13
- package/script/src/models/phone_number/format.d.ts.map +0 -1
- package/script/src/models/phone_number/format.js +0 -16
- package/script/src/models/phone_number/global/phone_number.d.ts +0 -162
- package/script/src/models/phone_number/global/phone_number.d.ts.map +0 -1
- package/script/src/models/phone_number/global/phone_number.js +0 -463
- package/script/src/models/phone_number/global/phone_number.test.d.ts.map +0 -1
- package/script/src/models/phone_number/global/service.d.ts +0 -267
- package/script/src/models/phone_number/global/service.d.ts.map +0 -1
- package/script/src/models/phone_number/global/service.js +0 -506
- package/script/src/models/phone_number/global/service.test.d.ts.map +0 -1
- package/script/src/models/phone_number/index.d.ts +0 -6
- package/script/src/models/phone_number/index.d.ts.map +0 -1
- package/script/src/models/phone_number/index.js +0 -21
- package/script/src/models/phone_number/tz/antd_validator.d.ts +0 -77
- package/script/src/models/phone_number/tz/antd_validator.d.ts.map +0 -1
- package/script/src/models/phone_number/tz/antd_validator.js +0 -94
- package/script/src/models/phone_number/tz/antdvalidator.test.d.ts.map +0 -1
- package/script/src/models/phone_number/tz/network_operator.d.ts +0 -30
- package/script/src/models/phone_number/tz/network_operator.d.ts.map +0 -1
- package/script/src/models/phone_number/tz/network_operator.js +0 -50
- package/script/src/models/phone_number/tz/phone_number.d.ts +0 -141
- package/script/src/models/phone_number/tz/phone_number.d.ts.map +0 -1
- package/script/src/models/phone_number/tz/phone_number.js +0 -294
- package/script/src/models/phone_number/tz/phone_number.test.d.ts.map +0 -1
- package/script/src/reports/index.d.ts +0 -2
- package/script/src/reports/index.d.ts.map +0 -1
- package/script/src/reports/index.js +0 -17
- package/script/src/reports/report_manager.d.ts +0 -146
- package/script/src/reports/report_manager.d.ts.map +0 -1
- package/script/src/reports/report_manager.js +0 -336
- package/script/src/utils/id.d.ts.map +0 -1
- package/script/src/utils/id.js +0 -23
- package/script/src/utils/index.d.ts +0 -4
- package/script/src/utils/index.d.ts.map +0 -1
- package/script/src/utils/index.js +0 -19
- package/script/src/utils/text.d.ts +0 -32
- package/script/src/utils/text.d.ts.map +0 -1
- package/script/src/utils/text.js +0 -75
- package/script/src/utils/text.test.d.ts.map +0 -1
- package/script/src/utils/time.d.ts.map +0 -1
- package/script/src/utils/time.js +0 -39
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import type { Currency, CurrencyCode } from "../currency/index.js";
|
|
2
|
+
import type { AmountJSON } from "./amount.schema.js";
|
|
3
|
+
import { type AmountCompactFormatOptions, type AmountFormatOptions } from "./amount.helpers.js";
|
|
4
|
+
/**
|
|
5
|
+
* Internal symbol used by AmountFactory to bypass the protected constructor.
|
|
6
|
+
* Importing this from outside the factory is unsupported.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AmountConstructorToken: unique symbol;
|
|
9
|
+
/**
|
|
10
|
+
* Represents a monetary amount with currency information
|
|
11
|
+
*
|
|
12
|
+
* Enhanced with currency-amount parsing support:
|
|
13
|
+
* - Supports formats like "TZS1000", "1000TZS", "TZS1,000.00", "1,000.00TZS"
|
|
14
|
+
* - Case-insensitive currency codes
|
|
15
|
+
* - US/UK format (comma for thousands, period for decimal)
|
|
16
|
+
* - Automatic whitespace removal
|
|
17
|
+
* - Clear error messages for invalid formats
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Currency-amount combinations
|
|
22
|
+
* Amount.from('TZS10000'); // TZS 10,000.00
|
|
23
|
+
* Amount.from('TZS 10,000'); // TZS 10,000.00 (spaces removed)
|
|
24
|
+
* Amount.from('10000TZS'); // TZS 10,000.00
|
|
25
|
+
* Amount.from('TZS1,234.56'); // TZS 1,234.56
|
|
26
|
+
* Amount.from('-TZS1000'); // -TZS 1,000.00
|
|
27
|
+
* Amount.from('TZS-1000'); // -TZS 1,000.00
|
|
28
|
+
*
|
|
29
|
+
* // Traditional usage still works
|
|
30
|
+
* Amount.from(1000, 'TZS'); // TZS 1,000.00
|
|
31
|
+
* Amount.from('1000', 'USD'); // USD 1,000.00
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Plain-object representation of an Amount containing the full state.
|
|
36
|
+
*/
|
|
37
|
+
export interface AmountObject {
|
|
38
|
+
value: number;
|
|
39
|
+
text: string;
|
|
40
|
+
currencyCode: CurrencyCode;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Represents a monetary amount with currency information
|
|
44
|
+
*
|
|
45
|
+
* Features:
|
|
46
|
+
* - Supports both positive and negative amounts
|
|
47
|
+
* - Handles multiple input formats (strings with commas, numbers, etc.)
|
|
48
|
+
* - Provides mathematical operations (add, subtract, multiply, divide)
|
|
49
|
+
* - Includes comparison operations (equals, greaterThan, etc.)
|
|
50
|
+
* - Maintains currency consistency across operations
|
|
51
|
+
* - Immutable - all operations return new Amount instances
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* // Creating amounts
|
|
56
|
+
* const positive = Amount.from(1000, 'USD'); // USD 1,000.00
|
|
57
|
+
* const negative = Amount.from(-500, 'USD'); // -USD 500.00
|
|
58
|
+
* const fromString = Amount.from('-1,234.56', 'EUR'); // -EUR 1,234.56
|
|
59
|
+
*
|
|
60
|
+
* // Mathematical operations
|
|
61
|
+
* const sum = positive.add(negative); // $500.00
|
|
62
|
+
* const product = positive.multiply(-0.1); // -$100.00
|
|
63
|
+
*
|
|
64
|
+
* // Comparisons
|
|
65
|
+
* const isNegative = negative.isNegative(); // true
|
|
66
|
+
* const isPositive = positive.isPositive(); // true
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare class Amount {
|
|
70
|
+
private readonly value;
|
|
71
|
+
private readonly text;
|
|
72
|
+
private readonly currency;
|
|
73
|
+
/**
|
|
74
|
+
* Token-protected constructor. Use AmountFactory factories or the static
|
|
75
|
+
* delegations on Amount to obtain instances.
|
|
76
|
+
*/
|
|
77
|
+
constructor(token: symbol, value: number, text: string, currency: Currency);
|
|
78
|
+
/** Parses arbitrary input into a validated Amount via AmountFactory. */
|
|
79
|
+
static from(input: string | number, currencyCode?: CurrencyCode | null): Amount | undefined;
|
|
80
|
+
/** Re-resolves an Amount from its compact JSON identity. */
|
|
81
|
+
static fromJSON(json: AmountJSON | string): Amount | undefined;
|
|
82
|
+
/** Re-resolves an Amount from a JSON string. */
|
|
83
|
+
static fromJSONString(jsonString: string): Amount | undefined;
|
|
84
|
+
/** Type guard delegating to AmountFactory.isAmount. */
|
|
85
|
+
static is(obj: unknown): obj is Amount;
|
|
86
|
+
/**
|
|
87
|
+
* Returns the currency code
|
|
88
|
+
*
|
|
89
|
+
* @returns The ISO currency code (e.g., 'USD', 'EUR', 'TZS')
|
|
90
|
+
*/
|
|
91
|
+
get currencyCode(): CurrencyCode;
|
|
92
|
+
/**
|
|
93
|
+
* Returns the numeric value of the amount
|
|
94
|
+
*
|
|
95
|
+
* Can be positive, negative, or zero
|
|
96
|
+
*
|
|
97
|
+
* @returns The raw numeric value
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* Amount.from(1000).numericValue; // 1000
|
|
102
|
+
* Amount.from(-500).numericValue; // -500
|
|
103
|
+
* Amount.from(0).numericValue; // 0
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
get numericValue(): number;
|
|
107
|
+
/**
|
|
108
|
+
* Returns the formatted numeric value of the amount
|
|
109
|
+
*
|
|
110
|
+
* Always shows 2 decimal places for consistency, handles negative numbers
|
|
111
|
+
*
|
|
112
|
+
* @returns Formatted numeric string
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* Amount.from(1234.5).formattedNumericValue; // "1,234.50"
|
|
117
|
+
* Amount.from(-1234.5).formattedNumericValue; // "-1,234.50"
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
get formattedNumericValue(): string;
|
|
121
|
+
/**
|
|
122
|
+
* Adds this amount to another amount or number
|
|
123
|
+
*
|
|
124
|
+
* Supports mixing positive and negative amounts:
|
|
125
|
+
* - Positive + Positive = Positive
|
|
126
|
+
* - Positive + Negative = Difference
|
|
127
|
+
* - Negative + Negative = More negative
|
|
128
|
+
*
|
|
129
|
+
* @param other - Amount object or number to add
|
|
130
|
+
* @returns New Amount object with the sum
|
|
131
|
+
* @throws {Error} If currencies don't match when adding Amount objects
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* Amount.from(100).add(Amount.from(-50)); // Amount(50)
|
|
136
|
+
* Amount.from(-100).add(-50); // Amount(-150)
|
|
137
|
+
* Amount.from(100).add(Amount.from(-200)); // Amount(-100)
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
add(other: Amount | number): Amount;
|
|
141
|
+
/**
|
|
142
|
+
* Subtracts another amount or number from this amount
|
|
143
|
+
*
|
|
144
|
+
* Supports all combinations of positive and negative amounts:
|
|
145
|
+
* - Positive - Positive = Difference (can be negative)
|
|
146
|
+
* - Positive - Negative = Sum (double positive)
|
|
147
|
+
* - Negative - Positive = More negative
|
|
148
|
+
* - Negative - Negative = Difference
|
|
149
|
+
*
|
|
150
|
+
* @param other - Amount object or number to subtract
|
|
151
|
+
* @returns New Amount object with the difference
|
|
152
|
+
* @throws {Error} If currencies don't match when subtracting Amount objects
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* Amount.from(100).subtract(Amount.from(150)); // Amount(-50)
|
|
157
|
+
* Amount.from(100).subtract(Amount.from(-50)); // Amount(150)
|
|
158
|
+
* Amount.from(-100).subtract(Amount.from(50)); // Amount(-150)
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
subtract(other: Amount | number): Amount;
|
|
162
|
+
/**
|
|
163
|
+
* Multiplies this amount by a number
|
|
164
|
+
* @param multiplier - Number to multiply by
|
|
165
|
+
* @returns New Amount object with the product
|
|
166
|
+
*/
|
|
167
|
+
multiply(multiplier: number): Amount;
|
|
168
|
+
/**
|
|
169
|
+
* Divides this amount by a number
|
|
170
|
+
* @param divisor - Number to divide by
|
|
171
|
+
* @returns New Amount object with the quotient
|
|
172
|
+
* @throws Error if divisor is zero
|
|
173
|
+
*/
|
|
174
|
+
divide(divisor: number): Amount;
|
|
175
|
+
/**
|
|
176
|
+
* Returns the absolute value of this amount
|
|
177
|
+
* @returns New Amount object with absolute value
|
|
178
|
+
*/
|
|
179
|
+
abs(): Amount;
|
|
180
|
+
/**
|
|
181
|
+
* Rounds this amount to the specified number of decimal places
|
|
182
|
+
*
|
|
183
|
+
* Works correctly with both positive and negative amounts
|
|
184
|
+
*
|
|
185
|
+
* @param decimals - Number of decimal places (defaults to currency's decimal digits)
|
|
186
|
+
* @returns New Amount object with rounded value
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* Amount.from(123.456, 'USD').round(); // Amount(123.46)
|
|
191
|
+
* Amount.from(-123.456, 'USD').round(1); // Amount(-123.5)
|
|
192
|
+
* Amount.from(123.456, 'TZS').round(0); // Amount(123)
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
round(decimals?: number): Amount;
|
|
196
|
+
/**
|
|
197
|
+
* Returns the minimum of this amount and another amount/number
|
|
198
|
+
*
|
|
199
|
+
* Properly handles negative number comparisons
|
|
200
|
+
*
|
|
201
|
+
* @param other - Amount object or number to compare with
|
|
202
|
+
* @returns New Amount object with the minimum value
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* Amount.from(100).min(Amount.from(-50)); // Amount(-50)
|
|
207
|
+
* Amount.from(-100).min(-150); // Amount(-150)
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
min(other: Amount | number): Amount;
|
|
211
|
+
/**
|
|
212
|
+
* Returns the maximum of this amount and another amount/number
|
|
213
|
+
*
|
|
214
|
+
* Properly handles negative number comparisons
|
|
215
|
+
*
|
|
216
|
+
* @param other - Amount object or number to compare with
|
|
217
|
+
* @returns New Amount object with the maximum value
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* Amount.from(100).max(Amount.from(-50)); // Amount(100)
|
|
222
|
+
* Amount.from(-100).max(-50); // Amount(-50)
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
max(other: Amount | number): Amount;
|
|
226
|
+
/**
|
|
227
|
+
* Checks if this amount equals another amount or number
|
|
228
|
+
*
|
|
229
|
+
* Uses strict equality, works with negative numbers
|
|
230
|
+
*
|
|
231
|
+
* @param other - Amount object or number to compare with
|
|
232
|
+
* @returns True if values are equal
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* Amount.from(-100).equals(Amount.from(-100)); // true
|
|
237
|
+
* Amount.from(-100).equals(-100); // true
|
|
238
|
+
* Amount.from(-100).equals(100); // false
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
equals(other: Amount | number): boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Checks if this amount is greater than another amount or number
|
|
244
|
+
*
|
|
245
|
+
* Properly handles negative number comparisons (-50 > -100 is true)
|
|
246
|
+
*
|
|
247
|
+
* @param other - Amount object or number to compare with
|
|
248
|
+
* @returns True if this amount is greater
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* Amount.from(-50).greaterThan(Amount.from(-100)); // true
|
|
253
|
+
* Amount.from(-100).greaterThan(-50); // false
|
|
254
|
+
* Amount.from(100).greaterThan(-100); // true
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
greaterThan(other: Amount | number): boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Checks if this amount is less than another amount or number
|
|
260
|
+
*
|
|
261
|
+
* Properly handles negative number comparisons (-100 < -50 is true)
|
|
262
|
+
*
|
|
263
|
+
* @param other - Amount object or number to compare with
|
|
264
|
+
* @returns True if this amount is less
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* Amount.from(-100).lessThan(Amount.from(-50)); // true
|
|
269
|
+
* Amount.from(-50).lessThan(-100); // false
|
|
270
|
+
* Amount.from(-100).lessThan(100); // true
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
lessThan(other: Amount | number): boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Checks if this amount is greater than or equal to another amount or number
|
|
276
|
+
*
|
|
277
|
+
* @param other - Amount object or number to compare with
|
|
278
|
+
* @returns True if this amount is greater than or equal
|
|
279
|
+
*/
|
|
280
|
+
greaterThanOrEqual(other: Amount | number): boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Checks if this amount is less than or equal to another amount or number
|
|
283
|
+
*
|
|
284
|
+
* @param other - Amount object or number to compare with
|
|
285
|
+
* @returns True if this amount is less than or equal
|
|
286
|
+
*/
|
|
287
|
+
lessThanOrEqual(other: Amount | number): boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Converts this amount to a different currency
|
|
290
|
+
*
|
|
291
|
+
* Works with both positive and negative amounts
|
|
292
|
+
*
|
|
293
|
+
* @param targetCurrency - Target currency code
|
|
294
|
+
* @param exchangeRate - Exchange rate from current currency to target currency
|
|
295
|
+
* @returns New Amount object in target currency
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```typescript
|
|
299
|
+
* Amount.from(-1000, 'TZS').convertTo('USD', 0.00043); // Amount(-0.43, 'USD')
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
convertTo(targetCurrency: CurrencyCode, exchangeRate: number): Amount;
|
|
303
|
+
/**
|
|
304
|
+
* Returns a percentage of this amount
|
|
305
|
+
*
|
|
306
|
+
* Maintains the sign of the original amount
|
|
307
|
+
*
|
|
308
|
+
* @param percentage - Percentage as a number (e.g., 10 for 10%, -5 for -5%)
|
|
309
|
+
* @returns New Amount object representing the percentage
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```typescript
|
|
313
|
+
* Amount.from(1000).percentage(10); // Amount(100)
|
|
314
|
+
* Amount.from(-1000).percentage(10); // Amount(-100)
|
|
315
|
+
* Amount.from(1000).percentage(-10); // Amount(-100)
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
percentage(percentage: number): Amount;
|
|
319
|
+
/**
|
|
320
|
+
* Checks if this amount is zero
|
|
321
|
+
*
|
|
322
|
+
* @returns True if the amount is exactly zero
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* Amount.from(0).isZero(); // true
|
|
327
|
+
* Amount.from(-0).isZero(); // true
|
|
328
|
+
* Amount.from(0.01).isZero(); // false
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
isZero(): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Checks if this amount is positive
|
|
334
|
+
*
|
|
335
|
+
* @returns True if the amount is greater than zero
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* Amount.from(100).isPositive(); // true
|
|
340
|
+
* Amount.from(-100).isPositive(); // false
|
|
341
|
+
* Amount.from(0).isPositive(); // false
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
isPositive(): boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Checks if this amount is negative
|
|
347
|
+
*
|
|
348
|
+
* @returns True if the amount is less than zero
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```typescript
|
|
352
|
+
* Amount.from(-100).isNegative(); // true
|
|
353
|
+
* Amount.from(100).isNegative(); // false
|
|
354
|
+
* Amount.from(0).isNegative(); // false
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
isNegative(): boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Enhanced format method with comprehensive options including native formatting
|
|
360
|
+
*
|
|
361
|
+
* @param options - Formatting configuration options
|
|
362
|
+
* @returns Formatted amount string according to specified options
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```typescript
|
|
366
|
+
* const amount = Amount.from(-1234.56, 'USD');
|
|
367
|
+
* const tzAmount = Amount.from(1234.56, 'TZS');
|
|
368
|
+
*
|
|
369
|
+
* // Default formatting (currency codes)
|
|
370
|
+
* amount.format(); // "-USD 1,234.56"
|
|
371
|
+
* tzAmount.format(); // "TZS 1,234.56"
|
|
372
|
+
*
|
|
373
|
+
* // Symbol formatting (opt-in)
|
|
374
|
+
* amount.format({ useSymbol: true }); // "-$1,234.56"
|
|
375
|
+
* tzAmount.format({ useSymbol: true }); // "TSh 1,234.56"
|
|
376
|
+
*
|
|
377
|
+
* // Native formatting with Intl (uses symbols via browser locale)
|
|
378
|
+
* tzAmount.format({ useNativeFormatting: true, useNativeLocale: true }); // Uses Swahili locale
|
|
379
|
+
*
|
|
380
|
+
* // Currency position
|
|
381
|
+
* amount.format({ currencyPosition: 'after' }); // "-1,234.56 USD"
|
|
382
|
+
*
|
|
383
|
+
* // No currency
|
|
384
|
+
* amount.format({ showCurrency: false }); // "-1,234.56"
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
format(options?: AmountFormatOptions): string;
|
|
388
|
+
/**
|
|
389
|
+
* Convenience method for native formatting using Intl.NumberFormat with symbols
|
|
390
|
+
* @param options Additional formatting options
|
|
391
|
+
* @returns Formatted string using native currency conventions with symbols
|
|
392
|
+
*/
|
|
393
|
+
formatNative(options?: Omit<AmountFormatOptions, "useNativeFormatting">): string;
|
|
394
|
+
/**
|
|
395
|
+
* Primary display label using currency codes (e.g., "TZS 1,000.00", "USD 500.00")
|
|
396
|
+
*/
|
|
397
|
+
get label(): string;
|
|
398
|
+
/**
|
|
399
|
+
* International label using currency codes with en-US locale
|
|
400
|
+
*/
|
|
401
|
+
get internationalLabel(): string;
|
|
402
|
+
/**
|
|
403
|
+
* Returns the amount as a plain number string without currency indicator
|
|
404
|
+
*
|
|
405
|
+
* @param options - Formatting options for the numeric value
|
|
406
|
+
* @returns Plain numeric string
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```typescript
|
|
410
|
+
* Amount.from(-1234.56).toPlainNumber(); // "-1,234.56"
|
|
411
|
+
* Amount.from(1000).toPlainNumber({ useGrouping: false }); // "1000.00"
|
|
412
|
+
* Amount.from(1234.5).toPlainNumber({
|
|
413
|
+
* minimumFractionDigits: 4
|
|
414
|
+
* }); // "1,234.5000"
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
toPlainNumber(options?: Omit<AmountFormatOptions, "showCurrency" | "useSymbol" | "currencyPosition">): string;
|
|
418
|
+
/**
|
|
419
|
+
* Formats amount in compact notation (K, M, B, T)
|
|
420
|
+
*
|
|
421
|
+
* @param precision - Number of decimal places for compact numbers (default: 1)
|
|
422
|
+
* @param options - Additional formatting options
|
|
423
|
+
* @returns Compact formatted string
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* ```typescript
|
|
427
|
+
* Amount.from(1500).toCompactFormat(); // "TZS 1.5K"
|
|
428
|
+
* Amount.from(-2500000, 'USD').toCompactFormat(); // "-USD 2.5M"
|
|
429
|
+
* Amount.from(1234567890, 'USD').toCompactFormat(); // "USD 1.2B"
|
|
430
|
+
* Amount.from(999, 'USD').toCompactFormat(); // "USD 999"
|
|
431
|
+
* Amount.from(1000000, 'EUR').toCompactFormat(2, { alwaysShowDecimals: true }); // "EUR 1.00M"
|
|
432
|
+
* Amount.from(1500000, 'USD').toCompactFormat(0); // "USD 2M" (rounded)
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
toCompactFormat(precision?: number, options?: AmountCompactFormatOptions): string;
|
|
436
|
+
/**
|
|
437
|
+
* Returns the amount rounded to the nearest whole number
|
|
438
|
+
*
|
|
439
|
+
* @param showCurrency - Whether to include currency code (default: false)
|
|
440
|
+
* @param useGrouping - Whether to use thousands separators (default: true)
|
|
441
|
+
* @returns Whole number formatted string
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```typescript
|
|
445
|
+
* Amount.from(1234.56).toWholeNumber(); // "1,235"
|
|
446
|
+
* Amount.from(-1234.44).toWholeNumber(); // "-1,234"
|
|
447
|
+
* Amount.from(1000.5, 'USD').toWholeNumber(true); // "USD 1,001"
|
|
448
|
+
* Amount.from(999.4).toWholeNumber(false, false); // "999"
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
toWholeNumber(showCurrency?: boolean, useGrouping?: boolean): string;
|
|
452
|
+
/**
|
|
453
|
+
* Helper method to get the actual rounded value as a number (for toWholeNumber)
|
|
454
|
+
*
|
|
455
|
+
* @returns The amount rounded to the nearest whole number
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* ```typescript
|
|
459
|
+
* Amount.from(1234.56).getWholeValue(); // 1235
|
|
460
|
+
* Amount.from(-1234.44).getWholeValue(); // -1234
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
getWholeValue(): number;
|
|
464
|
+
/**
|
|
465
|
+
* Serializes the Amount instance to a JSON-compatible object
|
|
466
|
+
*/
|
|
467
|
+
toJSON(): AmountJSON;
|
|
468
|
+
/**
|
|
469
|
+
* Serializes the Amount instance to a JSON string
|
|
470
|
+
*/
|
|
471
|
+
toJSONString(): string;
|
|
472
|
+
/** Full plain-object dump of all current state. */
|
|
473
|
+
toObject(): AmountObject;
|
|
474
|
+
}
|
|
475
|
+
export { Amount };
|
|
476
|
+
export type { AmountCompactFormatOptions, AmountFormatOptions, } from "./amount.helpers.js";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Currency } from "../currency/currency.js";
|
|
2
|
+
import type { CurrencyCode } from "../currency/currency.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Formatting options for the enhanced format method.
|
|
5
|
+
*/
|
|
6
|
+
export interface AmountFormatOptions {
|
|
7
|
+
/** Show currency indicator (code by default, or symbol if useSymbol is true). Default: true */
|
|
8
|
+
showCurrency?: boolean;
|
|
9
|
+
/** Use currency symbol (e.g., $, TSh) instead of code (e.g., USD, TZS). Default: false */
|
|
10
|
+
useSymbol?: boolean;
|
|
11
|
+
/** Position of currency indicator. Default: "before" */
|
|
12
|
+
currencyPosition?: "before" | "after";
|
|
13
|
+
/** Use thousands separators (commas). Default: true */
|
|
14
|
+
useGrouping?: boolean;
|
|
15
|
+
/** Minimum number of decimal places */
|
|
16
|
+
minimumFractionDigits?: number;
|
|
17
|
+
/** Maximum number of decimal places */
|
|
18
|
+
maximumFractionDigits?: number;
|
|
19
|
+
/** How to display sign for positive/negative numbers */
|
|
20
|
+
showSign?: "always" | "negative" | "never";
|
|
21
|
+
/** Locale for formatting (defaults to 'en-US') */
|
|
22
|
+
locale?: string;
|
|
23
|
+
/** Custom thousands separator */
|
|
24
|
+
thousandsSeparator?: string;
|
|
25
|
+
/** Custom decimal separator */
|
|
26
|
+
decimalSeparator?: string;
|
|
27
|
+
/** Use native formatting with Intl.NumberFormat (defaults to false) */
|
|
28
|
+
useNativeFormatting?: boolean;
|
|
29
|
+
/** Prefer native locale for the currency (overrides provided locale) */
|
|
30
|
+
useNativeLocale?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface AmountCompactFormatOptions {
|
|
33
|
+
showCurrency?: boolean;
|
|
34
|
+
useSymbol?: boolean;
|
|
35
|
+
alwaysShowDecimals?: boolean;
|
|
36
|
+
roundingMode?: "round" | "floor" | "ceil";
|
|
37
|
+
}
|
|
38
|
+
interface ParsedCurrencyAmount {
|
|
39
|
+
currency?: CurrencyCode;
|
|
40
|
+
amount?: string;
|
|
41
|
+
}
|
|
42
|
+
declare function containsForbiddenCurrencySymbol(input: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Splits a cleaned currency-prefixed string into { currency, amount }.
|
|
45
|
+
*/
|
|
46
|
+
declare function parseCurrencyAmountInput(cleaned: string, normalizeCurrencyCode: (code: string) => CurrencyCode | undefined): ParsedCurrencyAmount;
|
|
47
|
+
/**
|
|
48
|
+
* Formats a numeric value into a display string using the currency's decimal
|
|
49
|
+
* digits.
|
|
50
|
+
*/
|
|
51
|
+
declare function formatAmountText(value: number, currency: Currency): string;
|
|
52
|
+
declare function formatAmountWithIntl(value: number, currency: Currency, options: AmountFormatOptions): string;
|
|
53
|
+
declare function formatAmountManually(value: number, currency: Currency, options: AmountFormatOptions): string;
|
|
54
|
+
declare function formatCompactAmount(value: number, currency: Currency, precision?: number, options?: AmountCompactFormatOptions): string;
|
|
55
|
+
export declare const AmountHelpers: {
|
|
56
|
+
AMOUNT_REGEX: RegExp;
|
|
57
|
+
containsForbiddenCurrencySymbol: typeof containsForbiddenCurrencySymbol;
|
|
58
|
+
formatAmountText: typeof formatAmountText;
|
|
59
|
+
formatAmountManually: typeof formatAmountManually;
|
|
60
|
+
formatAmountWithIntl: typeof formatAmountWithIntl;
|
|
61
|
+
formatCompactAmount: typeof formatCompactAmount;
|
|
62
|
+
parseCurrencyAmountInput: typeof parseCurrencyAmountInput;
|
|
63
|
+
};
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for Amount JSON serialization.
|
|
4
|
+
* This schema validates the JSON representation of an Amount instance.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AmountJSONSchema: z.ZodObject<{
|
|
7
|
+
/** The numeric value of the amount (can be positive, negative, or zero) */
|
|
8
|
+
value: z.ZodNumber;
|
|
9
|
+
/** The formatted text representation of the amount */
|
|
10
|
+
text: z.ZodString;
|
|
11
|
+
/** The ISO currency code */
|
|
12
|
+
currencyCode: z.ZodString;
|
|
13
|
+
/** Version for future compatibility */
|
|
14
|
+
version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
version: string;
|
|
17
|
+
value: number;
|
|
18
|
+
text: string;
|
|
19
|
+
currencyCode: string;
|
|
20
|
+
}, {
|
|
21
|
+
value: number;
|
|
22
|
+
text: string;
|
|
23
|
+
currencyCode: string;
|
|
24
|
+
version?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Compact JSON identity for an Amount, sufficient to reconstruct the value via
|
|
28
|
+
* AmountFactory.
|
|
29
|
+
*/
|
|
30
|
+
export type AmountJSON = z.infer<typeof AmountJSONSchema>;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use AmountJSON instead.
|
|
33
|
+
*/
|
|
34
|
+
export type AmountJson = AmountJSON;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ISO2CountryCode } from "@domain/country/country.types.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { BankJSONSchema } from "./bank.schema.js";
|
|
4
|
+
import type { BankSwiftCode, KEBankSwiftCode, TZBankSwiftCode } from "./bank.types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Internal symbol used by BankFactory to bypass the protected constructor.
|
|
7
|
+
* Importing this from outside the factory is unsupported.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BankConstructorToken: unique symbol;
|
|
10
|
+
/**
|
|
11
|
+
* Compact JSON identity for a Bank, sufficient to re-resolve the canonical
|
|
12
|
+
* record via BankRegistry.
|
|
13
|
+
*/
|
|
14
|
+
export type BankJSON = z.infer<typeof BankJSONSchema>;
|
|
15
|
+
/**
|
|
16
|
+
* Plain-object representation of a Bank containing the full state.
|
|
17
|
+
*/
|
|
18
|
+
export interface BankObject {
|
|
19
|
+
officialName: string;
|
|
20
|
+
shortName: string;
|
|
21
|
+
bic: TZBankSwiftCode | KEBankSwiftCode;
|
|
22
|
+
countryCode: ISO2CountryCode;
|
|
23
|
+
formerNames?: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Pure value object representing a bank. Lookups, validation, and factories
|
|
27
|
+
* live on BankRegistry; the static methods on this class are thin delegations
|
|
28
|
+
* for ergonomic call sites.
|
|
29
|
+
*/
|
|
30
|
+
export declare class Bank {
|
|
31
|
+
readonly officialName: string;
|
|
32
|
+
readonly shortName: string;
|
|
33
|
+
readonly bic: TZBankSwiftCode | KEBankSwiftCode;
|
|
34
|
+
readonly countryCode: ISO2CountryCode;
|
|
35
|
+
readonly formerNames?: string[];
|
|
36
|
+
constructor(token: symbol, officialName: string, shortName: string, bic: TZBankSwiftCode | KEBankSwiftCode, countryCode: ISO2CountryCode, formerNames?: string[]);
|
|
37
|
+
/** Whether this bank has any former names recorded. */
|
|
38
|
+
hasFormerNames(): boolean;
|
|
39
|
+
/** Display string with former names appended in parentheses. */
|
|
40
|
+
getDisplayNameWithHistory(): string;
|
|
41
|
+
/** Human-readable label, e.g. "CRDB BANK PLC (CRDB) - BIC: CORUTZTZ [TZ]". */
|
|
42
|
+
toString(): string;
|
|
43
|
+
/** Compact JSON identity for serialization. */
|
|
44
|
+
toJSON(): BankJSON;
|
|
45
|
+
toJSONString(): string;
|
|
46
|
+
/** Full plain-object dump of all current state. */
|
|
47
|
+
toObject(): BankObject;
|
|
48
|
+
/**
|
|
49
|
+
* Resolves a Bank by BIC/SWIFT code. If the country is omitted, the registry
|
|
50
|
+
* searches across every supported country.
|
|
51
|
+
*/
|
|
52
|
+
static fromBIC(bic: BankSwiftCode | string, countryCode?: ISO2CountryCode): Bank | undefined;
|
|
53
|
+
/** Re-resolves a Bank from its compact JSON identity. */
|
|
54
|
+
static fromJSON(json: BankJSON | string): Bank | undefined;
|
|
55
|
+
/** Re-resolves a Bank from a JSON string. */
|
|
56
|
+
static fromJSONString(jsonString: string): Bank | undefined;
|
|
57
|
+
/** Type guard delegating to BankFactory.isBank. */
|
|
58
|
+
static is(obj: unknown): obj is Bank;
|
|
59
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ISO2CountryCode } from "@domain/country/country.types.js";
|
|
2
|
+
import { isBankSwiftCode, type BankSwiftCode } from "./bank.types.js";
|
|
3
|
+
export declare const BankHelpers: {
|
|
4
|
+
isBankSwiftCode: typeof isBankSwiftCode;
|
|
5
|
+
validateAccountNumber: typeof validateAccountNumber;
|
|
6
|
+
validateSwiftCode: typeof validateSwiftCode;
|
|
7
|
+
validateAllBankDetails: typeof validateAllBankDetails;
|
|
8
|
+
getCountryFromSwiftCode: typeof getCountryFromSwiftCode;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Validates a bank account number format. When countryCode is omitted, every
|
|
12
|
+
* supported country validator is checked.
|
|
13
|
+
*/
|
|
14
|
+
declare function validateAccountNumber(accountNumber: string, countryCode?: ISO2CountryCode): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Validates a SWIFT/BIC code. When countryCode is omitted, every supported
|
|
17
|
+
* country validator is checked.
|
|
18
|
+
*/
|
|
19
|
+
declare function validateSwiftCode(swiftCode: string, countryCode?: ISO2CountryCode): swiftCode is BankSwiftCode;
|
|
20
|
+
/**
|
|
21
|
+
* Validates all bank details. When countryCode is omitted, account number and
|
|
22
|
+
* SWIFT validation each scan every supported country.
|
|
23
|
+
*/
|
|
24
|
+
declare function validateAllBankDetails(accountNumber: string, swiftCode: string, accountName: string, countryCode?: ISO2CountryCode): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Determines which country a SWIFT code belongs to.
|
|
27
|
+
*/
|
|
28
|
+
declare function getCountryFromSwiftCode(swiftCode: string): ISO2CountryCode | undefined;
|
|
29
|
+
export {};
|