@temboplus/afloat 0.1.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/LICENSE +7 -0
- package/README.md +21 -0
- package/esm/_dnt.test_shims.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
- package/esm/mod.d.ts +7 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +6 -0
- package/esm/package.json +3 -0
- package/esm/src/errors/api_error.d.ts +63 -0
- package/esm/src/errors/api_error.d.ts.map +1 -0
- package/esm/src/errors/api_error.js +90 -0
- package/esm/src/errors/index.d.ts +3 -0
- package/esm/src/errors/index.d.ts.map +1 -0
- package/esm/src/errors/index.js +2 -0
- package/esm/src/errors/permission_error.d.ts +48 -0
- package/esm/src/errors/permission_error.d.ts.map +1 -0
- package/esm/src/errors/permission_error.js +70 -0
- package/esm/src/features/auth/contract.d.ts +123 -0
- package/esm/src/features/auth/contract.d.ts.map +1 -0
- package/esm/src/features/auth/contract.js +50 -0
- package/esm/src/features/auth/index.d.ts +2 -0
- package/esm/src/features/auth/index.d.ts.map +1 -0
- package/esm/src/features/auth/index.js +1 -0
- package/esm/src/features/auth/manager.d.ts +71 -0
- package/esm/src/features/auth/manager.d.ts.map +1 -0
- package/esm/src/features/auth/manager.js +118 -0
- package/esm/src/features/auth/repository.d.ts +30 -0
- package/esm/src/features/auth/repository.d.ts.map +1 -0
- package/esm/src/features/auth/repository.js +94 -0
- package/esm/src/features/contact/contract.d.ts +170 -0
- package/esm/src/features/contact/contract.d.ts.map +1 -0
- package/esm/src/features/contact/contract.js +49 -0
- package/esm/src/features/contact/index.d.ts +2 -0
- package/esm/src/features/contact/index.d.ts.map +1 -0
- package/esm/src/features/contact/index.js +1 -0
- package/esm/src/features/contact/repository.d.ts +47 -0
- package/esm/src/features/contact/repository.d.ts.map +1 -0
- package/esm/src/features/contact/repository.js +94 -0
- package/esm/src/features/files-gen/contract.d.ts +67 -0
- package/esm/src/features/files-gen/contract.d.ts.map +1 -0
- package/esm/src/features/files-gen/contract.js +40 -0
- package/esm/src/features/files-gen/repository.d.ts +47 -0
- package/esm/src/features/files-gen/repository.d.ts.map +1 -0
- package/esm/src/features/files-gen/repository.js +48 -0
- package/esm/src/features/payout/contract.d.ts +623 -0
- package/esm/src/features/payout/contract.d.ts.map +1 -0
- package/esm/src/features/payout/contract.js +75 -0
- package/esm/src/features/payout/index.d.ts +2 -0
- package/esm/src/features/payout/index.d.ts.map +1 -0
- package/esm/src/features/payout/index.js +1 -0
- package/esm/src/features/payout/repository.d.ts +62 -0
- package/esm/src/features/payout/repository.d.ts.map +1 -0
- package/esm/src/features/payout/repository.js +158 -0
- package/esm/src/features/wallet/contract.d.ts +103 -0
- package/esm/src/features/wallet/contract.d.ts.map +1 -0
- package/esm/src/features/wallet/contract.js +35 -0
- package/esm/src/features/wallet/index.d.ts +2 -0
- package/esm/src/features/wallet/index.d.ts.map +1 -0
- package/esm/src/features/wallet/index.js +1 -0
- package/esm/src/features/wallet/repository.d.ts +74 -0
- package/esm/src/features/wallet/repository.d.ts.map +1 -0
- package/esm/src/features/wallet/repository.js +132 -0
- package/esm/src/models/contact/derivatives/contact.d.ts +168 -0
- package/esm/src/models/contact/derivatives/contact.d.ts.map +1 -0
- package/esm/src/models/contact/derivatives/contact.js +260 -0
- package/esm/src/models/contact/derivatives/contact.test.d.ts.map +1 -0
- package/esm/src/models/contact/derivatives/contact_info.d.ts +188 -0
- package/esm/src/models/contact/derivatives/contact_info.d.ts.map +1 -0
- package/esm/src/models/contact/derivatives/contact_info.js +255 -0
- package/esm/src/models/contact/derivatives/contact_info.test.d.ts.map +1 -0
- package/esm/src/models/contact/index.d.ts +5 -0
- package/esm/src/models/contact/index.d.ts.map +1 -0
- package/esm/src/models/contact/index.js +4 -0
- package/esm/src/models/contact/schemas.d.ts +66 -0
- package/esm/src/models/contact/schemas.d.ts.map +1 -0
- package/esm/src/models/contact/schemas.js +64 -0
- package/esm/src/models/contact/validation.d.ts +37 -0
- package/esm/src/models/contact/validation.d.ts.map +1 -0
- package/esm/src/models/contact/validation.js +139 -0
- package/esm/src/models/contact/validation.test.d.ts.map +1 -0
- package/esm/src/models/index.d.ts +6 -0
- package/esm/src/models/index.d.ts.map +1 -0
- package/esm/src/models/index.js +5 -0
- package/esm/src/models/payout/api.d.ts +29 -0
- package/esm/src/models/payout/api.d.ts.map +1 -0
- package/esm/src/models/payout/api.js +1 -0
- package/esm/src/models/payout/channel.d.ts +58 -0
- package/esm/src/models/payout/channel.d.ts.map +1 -0
- package/esm/src/models/payout/channel.js +46 -0
- package/esm/src/models/payout/derivatives/payout.d.ts +156 -0
- package/esm/src/models/payout/derivatives/payout.d.ts.map +1 -0
- package/esm/src/models/payout/derivatives/payout.js +261 -0
- package/esm/src/models/payout/derivatives/payout.test.d.ts.map +1 -0
- package/esm/src/models/payout/index.d.ts +6 -0
- package/esm/src/models/payout/index.d.ts.map +1 -0
- package/esm/src/models/payout/index.js +5 -0
- package/esm/src/models/payout/schemas.d.ts +154 -0
- package/esm/src/models/payout/schemas.d.ts.map +1 -0
- package/esm/src/models/payout/schemas.js +103 -0
- package/esm/src/models/payout/status.d.ts +31 -0
- package/esm/src/models/payout/status.d.ts.map +1 -0
- package/esm/src/models/payout/status.js +32 -0
- package/esm/src/models/permission.d.ts +42 -0
- package/esm/src/models/permission.d.ts.map +1 -0
- package/esm/src/models/permission.js +37 -0
- package/esm/src/models/user/index.d.ts +3 -0
- package/esm/src/models/user/index.d.ts.map +1 -0
- package/esm/src/models/user/index.js +2 -0
- package/esm/src/models/user/profile.d.ts +38 -0
- package/esm/src/models/user/profile.d.ts.map +1 -0
- package/esm/src/models/user/profile.js +25 -0
- package/esm/src/models/user/user.d.ts +80 -0
- package/esm/src/models/user/user.d.ts.map +1 -0
- package/esm/src/models/user/user.js +149 -0
- package/esm/src/models/wallet/guards.d.ts +11 -0
- package/esm/src/models/wallet/guards.d.ts.map +1 -0
- package/esm/src/models/wallet/guards.js +14 -0
- package/esm/src/models/wallet/index.d.ts +4 -0
- package/esm/src/models/wallet/index.d.ts.map +1 -0
- package/esm/src/models/wallet/index.js +3 -0
- package/esm/src/models/wallet/schemas.d.ts +50 -0
- package/esm/src/models/wallet/schemas.d.ts.map +1 -0
- package/esm/src/models/wallet/schemas.js +64 -0
- package/esm/src/models/wallet/statement.d.ts +27 -0
- package/esm/src/models/wallet/statement.d.ts.map +1 -0
- package/esm/src/models/wallet/statement.js +13 -0
- package/esm/src/shared/base_repository.d.ts +56 -0
- package/esm/src/shared/base_repository.d.ts.map +1 -0
- package/esm/src/shared/base_repository.js +95 -0
- package/esm/src/shared/common_responses.d.ts +13 -0
- package/esm/src/shared/common_responses.d.ts.map +1 -0
- package/esm/src/shared/common_responses.js +10 -0
- package/esm/src/shared/index.d.ts +3 -0
- package/esm/src/shared/index.d.ts.map +1 -0
- package/esm/src/shared/index.js +2 -0
- package/package.json +40 -0
- package/script/_dnt.test_shims.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
- package/script/mod.d.ts +7 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +22 -0
- package/script/package.json +3 -0
- package/script/src/errors/api_error.d.ts +63 -0
- package/script/src/errors/api_error.d.ts.map +1 -0
- package/script/src/errors/api_error.js +94 -0
- package/script/src/errors/index.d.ts +3 -0
- package/script/src/errors/index.d.ts.map +1 -0
- package/script/src/errors/index.js +18 -0
- package/script/src/errors/permission_error.d.ts +48 -0
- package/script/src/errors/permission_error.d.ts.map +1 -0
- package/script/src/errors/permission_error.js +74 -0
- package/script/src/features/auth/contract.d.ts +123 -0
- package/script/src/features/auth/contract.d.ts.map +1 -0
- package/script/src/features/auth/contract.js +53 -0
- package/script/src/features/auth/index.d.ts +2 -0
- package/script/src/features/auth/index.d.ts.map +1 -0
- package/script/src/features/auth/index.js +17 -0
- package/script/src/features/auth/manager.d.ts +71 -0
- package/script/src/features/auth/manager.d.ts.map +1 -0
- package/script/src/features/auth/manager.js +122 -0
- package/script/src/features/auth/repository.d.ts +30 -0
- package/script/src/features/auth/repository.d.ts.map +1 -0
- package/script/src/features/auth/repository.js +98 -0
- package/script/src/features/contact/contract.d.ts +170 -0
- package/script/src/features/contact/contract.d.ts.map +1 -0
- package/script/src/features/contact/contract.js +52 -0
- package/script/src/features/contact/index.d.ts +2 -0
- package/script/src/features/contact/index.d.ts.map +1 -0
- package/script/src/features/contact/index.js +17 -0
- package/script/src/features/contact/repository.d.ts +47 -0
- package/script/src/features/contact/repository.d.ts.map +1 -0
- package/script/src/features/contact/repository.js +98 -0
- package/script/src/features/files-gen/contract.d.ts +67 -0
- package/script/src/features/files-gen/contract.d.ts.map +1 -0
- package/script/src/features/files-gen/contract.js +43 -0
- package/script/src/features/files-gen/repository.d.ts +47 -0
- package/script/src/features/files-gen/repository.d.ts.map +1 -0
- package/script/src/features/files-gen/repository.js +52 -0
- package/script/src/features/payout/contract.d.ts +623 -0
- package/script/src/features/payout/contract.d.ts.map +1 -0
- package/script/src/features/payout/contract.js +78 -0
- package/script/src/features/payout/index.d.ts +2 -0
- package/script/src/features/payout/index.d.ts.map +1 -0
- package/script/src/features/payout/index.js +17 -0
- package/script/src/features/payout/repository.d.ts +62 -0
- package/script/src/features/payout/repository.d.ts.map +1 -0
- package/script/src/features/payout/repository.js +162 -0
- package/script/src/features/wallet/contract.d.ts +103 -0
- package/script/src/features/wallet/contract.d.ts.map +1 -0
- package/script/src/features/wallet/contract.js +38 -0
- package/script/src/features/wallet/index.d.ts +2 -0
- package/script/src/features/wallet/index.d.ts.map +1 -0
- package/script/src/features/wallet/index.js +17 -0
- package/script/src/features/wallet/repository.d.ts +74 -0
- package/script/src/features/wallet/repository.d.ts.map +1 -0
- package/script/src/features/wallet/repository.js +136 -0
- package/script/src/models/contact/derivatives/contact.d.ts +168 -0
- package/script/src/models/contact/derivatives/contact.d.ts.map +1 -0
- package/script/src/models/contact/derivatives/contact.js +264 -0
- package/script/src/models/contact/derivatives/contact.test.d.ts.map +1 -0
- package/script/src/models/contact/derivatives/contact_info.d.ts +188 -0
- package/script/src/models/contact/derivatives/contact_info.d.ts.map +1 -0
- package/script/src/models/contact/derivatives/contact_info.js +260 -0
- package/script/src/models/contact/derivatives/contact_info.test.d.ts.map +1 -0
- package/script/src/models/contact/index.d.ts +5 -0
- package/script/src/models/contact/index.d.ts.map +1 -0
- package/script/src/models/contact/index.js +20 -0
- package/script/src/models/contact/schemas.d.ts +66 -0
- package/script/src/models/contact/schemas.d.ts.map +1 -0
- package/script/src/models/contact/schemas.js +67 -0
- package/script/src/models/contact/validation.d.ts +37 -0
- package/script/src/models/contact/validation.d.ts.map +1 -0
- package/script/src/models/contact/validation.js +146 -0
- package/script/src/models/contact/validation.test.d.ts.map +1 -0
- package/script/src/models/index.d.ts +6 -0
- package/script/src/models/index.d.ts.map +1 -0
- package/script/src/models/index.js +21 -0
- package/script/src/models/payout/api.d.ts +29 -0
- package/script/src/models/payout/api.d.ts.map +1 -0
- package/script/src/models/payout/api.js +2 -0
- package/script/src/models/payout/channel.d.ts +58 -0
- package/script/src/models/payout/channel.d.ts.map +1 -0
- package/script/src/models/payout/channel.js +49 -0
- package/script/src/models/payout/derivatives/payout.d.ts +156 -0
- package/script/src/models/payout/derivatives/payout.d.ts.map +1 -0
- package/script/src/models/payout/derivatives/payout.js +265 -0
- package/script/src/models/payout/derivatives/payout.test.d.ts.map +1 -0
- package/script/src/models/payout/index.d.ts +6 -0
- package/script/src/models/payout/index.d.ts.map +1 -0
- package/script/src/models/payout/index.js +21 -0
- package/script/src/models/payout/schemas.d.ts +154 -0
- package/script/src/models/payout/schemas.d.ts.map +1 -0
- package/script/src/models/payout/schemas.js +106 -0
- package/script/src/models/payout/status.d.ts +31 -0
- package/script/src/models/payout/status.d.ts.map +1 -0
- package/script/src/models/payout/status.js +35 -0
- package/script/src/models/permission.d.ts +42 -0
- package/script/src/models/permission.d.ts.map +1 -0
- package/script/src/models/permission.js +40 -0
- package/script/src/models/user/index.d.ts +3 -0
- package/script/src/models/user/index.d.ts.map +1 -0
- package/script/src/models/user/index.js +18 -0
- package/script/src/models/user/profile.d.ts +38 -0
- package/script/src/models/user/profile.d.ts.map +1 -0
- package/script/src/models/user/profile.js +28 -0
- package/script/src/models/user/user.d.ts +80 -0
- package/script/src/models/user/user.d.ts.map +1 -0
- package/script/src/models/user/user.js +153 -0
- package/script/src/models/wallet/guards.d.ts +11 -0
- package/script/src/models/wallet/guards.d.ts.map +1 -0
- package/script/src/models/wallet/guards.js +17 -0
- package/script/src/models/wallet/index.d.ts +4 -0
- package/script/src/models/wallet/index.d.ts.map +1 -0
- package/script/src/models/wallet/index.js +19 -0
- package/script/src/models/wallet/schemas.d.ts +50 -0
- package/script/src/models/wallet/schemas.d.ts.map +1 -0
- package/script/src/models/wallet/schemas.js +67 -0
- package/script/src/models/wallet/statement.d.ts +27 -0
- package/script/src/models/wallet/statement.d.ts.map +1 -0
- package/script/src/models/wallet/statement.js +16 -0
- package/script/src/shared/base_repository.d.ts +56 -0
- package/script/src/shared/base_repository.d.ts.map +1 -0
- package/script/src/shared/base_repository.js +99 -0
- package/script/src/shared/common_responses.d.ts +13 -0
- package/script/src/shared/common_responses.d.ts.map +1 -0
- package/script/src/shared/common_responses.js +13 -0
- package/script/src/shared/index.d.ts +3 -0
- package/script/src/shared/index.d.ts.map +1 -0
- package/script/src/shared/index.js +18 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PAYOUT_APPROVAL_STATUS, PAYOUT_STATUS } from "./status.js";
|
|
3
|
+
/**
|
|
4
|
+
* Type definition for identifier schema
|
|
5
|
+
* Used for tracking who created or actioned a payout
|
|
6
|
+
* Contains a name and unique identity string
|
|
7
|
+
*/
|
|
8
|
+
type IdentifierType = z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
identity: z.ZodString;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Type definition for payout status enum
|
|
14
|
+
* Represents all possible states of a payout:
|
|
15
|
+
*
|
|
16
|
+
* @see {@link PAYOUT_STATUS} for the enum definition in "@models/payout/status.ts"
|
|
17
|
+
*/
|
|
18
|
+
type PayoutStatusType = z.ZodEnum<[
|
|
19
|
+
typeof PAYOUT_STATUS.CREATED,
|
|
20
|
+
typeof PAYOUT_STATUS.PAID,
|
|
21
|
+
typeof PAYOUT_STATUS.FAILED,
|
|
22
|
+
typeof PAYOUT_STATUS.REJECTED,
|
|
23
|
+
typeof PAYOUT_STATUS.PENDING
|
|
24
|
+
]>;
|
|
25
|
+
/**
|
|
26
|
+
* Type definition for payout approval status enum
|
|
27
|
+
* Represents the approval state of a payout:
|
|
28
|
+
*
|
|
29
|
+
* @see {@link PAYOUT_APPROVAL_STATUS} for the enum definition in "@models/payout/status.ts"
|
|
30
|
+
*/
|
|
31
|
+
type ApprovalPayoutStatusType = z.ZodEnum<[
|
|
32
|
+
typeof PAYOUT_APPROVAL_STATUS.APPROVED,
|
|
33
|
+
typeof PAYOUT_APPROVAL_STATUS.PENDING,
|
|
34
|
+
typeof PAYOUT_APPROVAL_STATUS.REJECTED
|
|
35
|
+
]>;
|
|
36
|
+
/**
|
|
37
|
+
* Type definition for payout input schema
|
|
38
|
+
* Extends the base payout type with payee information required for creating new payouts
|
|
39
|
+
*
|
|
40
|
+
* @extends {BasePayoutType}
|
|
41
|
+
* @property {z.ZodString} payeeName - Name of the payment recipient
|
|
42
|
+
*/
|
|
43
|
+
type PayoutInputType = z.ZodObject<{
|
|
44
|
+
channel: z.ZodString;
|
|
45
|
+
msisdn: z.ZodString;
|
|
46
|
+
amount: z.ZodNumber;
|
|
47
|
+
description: z.ZodString;
|
|
48
|
+
notes: Optional<z.ZodString>;
|
|
49
|
+
payeeName: z.ZodString;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Type definition for complete payout schema
|
|
53
|
+
* Extends the base payout type with additional fields for tracking
|
|
54
|
+
* the full lifecycle of a payout transaction
|
|
55
|
+
*
|
|
56
|
+
* @extends {BasePayoutType}
|
|
57
|
+
* @property {z.ZodString} id - Unique identifier for the payout
|
|
58
|
+
* @property {z.ZodString} profileId - ID of the profile initiating the payout
|
|
59
|
+
* @property {z.ZodString} payeeName - Name of the payment recipient
|
|
60
|
+
* @property {PayoutStatusType} status - Current status of the payout
|
|
61
|
+
* @property {z.ZodString} statusMessage - Detailed message about the current status
|
|
62
|
+
* @property {z.ZodString} partnerReference - Optional reference from payment partner
|
|
63
|
+
* @property {z.ZodDate} createdAt - Timestamp of payout creation
|
|
64
|
+
* @property {z.ZodDate} updatedAt - Timestamp of last payout update
|
|
65
|
+
* @property {ApprovalPayoutStatusType} approvalStatus - Current approval state
|
|
66
|
+
* @property {IdentifierType} createdBy - User who created the payout
|
|
67
|
+
* @property {IdentifierType} actionedBy - User who last actioned the payout
|
|
68
|
+
*/
|
|
69
|
+
type PayoutType = z.ZodObject<{
|
|
70
|
+
channel: z.ZodString;
|
|
71
|
+
msisdn: z.ZodString;
|
|
72
|
+
amount: z.ZodNumber;
|
|
73
|
+
description: z.ZodString;
|
|
74
|
+
notes: Optional<z.ZodString>;
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
profileId: z.ZodString;
|
|
77
|
+
payeeName: z.ZodString;
|
|
78
|
+
status: PayoutStatusType;
|
|
79
|
+
statusMessage: z.ZodString;
|
|
80
|
+
partnerReference: Optional<z.ZodString>;
|
|
81
|
+
createdAt: z.ZodDate;
|
|
82
|
+
updatedAt: z.ZodDate;
|
|
83
|
+
approvalStatus: ApprovalPayoutStatusType;
|
|
84
|
+
createdBy: Optional<IdentifierType>;
|
|
85
|
+
actionedBy: Optional<IdentifierType>;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Type representing a Zod schema that transforms nullable values to undefined
|
|
89
|
+
* @template T - The original Zod schema type
|
|
90
|
+
* @property {z.ZodNullable<T>} - The nullable version of the input schema
|
|
91
|
+
* @property {T["_output"] | undefined} - The output type, allowing the original type or undefined
|
|
92
|
+
* @property {T["_input"] | null} - The input type, allowing the original type or null
|
|
93
|
+
*/
|
|
94
|
+
type MakeOptionalResult<T extends z.ZodType> = z.ZodEffects<z.ZodNullable<T>, T["_output"] | undefined, T["_input"] | null>;
|
|
95
|
+
/**
|
|
96
|
+
* Type representing a fully optional field that transforms nulls to undefined
|
|
97
|
+
* @template T - The original Zod schema type
|
|
98
|
+
* Combines MakeOptionalResult with ZodOptional to allow both:
|
|
99
|
+
* 1. The field to be optional (can be omitted from object)
|
|
100
|
+
* 2. When present, the value can be null (transformed to undefined) or the original type
|
|
101
|
+
*/
|
|
102
|
+
type Optional<T extends z.ZodType> = z.ZodOptional<MakeOptionalResult<T>>;
|
|
103
|
+
/**
|
|
104
|
+
* Schema for identifying users in the payout process
|
|
105
|
+
* Used to track who created or actioned a payout
|
|
106
|
+
*/
|
|
107
|
+
declare const identifierSchema: IdentifierType;
|
|
108
|
+
/**
|
|
109
|
+
* Type definition inferred from identifierSchema
|
|
110
|
+
* Represents the structure of a user who actions the payout
|
|
111
|
+
*/
|
|
112
|
+
type PayoutApprover = z.infer<typeof identifierSchema>;
|
|
113
|
+
/**
|
|
114
|
+
* Type definition inferred from payoutInputSchema
|
|
115
|
+
* Represents the structure of data required to create a new payout
|
|
116
|
+
*/
|
|
117
|
+
type PayoutInput = z.infer<typeof payoutInputSchema>;
|
|
118
|
+
/**
|
|
119
|
+
* Schema for creating a new payout
|
|
120
|
+
* Extends base payout schema with payee information
|
|
121
|
+
*/
|
|
122
|
+
declare const payoutInputSchema: PayoutInputType;
|
|
123
|
+
/**
|
|
124
|
+
* Type definition inferred from payoutSchema
|
|
125
|
+
* Represents the complete payout record structure
|
|
126
|
+
*/
|
|
127
|
+
type PayoutData = z.infer<typeof payoutSchema>;
|
|
128
|
+
/**
|
|
129
|
+
* Schema for complete payout record
|
|
130
|
+
* Extends base payout schema with additional fields for:
|
|
131
|
+
* - Identification (id, profileId)
|
|
132
|
+
* - Status tracking
|
|
133
|
+
* - Timestamps
|
|
134
|
+
* - Approval information
|
|
135
|
+
* - User tracking (created by, actioned by)
|
|
136
|
+
*/
|
|
137
|
+
declare const payoutSchema: PayoutType;
|
|
138
|
+
/**
|
|
139
|
+
* Export object containing all payout-related schemas
|
|
140
|
+
* Used for validation and type checking throughout the application
|
|
141
|
+
*/
|
|
142
|
+
export declare const PayoutSchemas: {
|
|
143
|
+
readonly payoutData: PayoutType;
|
|
144
|
+
readonly payoutInput: PayoutInputType;
|
|
145
|
+
readonly payoutTransactionStatus: PayoutStatusType;
|
|
146
|
+
readonly payoutApprovalStatus: ApprovalPayoutStatusType;
|
|
147
|
+
readonly payoutApprover: IdentifierType;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Export types for use in other parts of the application
|
|
151
|
+
* These types can be used for type checking and documentation
|
|
152
|
+
*/
|
|
153
|
+
export type { PayoutApprover, PayoutData, PayoutInput };
|
|
154
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/schemas.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PAYOUT_APPROVAL_STATUS, PAYOUT_STATUS, } from "./status.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Zod schema that transforms null values to undefined
|
|
5
|
+
* This is useful when dealing with APIs that return null but you want to use undefined in your codebase
|
|
6
|
+
*
|
|
7
|
+
* @template T - The type of Zod schema being transformed
|
|
8
|
+
* @param {T} schema - The original Zod schema to transform
|
|
9
|
+
* @returns {MakeOptionalResult<T>} A new schema that:
|
|
10
|
+
* - Accepts the original type or null as input
|
|
11
|
+
* - Outputs the original type or undefined
|
|
12
|
+
* - Automatically transforms null to undefined during validation
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const userSchema = z.object({
|
|
16
|
+
* name: makeOptional(z.string()), // accepts: string | null, outputs: string | undefined
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // These are all valid:
|
|
20
|
+
* userSchema.parse({ name: "John" }) // { name: "John" }
|
|
21
|
+
* userSchema.parse({ name: null }) // { name: undefined }
|
|
22
|
+
*/
|
|
23
|
+
const makeOptional = (schema) => schema.nullable().transform((val) => val === null ? undefined : val);
|
|
24
|
+
/**
|
|
25
|
+
* Schema for identifying users in the payout process
|
|
26
|
+
* Used to track who created or actioned a payout
|
|
27
|
+
*/
|
|
28
|
+
const identifierSchema = z.object({
|
|
29
|
+
name: z.string(),
|
|
30
|
+
identity: z.string(),
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Schema for payout status
|
|
34
|
+
* Defines all possible states a payout can be in
|
|
35
|
+
*/
|
|
36
|
+
const payoutStatusSchema = z.enum([
|
|
37
|
+
PAYOUT_STATUS.CREATED,
|
|
38
|
+
PAYOUT_STATUS.PAID,
|
|
39
|
+
PAYOUT_STATUS.FAILED,
|
|
40
|
+
PAYOUT_STATUS.REJECTED,
|
|
41
|
+
PAYOUT_STATUS.PENDING,
|
|
42
|
+
]);
|
|
43
|
+
/**
|
|
44
|
+
* Schema for payout approval status
|
|
45
|
+
* Defines all possible approval states
|
|
46
|
+
*/
|
|
47
|
+
const approvalPayoutStatusSchema = z.enum([
|
|
48
|
+
PAYOUT_APPROVAL_STATUS.APPROVED,
|
|
49
|
+
PAYOUT_APPROVAL_STATUS.PENDING,
|
|
50
|
+
PAYOUT_APPROVAL_STATUS.REJECTED,
|
|
51
|
+
]);
|
|
52
|
+
/**
|
|
53
|
+
* Base schema for payout operations
|
|
54
|
+
* Contains common fields used across all payout operations
|
|
55
|
+
*/
|
|
56
|
+
const basePayoutSchema = z.object({
|
|
57
|
+
channel: z.string(),
|
|
58
|
+
msisdn: z.string(),
|
|
59
|
+
amount: z.coerce.number(),
|
|
60
|
+
description: z.string(),
|
|
61
|
+
notes: makeOptional(z.string()).optional(),
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* Schema for creating a new payout
|
|
65
|
+
* Extends base payout schema with payee information
|
|
66
|
+
*/
|
|
67
|
+
const payoutInputSchema = basePayoutSchema.extend({
|
|
68
|
+
payeeName: z.string(),
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Schema for complete payout record
|
|
72
|
+
* Extends base payout schema with additional fields for:
|
|
73
|
+
* - Identification (id, profileId)
|
|
74
|
+
* - Status tracking
|
|
75
|
+
* - Timestamps
|
|
76
|
+
* - Approval information
|
|
77
|
+
* - User tracking (created by, actioned by)
|
|
78
|
+
*/
|
|
79
|
+
const payoutSchema = basePayoutSchema.extend({
|
|
80
|
+
id: z.string(),
|
|
81
|
+
profileId: z.string(),
|
|
82
|
+
payeeName: z.string(),
|
|
83
|
+
status: payoutStatusSchema,
|
|
84
|
+
statusMessage: z.string(),
|
|
85
|
+
partnerReference: makeOptional(z.string()).optional(),
|
|
86
|
+
createdAt: z.coerce.date(),
|
|
87
|
+
updatedAt: z.coerce.date(),
|
|
88
|
+
actionedAt: makeOptional(z.coerce.date()).optional(),
|
|
89
|
+
approvalStatus: approvalPayoutStatusSchema,
|
|
90
|
+
createdBy: makeOptional(identifierSchema).optional(),
|
|
91
|
+
actionedBy: makeOptional(identifierSchema).optional(),
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* Export object containing all payout-related schemas
|
|
95
|
+
* Used for validation and type checking throughout the application
|
|
96
|
+
*/
|
|
97
|
+
export const PayoutSchemas = {
|
|
98
|
+
payoutData: payoutSchema, // Complete payout record schema
|
|
99
|
+
payoutInput: payoutInputSchema, // New payout input schema
|
|
100
|
+
payoutTransactionStatus: payoutStatusSchema, // Payout status enum schema
|
|
101
|
+
payoutApprovalStatus: approvalPayoutStatusSchema, // Approval status enum schema
|
|
102
|
+
payoutApprover: identifierSchema, // Identifier schema for approvers
|
|
103
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the current status of a payout transaction.
|
|
3
|
+
* @enum {string}
|
|
4
|
+
* @readonly
|
|
5
|
+
*/
|
|
6
|
+
export declare enum PAYOUT_STATUS {
|
|
7
|
+
/** Payout is awaiting processing */
|
|
8
|
+
PENDING = "PENDING",
|
|
9
|
+
/** Payout has been successfully processed */
|
|
10
|
+
PAID = "PAID",
|
|
11
|
+
/** Payout processing has failed */
|
|
12
|
+
FAILED = "FAILED",
|
|
13
|
+
/** Payout has been rejected */
|
|
14
|
+
REJECTED = "REJECTED",
|
|
15
|
+
/** Payout has been initially created but not yet processed */
|
|
16
|
+
CREATED = "CREATED"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Represents the approval status for payouts that require authorization.
|
|
20
|
+
* @enum {string}
|
|
21
|
+
* @readonly
|
|
22
|
+
*/
|
|
23
|
+
export declare enum PAYOUT_APPROVAL_STATUS {
|
|
24
|
+
/** Payout is awaiting approval decision */
|
|
25
|
+
PENDING = "Pending",
|
|
26
|
+
/** Payout has been approved */
|
|
27
|
+
APPROVED = "Approved",
|
|
28
|
+
/** Payout has been rejected during approval process */
|
|
29
|
+
REJECTED = "Rejected"
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,oCAAoC;IACpC,OAAO,YAAY;IACnB,6CAA6C;IAC7C,IAAI,SAAS;IACb,mCAAmC;IACnC,MAAM,WAAW;IACjB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,8DAA8D;IAC9D,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,oBAAY,sBAAsB;IAChC,2CAA2C;IAC3C,OAAO,YAAY;IACnB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,uDAAuD;IACvD,QAAQ,aAAa;CACtB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the current status of a payout transaction.
|
|
3
|
+
* @enum {string}
|
|
4
|
+
* @readonly
|
|
5
|
+
*/
|
|
6
|
+
export var PAYOUT_STATUS;
|
|
7
|
+
(function (PAYOUT_STATUS) {
|
|
8
|
+
/** Payout is awaiting processing */
|
|
9
|
+
PAYOUT_STATUS["PENDING"] = "PENDING";
|
|
10
|
+
/** Payout has been successfully processed */
|
|
11
|
+
PAYOUT_STATUS["PAID"] = "PAID";
|
|
12
|
+
/** Payout processing has failed */
|
|
13
|
+
PAYOUT_STATUS["FAILED"] = "FAILED";
|
|
14
|
+
/** Payout has been rejected */
|
|
15
|
+
PAYOUT_STATUS["REJECTED"] = "REJECTED";
|
|
16
|
+
/** Payout has been initially created but not yet processed */
|
|
17
|
+
PAYOUT_STATUS["CREATED"] = "CREATED";
|
|
18
|
+
})(PAYOUT_STATUS || (PAYOUT_STATUS = {}));
|
|
19
|
+
/**
|
|
20
|
+
* Represents the approval status for payouts that require authorization.
|
|
21
|
+
* @enum {string}
|
|
22
|
+
* @readonly
|
|
23
|
+
*/
|
|
24
|
+
export var PAYOUT_APPROVAL_STATUS;
|
|
25
|
+
(function (PAYOUT_APPROVAL_STATUS) {
|
|
26
|
+
/** Payout is awaiting approval decision */
|
|
27
|
+
PAYOUT_APPROVAL_STATUS["PENDING"] = "Pending";
|
|
28
|
+
/** Payout has been approved */
|
|
29
|
+
PAYOUT_APPROVAL_STATUS["APPROVED"] = "Approved";
|
|
30
|
+
/** Payout has been rejected during approval process */
|
|
31
|
+
PAYOUT_APPROVAL_STATUS["REJECTED"] = "Rejected";
|
|
32
|
+
})(PAYOUT_APPROVAL_STATUS || (PAYOUT_APPROVAL_STATUS = {}));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All Afloat Permissions
|
|
3
|
+
*/
|
|
4
|
+
export declare const Permissions: {
|
|
5
|
+
readonly Profile: {
|
|
6
|
+
readonly ViewCurrent: "profile.getCurrent";
|
|
7
|
+
readonly Update: "profile.update";
|
|
8
|
+
};
|
|
9
|
+
readonly Contact: {
|
|
10
|
+
readonly View: "contact.findById";
|
|
11
|
+
readonly List: "contact.findAll";
|
|
12
|
+
readonly Create: "contact.create";
|
|
13
|
+
readonly Update: "contact.update";
|
|
14
|
+
readonly Delete: "contact.delete";
|
|
15
|
+
};
|
|
16
|
+
readonly Payment: {
|
|
17
|
+
readonly View: "payment.findById";
|
|
18
|
+
readonly List: "payment.findAll";
|
|
19
|
+
readonly Create: "payment.create";
|
|
20
|
+
};
|
|
21
|
+
readonly Payout: {
|
|
22
|
+
readonly View: "payout.findById";
|
|
23
|
+
readonly List: "payout.findAll";
|
|
24
|
+
readonly Create: "payout.create";
|
|
25
|
+
readonly Approve: "payout.approve";
|
|
26
|
+
};
|
|
27
|
+
readonly Transfer: {
|
|
28
|
+
readonly View: "transfer.findById";
|
|
29
|
+
readonly List: "transfer.findAll";
|
|
30
|
+
readonly Create: "transfer.create";
|
|
31
|
+
readonly Approve: "transfer.approve";
|
|
32
|
+
};
|
|
33
|
+
readonly Wallet: {
|
|
34
|
+
readonly ViewBalance: "wallet.getBalance";
|
|
35
|
+
readonly ViewStatement: "wallet.getStatement";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Permission Type
|
|
40
|
+
*/
|
|
41
|
+
export type Permission = typeof Permissions.Profile[keyof typeof Permissions.Profile] | typeof Permissions.Contact[keyof typeof Permissions.Contact] | typeof Permissions.Payment[keyof typeof Permissions.Payment] | typeof Permissions.Payout[keyof typeof Permissions.Payout] | typeof Permissions.Transfer[keyof typeof Permissions.Transfer] | typeof Permissions.Wallet[keyof typeof Permissions.Wallet];
|
|
42
|
+
//# sourceMappingURL=permission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../../../src/src/models/permission.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCd,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAC5D,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAC5D,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAC5D,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,OAAO,WAAW,CAAC,MAAM,CAAC,GAC1D,OAAO,WAAW,CAAC,QAAQ,CAAC,MAAM,OAAO,WAAW,CAAC,QAAQ,CAAC,GAC9D,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All Afloat Permissions
|
|
3
|
+
*/
|
|
4
|
+
export const Permissions = {
|
|
5
|
+
Profile: {
|
|
6
|
+
ViewCurrent: "profile.getCurrent",
|
|
7
|
+
Update: "profile.update",
|
|
8
|
+
},
|
|
9
|
+
Contact: {
|
|
10
|
+
View: "contact.findById",
|
|
11
|
+
List: "contact.findAll",
|
|
12
|
+
Create: "contact.create",
|
|
13
|
+
Update: "contact.update",
|
|
14
|
+
Delete: "contact.delete",
|
|
15
|
+
},
|
|
16
|
+
Payment: {
|
|
17
|
+
View: "payment.findById",
|
|
18
|
+
List: "payment.findAll",
|
|
19
|
+
Create: "payment.create",
|
|
20
|
+
},
|
|
21
|
+
Payout: {
|
|
22
|
+
View: "payout.findById",
|
|
23
|
+
List: "payout.findAll",
|
|
24
|
+
Create: "payout.create",
|
|
25
|
+
Approve: "payout.approve",
|
|
26
|
+
},
|
|
27
|
+
Transfer: {
|
|
28
|
+
View: "transfer.findById",
|
|
29
|
+
List: "transfer.findAll",
|
|
30
|
+
Create: "transfer.create",
|
|
31
|
+
Approve: "transfer.approve",
|
|
32
|
+
},
|
|
33
|
+
Wallet: {
|
|
34
|
+
ViewBalance: "wallet.getBalance",
|
|
35
|
+
ViewStatement: "wallet.getStatement",
|
|
36
|
+
},
|
|
37
|
+
}; // Make it deeply readonly
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/user/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Type definition for profile schema using Zod.
|
|
4
|
+
* This type helper ensures type safety when implementing the actual schema.
|
|
5
|
+
*/
|
|
6
|
+
type ProfileType = z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
firstName: z.ZodString;
|
|
9
|
+
lastName: z.ZodString;
|
|
10
|
+
displayName: z.ZodString;
|
|
11
|
+
phone: z.ZodString;
|
|
12
|
+
accountNo: z.ZodString;
|
|
13
|
+
email: z.ZodString;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Zod schema for validating user profile data.
|
|
17
|
+
* Defines validation rules and constraints for each profile field.
|
|
18
|
+
*
|
|
19
|
+
* @const {ProfileType}
|
|
20
|
+
*
|
|
21
|
+
* @property {string} id - Unique identifier for the profile
|
|
22
|
+
* @property {string} firstName - User's first name
|
|
23
|
+
* @property {string} lastName - User's last name
|
|
24
|
+
* @property {string} displayName - User's display name
|
|
25
|
+
* @property {string} phone - User's contact phone number
|
|
26
|
+
* @property {string} accountNo - User's account number
|
|
27
|
+
* @property {string} email - User's email address
|
|
28
|
+
*/
|
|
29
|
+
export declare const profileSchema: ProfileType;
|
|
30
|
+
/**
|
|
31
|
+
* TypeScript type representing a validated user profile.
|
|
32
|
+
* Use this type for profile instances that have been validated against the schema.
|
|
33
|
+
*
|
|
34
|
+
* @see {@link profileSchema} for validation rules
|
|
35
|
+
*/
|
|
36
|
+
export type Profile = z.infer<typeof profileSchema>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../src/src/models/user/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,KAAK,WAAW,GAAG,CAAC,CAAC,SAAS,CAAC;IAC7B,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC;IAChB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC;IACtB,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;IACzB,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC;IACnB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC;CACpB,CAAC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,EAAE,WAS1B,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for validating user profile data.
|
|
4
|
+
* Defines validation rules and constraints for each profile field.
|
|
5
|
+
*
|
|
6
|
+
* @const {ProfileType}
|
|
7
|
+
*
|
|
8
|
+
* @property {string} id - Unique identifier for the profile
|
|
9
|
+
* @property {string} firstName - User's first name
|
|
10
|
+
* @property {string} lastName - User's last name
|
|
11
|
+
* @property {string} displayName - User's display name
|
|
12
|
+
* @property {string} phone - User's contact phone number
|
|
13
|
+
* @property {string} accountNo - User's account number
|
|
14
|
+
* @property {string} email - User's email address
|
|
15
|
+
*/
|
|
16
|
+
export const profileSchema = z.object({
|
|
17
|
+
id: z.string().uuid("Invalid profile ID format"),
|
|
18
|
+
firstName: z.string().min(1, "First name is required"),
|
|
19
|
+
lastName: z.string().min(1, "Last name is required"),
|
|
20
|
+
displayName: z.string().min(1, "Display name is required"),
|
|
21
|
+
phone: z.string().min(1, "Phone number is required")
|
|
22
|
+
.regex(/^\+?[\d\s-]+$/, "Invalid phone number format"),
|
|
23
|
+
accountNo: z.string().min(1, "Account number is required"),
|
|
24
|
+
email: z.string().email("Invalid email format"),
|
|
25
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Profile } from "./profile.js";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a user in Afloat
|
|
4
|
+
*
|
|
5
|
+
* This class centralizes user-related logic, simplifying interaction
|
|
6
|
+
* with user-related data and ensuring consistent permission checks across the application.
|
|
7
|
+
*/
|
|
8
|
+
export declare class User {
|
|
9
|
+
/**
|
|
10
|
+
* Logged-in user name
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Logged-in identity: phone-number or email address
|
|
15
|
+
*/
|
|
16
|
+
identity: string;
|
|
17
|
+
/**
|
|
18
|
+
* The user's Afloat profile, containing personal information such as name, contact details, and account information.
|
|
19
|
+
*/
|
|
20
|
+
profile: Profile;
|
|
21
|
+
/**
|
|
22
|
+
* The user's authentication token. This token must be passed in the request headers
|
|
23
|
+
* for all authenticated API endpoints.
|
|
24
|
+
*/
|
|
25
|
+
token: string;
|
|
26
|
+
/**
|
|
27
|
+
* Indicates whether the user is required to change their default password.
|
|
28
|
+
*
|
|
29
|
+
* Afloat users are initially provided with a default username and password. After the first
|
|
30
|
+
* successful login, `resetPassword` will be set to `true` to prompt the user to set a new password.
|
|
31
|
+
*/
|
|
32
|
+
resetPassword: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* A map of permission keys to boolean values, indicating whether the user has access
|
|
35
|
+
* to specific actions or features in the system.
|
|
36
|
+
*/
|
|
37
|
+
private permissionsMap;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new instance of the `User` class.
|
|
40
|
+
*
|
|
41
|
+
* @param userData - An object of type `CoreUser` containing the user's profile, token,
|
|
42
|
+
* permissions (access list), and the `resetPassword` flag.
|
|
43
|
+
*/
|
|
44
|
+
constructor(data: {
|
|
45
|
+
profile: Profile;
|
|
46
|
+
token: string;
|
|
47
|
+
access: string[];
|
|
48
|
+
resetPassword: boolean;
|
|
49
|
+
loginCredentials: {
|
|
50
|
+
name: string;
|
|
51
|
+
identity: string;
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Checks if the user has a specific permission.
|
|
56
|
+
*
|
|
57
|
+
* @param permission - The permission key to check.
|
|
58
|
+
* @returns `true` if the user has the specified permission, otherwise `false`.
|
|
59
|
+
*/
|
|
60
|
+
can(permission: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Serializes the `User` instance to a JSON string.
|
|
63
|
+
*
|
|
64
|
+
* @returns A JSON string representation of the `User` instance, including:
|
|
65
|
+
* - `profile`: The user's profile information.
|
|
66
|
+
* - `token`: The user's authentication token.
|
|
67
|
+
* - `resetPassword`: Indicates whether the user must reset their password.
|
|
68
|
+
* - `permissions`: An array of permission keys the user has.
|
|
69
|
+
*/
|
|
70
|
+
toJSON(): string;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new `User` instance from a JSON string.
|
|
73
|
+
*
|
|
74
|
+
* @param jsonString - A JSON string containing user data.
|
|
75
|
+
* @returns A `User` instance reconstructed from the JSON data.
|
|
76
|
+
* @throws Will throw an error if the JSON data is invalid or incomplete.
|
|
77
|
+
*/
|
|
78
|
+
static fromJSON(jsonString: string): User;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../src/src/models/user/user.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,IAAI;IACf;;OAEG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACI,QAAQ,EAAE,MAAM,CAAC;IAExB;;OAEG;IACI,OAAO,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACI,KAAK,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACI,aAAa,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,OAAO,CAAC,cAAc,CAA0B;IAEhD;;;;;OAKG;gBACS,IAAI,EAAE;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,aAAa,EAAE,OAAO,CAAC;QACvB,gBAAgB,EAAE;YAChB,IAAI,EAAE,MAAM,CAAC;YACb,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;KACH;IAqBD;;;;;OAKG;IACI,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAIvC;;;;;;;;OAQG;IACI,MAAM,IAAI,MAAM;IAavB;;;;;;OAMG;WACW,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;CA4BjD"}
|