@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,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.identityContract = exports.authContract = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const core_1 = require("@ts-rest/core");
|
|
6
|
+
const index_js_1 = require("../../models/index.js");
|
|
7
|
+
/**
|
|
8
|
+
* Auth API contract
|
|
9
|
+
*/
|
|
10
|
+
exports.authContract = (0, core_1.initContract)().router({
|
|
11
|
+
logIn: {
|
|
12
|
+
method: "POST",
|
|
13
|
+
path: "/login",
|
|
14
|
+
body: zod_1.z.object({
|
|
15
|
+
type: zod_1.z.string().default("password"),
|
|
16
|
+
identity: zod_1.z.string().email(),
|
|
17
|
+
password: zod_1.z.string(),
|
|
18
|
+
}),
|
|
19
|
+
responses: {
|
|
20
|
+
201: zod_1.z.object({
|
|
21
|
+
profile: index_js_1.profileSchema,
|
|
22
|
+
token: zod_1.z.string(),
|
|
23
|
+
access: zod_1.z.array(zod_1.z.string()),
|
|
24
|
+
resetPassword: zod_1.z.boolean(),
|
|
25
|
+
}),
|
|
26
|
+
400: zod_1.z.object({}),
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
resetPassword: {
|
|
30
|
+
method: "PUT",
|
|
31
|
+
path: "/password",
|
|
32
|
+
body: zod_1.z.object({
|
|
33
|
+
currentPassword: zod_1.z.string(),
|
|
34
|
+
newPassword: zod_1.z.string(),
|
|
35
|
+
}),
|
|
36
|
+
responses: {},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
exports.identityContract = (0, core_1.initContract)().router({
|
|
40
|
+
getUserCredentials: {
|
|
41
|
+
method: "GET",
|
|
42
|
+
path: "/me",
|
|
43
|
+
headers: zod_1.z.object({
|
|
44
|
+
token: zod_1.z.string(),
|
|
45
|
+
}),
|
|
46
|
+
responses: {
|
|
47
|
+
200: zod_1.z.object({
|
|
48
|
+
name: zod_1.z.string(),
|
|
49
|
+
identity: zod_1.z.string(),
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/features/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./manager.js"), exports);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { User } from "../../models/index.js";
|
|
2
|
+
import type { Permission } from "../../models/permission.js";
|
|
3
|
+
/**
|
|
4
|
+
* Singleton class responsible for user authentication and session management.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AfloatAuth {
|
|
7
|
+
private static _instance;
|
|
8
|
+
/**
|
|
9
|
+
* Private constructor to prevent direct instantiation.
|
|
10
|
+
*/
|
|
11
|
+
private constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Gets the singleton instance of AfloatAuth.
|
|
14
|
+
* @returns {AfloatAuth} The singleton instance.
|
|
15
|
+
*/
|
|
16
|
+
static get instance(): AfloatAuth;
|
|
17
|
+
/**
|
|
18
|
+
* Fetches the authentication repository.
|
|
19
|
+
* @private
|
|
20
|
+
* @returns {AuthRepository} The repository instance for authentication-related API calls.
|
|
21
|
+
*/
|
|
22
|
+
private get repo();
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the current user's authentication token.
|
|
25
|
+
* @returns {string | undefined} The token of the currently authenticated user.
|
|
26
|
+
*/
|
|
27
|
+
getUserToken(): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the currently logged-in user.
|
|
30
|
+
* @returns {User | undefined} The current user object, or `undefined` if no user is logged in.
|
|
31
|
+
*/
|
|
32
|
+
get currentUser(): User | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* React hook that retrieves the currently authenticated user from the global store.
|
|
35
|
+
*
|
|
36
|
+
* @returns {User | undefined} The current user object if authenticated, or `undefined` if no user is logged in.
|
|
37
|
+
*/
|
|
38
|
+
useCurrentUser(): User | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if the current user has the specified permission.
|
|
41
|
+
* @param {Permission} perm - The permission to check.
|
|
42
|
+
* @returns {boolean} `true` if the user has the permission, otherwise `false`.
|
|
43
|
+
*/
|
|
44
|
+
checkPermission(perm: Permission): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Logs in a user with the provided email and password.
|
|
47
|
+
* @param {string} email - The user's email address.
|
|
48
|
+
* @param {string} password - The user's password.
|
|
49
|
+
* @returns {Promise<User>} A promise that resolves to the authenticated user.
|
|
50
|
+
* @throws Will throw an error if authentication fails.
|
|
51
|
+
*/
|
|
52
|
+
logIn(email: string, password: string): Promise<User>;
|
|
53
|
+
/**
|
|
54
|
+
* Resets the user's password.
|
|
55
|
+
* @param {string} current - The current password.
|
|
56
|
+
* @param {string} updated - The new password.
|
|
57
|
+
* @returns {Promise<boolean>} A promise that resolves to `true` if the operation is successful.
|
|
58
|
+
* @throws Will throw an error if the reset fails.
|
|
59
|
+
*/
|
|
60
|
+
resetPassword(current: string, updated: string): Promise<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* Logs out the current user and clears session data.
|
|
63
|
+
*/
|
|
64
|
+
logOut(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Clears saved authentication data from the store and session storage.
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
private clearSavedData;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/src/features/auth/manager.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAI7D;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAa;IAErC;;OAEG;IACH,OAAO;IAEP;;;OAGG;IACH,WAAkB,QAAQ,IAAI,UAAU,CAEvC;IAED;;;;OAIG;IACH,OAAO,KAAK,IAAI,GAEf;IAED;;;OAGG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS;IAIlC;;;OAGG;IACH,IAAI,WAAW,IAAI,IAAI,GAAG,SAAS,CAElC;IACD;;;;OAIG;IACH,cAAc,IAAI,IAAI,GAAG,SAAS;IAIlC;;;;OAIG;IACH,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO;IAI1C;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3D;;;;;;OAMG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMvE;;OAEG;IACH,MAAM,IAAI,IAAI;IAId;;;OAGG;IACH,OAAO,CAAC,cAAc;CAIvB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AfloatAuth = void 0;
|
|
4
|
+
const zustand_1 = require("zustand");
|
|
5
|
+
const middleware_1 = require("zustand/middleware");
|
|
6
|
+
const repository_js_1 = require("./repository.js");
|
|
7
|
+
const index_js_1 = require("../../models/index.js");
|
|
8
|
+
const AUTH_STORE_SESSION_STORAGE_KEY = "auth-store";
|
|
9
|
+
/**
|
|
10
|
+
* Singleton class responsible for user authentication and session management.
|
|
11
|
+
*/
|
|
12
|
+
class AfloatAuth {
|
|
13
|
+
/**
|
|
14
|
+
* Private constructor to prevent direct instantiation.
|
|
15
|
+
*/
|
|
16
|
+
constructor() { }
|
|
17
|
+
/**
|
|
18
|
+
* Gets the singleton instance of AfloatAuth.
|
|
19
|
+
* @returns {AfloatAuth} The singleton instance.
|
|
20
|
+
*/
|
|
21
|
+
static get instance() {
|
|
22
|
+
return this._instance || (this._instance = new this());
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Fetches the authentication repository.
|
|
26
|
+
* @private
|
|
27
|
+
* @returns {AuthRepository} The repository instance for authentication-related API calls.
|
|
28
|
+
*/
|
|
29
|
+
get repo() {
|
|
30
|
+
return new repository_js_1.AuthRepository();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves the current user's authentication token.
|
|
34
|
+
* @returns {string | undefined} The token of the currently authenticated user.
|
|
35
|
+
*/
|
|
36
|
+
getUserToken() {
|
|
37
|
+
return this.currentUser?.token;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Gets the currently logged-in user.
|
|
41
|
+
* @returns {User | undefined} The current user object, or `undefined` if no user is logged in.
|
|
42
|
+
*/
|
|
43
|
+
get currentUser() {
|
|
44
|
+
return store.getState().getUser();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* React hook that retrieves the currently authenticated user from the global store.
|
|
48
|
+
*
|
|
49
|
+
* @returns {User | undefined} The current user object if authenticated, or `undefined` if no user is logged in.
|
|
50
|
+
*/
|
|
51
|
+
useCurrentUser() {
|
|
52
|
+
return (0, zustand_1.useStore)(store).getUser();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Checks if the current user has the specified permission.
|
|
56
|
+
* @param {Permission} perm - The permission to check.
|
|
57
|
+
* @returns {boolean} `true` if the user has the permission, otherwise `false`.
|
|
58
|
+
*/
|
|
59
|
+
checkPermission(perm) {
|
|
60
|
+
return this.currentUser?.can(perm) ?? false;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Logs in a user with the provided email and password.
|
|
64
|
+
* @param {string} email - The user's email address.
|
|
65
|
+
* @param {string} password - The user's password.
|
|
66
|
+
* @returns {Promise<User>} A promise that resolves to the authenticated user.
|
|
67
|
+
* @throws Will throw an error if authentication fails.
|
|
68
|
+
*/
|
|
69
|
+
async logIn(email, password) {
|
|
70
|
+
const user = await this.repo.logIn(email, password);
|
|
71
|
+
this.clearSavedData();
|
|
72
|
+
store.getState().setUser(user);
|
|
73
|
+
return user;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Resets the user's password.
|
|
77
|
+
* @param {string} current - The current password.
|
|
78
|
+
* @param {string} updated - The new password.
|
|
79
|
+
* @returns {Promise<boolean>} A promise that resolves to `true` if the operation is successful.
|
|
80
|
+
* @throws Will throw an error if the reset fails.
|
|
81
|
+
*/
|
|
82
|
+
async resetPassword(current, updated) {
|
|
83
|
+
await this.repo.updatePassword(current, updated);
|
|
84
|
+
this.clearSavedData();
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Logs out the current user and clears session data.
|
|
89
|
+
*/
|
|
90
|
+
logOut() {
|
|
91
|
+
this.clearSavedData();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Clears saved authentication data from the store and session storage.
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
clearSavedData() {
|
|
98
|
+
store.getState().refresh();
|
|
99
|
+
sessionStorage.removeItem(AUTH_STORE_SESSION_STORAGE_KEY);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.AfloatAuth = AfloatAuth;
|
|
103
|
+
const initialState = { user: undefined };
|
|
104
|
+
const store = (0, zustand_1.create)((0, middleware_1.persist)((set, get) => ({
|
|
105
|
+
...initialState,
|
|
106
|
+
getUser: () => {
|
|
107
|
+
try {
|
|
108
|
+
const jsonUser = get().user;
|
|
109
|
+
if (jsonUser)
|
|
110
|
+
return index_js_1.User.fromJSON(jsonUser);
|
|
111
|
+
}
|
|
112
|
+
catch (_) {
|
|
113
|
+
console.log(_);
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
},
|
|
117
|
+
setUser: (user) => set({ user: user.toJSON() }),
|
|
118
|
+
refresh: () => set(initialState),
|
|
119
|
+
}), {
|
|
120
|
+
name: AUTH_STORE_SESSION_STORAGE_KEY,
|
|
121
|
+
storage: (0, middleware_1.createJSONStorage)(() => sessionStorage),
|
|
122
|
+
}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { User } from "../../models/index.js";
|
|
2
|
+
import { BaseRepository } from "../../shared/base_repository.js";
|
|
3
|
+
import { authContract } from "./contract.js";
|
|
4
|
+
/**
|
|
5
|
+
* Class representing the AuthRepository.
|
|
6
|
+
* Provides methods to handle authentication-related operations, such as login and password updates.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AuthRepository extends BaseRepository<typeof authContract> {
|
|
9
|
+
/**
|
|
10
|
+
* Initializes an instance of AuthRepository.
|
|
11
|
+
*/
|
|
12
|
+
constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Logs in a user with the provided email and password.
|
|
15
|
+
* @param email - The email of the user attempting to log in.
|
|
16
|
+
* @param password - The password of the user.
|
|
17
|
+
* @returns A promise that resolves to a User object on successful login.
|
|
18
|
+
* @throws {APIError} If the email or password is invalid, or if another error occurs during the login process.
|
|
19
|
+
*/
|
|
20
|
+
logIn(email: string, password: string): Promise<User>;
|
|
21
|
+
/**
|
|
22
|
+
* Updates the user's password.
|
|
23
|
+
* @param currentPassword - The user's current password.
|
|
24
|
+
* @param newPassword - The new password the user wants to set.
|
|
25
|
+
* @returns A promise that resolves to true if the password update is successful.
|
|
26
|
+
* @throws {APIError} If the current password is invalid or another error occurs during the update process.
|
|
27
|
+
*/
|
|
28
|
+
updatePassword(currentPassword: string, newPassword: string): Promise<boolean>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/auth/repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAoB,MAAM,eAAe,CAAC;AAO/D;;;GAGG;AACH,qBAAa,cAAe,SAAQ,cAAc,CAAC,OAAO,YAAY,CAAC;IACrE;;OAEG;;IAKH;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB3D;;;;;;OAMG;IACG,cAAc,CAClB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC;CAiBpB"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthRepository = void 0;
|
|
4
|
+
const index_js_1 = require("../../models/index.js");
|
|
5
|
+
const base_repository_js_1 = require("../../shared/base_repository.js");
|
|
6
|
+
const contract_js_1 = require("./contract.js");
|
|
7
|
+
const api_error_js_1 = require("../../errors/api_error.js");
|
|
8
|
+
/**
|
|
9
|
+
* Class representing the AuthRepository.
|
|
10
|
+
* Provides methods to handle authentication-related operations, such as login and password updates.
|
|
11
|
+
*/
|
|
12
|
+
class AuthRepository extends base_repository_js_1.BaseRepository {
|
|
13
|
+
/**
|
|
14
|
+
* Initializes an instance of AuthRepository.
|
|
15
|
+
*/
|
|
16
|
+
constructor() {
|
|
17
|
+
super("auth", contract_js_1.authContract);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Logs in a user with the provided email and password.
|
|
21
|
+
* @param email - The email of the user attempting to log in.
|
|
22
|
+
* @param password - The password of the user.
|
|
23
|
+
* @returns A promise that resolves to a User object on successful login.
|
|
24
|
+
* @throws {APIError} If the email or password is invalid, or if another error occurs during the login process.
|
|
25
|
+
*/
|
|
26
|
+
async logIn(email, password) {
|
|
27
|
+
const body = { type: "password", identity: email, password };
|
|
28
|
+
const result = await this.client.logIn({ body });
|
|
29
|
+
if (result.status === 400) {
|
|
30
|
+
throw new api_error_js_1.APIError({
|
|
31
|
+
message: "Invalid email or password",
|
|
32
|
+
statusCode: 400,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (result.status === 201) {
|
|
36
|
+
const repo = new LoginRepository();
|
|
37
|
+
const loginCredentials = await repo.getIdentity(result.body.token);
|
|
38
|
+
const user = new index_js_1.User({ ...result.body, loginCredentials });
|
|
39
|
+
return user;
|
|
40
|
+
}
|
|
41
|
+
throw new api_error_js_1.APIError({
|
|
42
|
+
message: "An error occurred while trying to log in",
|
|
43
|
+
statusCode: 502,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Updates the user's password.
|
|
48
|
+
* @param currentPassword - The user's current password.
|
|
49
|
+
* @param newPassword - The new password the user wants to set.
|
|
50
|
+
* @returns A promise that resolves to true if the password update is successful.
|
|
51
|
+
* @throws {APIError} If the current password is invalid or another error occurs during the update process.
|
|
52
|
+
*/
|
|
53
|
+
async updatePassword(currentPassword, newPassword) {
|
|
54
|
+
const result = await this.client.resetPassword({
|
|
55
|
+
body: { currentPassword, newPassword },
|
|
56
|
+
});
|
|
57
|
+
if (result.status === 200)
|
|
58
|
+
return true;
|
|
59
|
+
if (result.status === 400) {
|
|
60
|
+
throw new api_error_js_1.APIError({
|
|
61
|
+
message: "Invalid current password",
|
|
62
|
+
statusCode: 400,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
throw new api_error_js_1.APIError({
|
|
66
|
+
message: "An error occurred while trying to update password",
|
|
67
|
+
statusCode: 502,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.AuthRepository = AuthRepository;
|
|
72
|
+
/**
|
|
73
|
+
* Class representing the LoginRepository.
|
|
74
|
+
* Provides methods to retrieve user identity-related information.
|
|
75
|
+
*/
|
|
76
|
+
class LoginRepository extends base_repository_js_1.BaseRepository {
|
|
77
|
+
/**
|
|
78
|
+
* Initializes an instance of LoginRepository.
|
|
79
|
+
*/
|
|
80
|
+
constructor() {
|
|
81
|
+
super("login", contract_js_1.identityContract);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Retrieves the user's login credentials.
|
|
85
|
+
* @returns A promise that resolves to the user's login credentials on success.
|
|
86
|
+
* @throws {APIError} If an error occurs while retrieving the credentials.
|
|
87
|
+
*/
|
|
88
|
+
async getIdentity(token) {
|
|
89
|
+
const headers = { token };
|
|
90
|
+
const result = await this.client.getUserCredentials({ headers });
|
|
91
|
+
if (result.status === 200)
|
|
92
|
+
return result.body;
|
|
93
|
+
throw new api_error_js_1.APIError({
|
|
94
|
+
message: "An error occurred while trying to get login credentials",
|
|
95
|
+
statusCode: 502,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Contact API contract
|
|
4
|
+
* Defines the REST endpoints for managing contacts
|
|
5
|
+
*
|
|
6
|
+
* @property {Object} postContact - Create a new contact (POST /)
|
|
7
|
+
* @property {Object} editContact - Update an existing contact (PATCH /:id)
|
|
8
|
+
* @property {Object} getContacts - Retrieve contacts list (GET /)
|
|
9
|
+
* @property {Object} deleteContact - Delete a contact (DELETE /:id)
|
|
10
|
+
*/
|
|
11
|
+
export declare const contract: {
|
|
12
|
+
postContact: {
|
|
13
|
+
method: "POST";
|
|
14
|
+
body: z.ZodObject<{
|
|
15
|
+
displayName: z.ZodString;
|
|
16
|
+
accountNo: z.ZodString;
|
|
17
|
+
channel: z.ZodString;
|
|
18
|
+
type: z.ZodEnum<["Bank", "Mobile"]>;
|
|
19
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
20
|
+
displayName: string;
|
|
21
|
+
accountNo: string;
|
|
22
|
+
type: "Bank" | "Mobile";
|
|
23
|
+
channel: string;
|
|
24
|
+
}, {
|
|
25
|
+
displayName: string;
|
|
26
|
+
accountNo: string;
|
|
27
|
+
type: "Bank" | "Mobile";
|
|
28
|
+
channel: string;
|
|
29
|
+
}>;
|
|
30
|
+
path: "/";
|
|
31
|
+
responses: {
|
|
32
|
+
[x: number]: import("@ts-rest/core").AppRouteResponse;
|
|
33
|
+
201: z.ZodObject<{
|
|
34
|
+
displayName: z.ZodString;
|
|
35
|
+
accountNo: z.ZodString;
|
|
36
|
+
channel: z.ZodString;
|
|
37
|
+
type: z.ZodEnum<["Bank", "Mobile"]>;
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
profileId: z.ZodString;
|
|
40
|
+
createdAt: z.ZodDate;
|
|
41
|
+
updatedAt: z.ZodDate;
|
|
42
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
43
|
+
id: string;
|
|
44
|
+
displayName: string;
|
|
45
|
+
accountNo: string;
|
|
46
|
+
type: "Bank" | "Mobile";
|
|
47
|
+
channel: string;
|
|
48
|
+
profileId: string;
|
|
49
|
+
createdAt: Date;
|
|
50
|
+
updatedAt: Date;
|
|
51
|
+
}, {
|
|
52
|
+
id: string;
|
|
53
|
+
displayName: string;
|
|
54
|
+
accountNo: string;
|
|
55
|
+
type: "Bank" | "Mobile";
|
|
56
|
+
channel: string;
|
|
57
|
+
profileId: string;
|
|
58
|
+
createdAt: Date;
|
|
59
|
+
updatedAt: Date;
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
editContact: {
|
|
64
|
+
method: "PATCH";
|
|
65
|
+
body: z.ZodObject<{
|
|
66
|
+
displayName: z.ZodString;
|
|
67
|
+
accountNo: z.ZodString;
|
|
68
|
+
channel: z.ZodString;
|
|
69
|
+
type: z.ZodEnum<["Bank", "Mobile"]>;
|
|
70
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
71
|
+
displayName: string;
|
|
72
|
+
accountNo: string;
|
|
73
|
+
type: "Bank" | "Mobile";
|
|
74
|
+
channel: string;
|
|
75
|
+
}, {
|
|
76
|
+
displayName: string;
|
|
77
|
+
accountNo: string;
|
|
78
|
+
type: "Bank" | "Mobile";
|
|
79
|
+
channel: string;
|
|
80
|
+
}>;
|
|
81
|
+
path: "/:id";
|
|
82
|
+
responses: {
|
|
83
|
+
[x: number]: import("@ts-rest/core").AppRouteResponse;
|
|
84
|
+
200: z.ZodObject<{
|
|
85
|
+
displayName: z.ZodString;
|
|
86
|
+
accountNo: z.ZodString;
|
|
87
|
+
channel: z.ZodString;
|
|
88
|
+
type: z.ZodEnum<["Bank", "Mobile"]>;
|
|
89
|
+
id: z.ZodString;
|
|
90
|
+
profileId: z.ZodString;
|
|
91
|
+
createdAt: z.ZodDate;
|
|
92
|
+
updatedAt: z.ZodDate;
|
|
93
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
94
|
+
id: string;
|
|
95
|
+
displayName: string;
|
|
96
|
+
accountNo: string;
|
|
97
|
+
type: "Bank" | "Mobile";
|
|
98
|
+
channel: string;
|
|
99
|
+
profileId: string;
|
|
100
|
+
createdAt: Date;
|
|
101
|
+
updatedAt: Date;
|
|
102
|
+
}, {
|
|
103
|
+
id: string;
|
|
104
|
+
displayName: string;
|
|
105
|
+
accountNo: string;
|
|
106
|
+
type: "Bank" | "Mobile";
|
|
107
|
+
channel: string;
|
|
108
|
+
profileId: string;
|
|
109
|
+
createdAt: Date;
|
|
110
|
+
updatedAt: Date;
|
|
111
|
+
}>;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
getContacts: {
|
|
115
|
+
query: z.ZodObject<{
|
|
116
|
+
orderByDesc: z.ZodString;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
orderByDesc: string;
|
|
119
|
+
}, {
|
|
120
|
+
orderByDesc: string;
|
|
121
|
+
}>;
|
|
122
|
+
method: "GET";
|
|
123
|
+
path: "/";
|
|
124
|
+
responses: {
|
|
125
|
+
[x: number]: import("@ts-rest/core").AppRouteResponse;
|
|
126
|
+
200: z.ZodArray<z.ZodObject<{
|
|
127
|
+
displayName: z.ZodString;
|
|
128
|
+
accountNo: z.ZodString;
|
|
129
|
+
channel: z.ZodString;
|
|
130
|
+
type: z.ZodEnum<["Bank", "Mobile"]>;
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
profileId: z.ZodString;
|
|
133
|
+
createdAt: z.ZodDate;
|
|
134
|
+
updatedAt: z.ZodDate;
|
|
135
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
136
|
+
id: string;
|
|
137
|
+
displayName: string;
|
|
138
|
+
accountNo: string;
|
|
139
|
+
type: "Bank" | "Mobile";
|
|
140
|
+
channel: string;
|
|
141
|
+
profileId: string;
|
|
142
|
+
createdAt: Date;
|
|
143
|
+
updatedAt: Date;
|
|
144
|
+
}, {
|
|
145
|
+
id: string;
|
|
146
|
+
displayName: string;
|
|
147
|
+
accountNo: string;
|
|
148
|
+
type: "Bank" | "Mobile";
|
|
149
|
+
channel: string;
|
|
150
|
+
profileId: string;
|
|
151
|
+
createdAt: Date;
|
|
152
|
+
updatedAt: Date;
|
|
153
|
+
}>, "many">;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
deleteContact: {
|
|
157
|
+
method: "DELETE";
|
|
158
|
+
body: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
159
|
+
path: "/:id";
|
|
160
|
+
responses: {
|
|
161
|
+
[x: number]: import("@ts-rest/core").AppRouteResponse;
|
|
162
|
+
200: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Export type for use in client implementations
|
|
168
|
+
*/
|
|
169
|
+
export type ContactAPI = typeof contract;
|
|
170
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/contact/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCnB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,QAAQ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contract = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const core_1 = require("@ts-rest/core");
|
|
6
|
+
const index_js_1 = require("../../shared/index.js");
|
|
7
|
+
const index_js_2 = require("../../models/index.js");
|
|
8
|
+
/**
|
|
9
|
+
* Contact API contract
|
|
10
|
+
* Defines the REST endpoints for managing contacts
|
|
11
|
+
*
|
|
12
|
+
* @property {Object} postContact - Create a new contact (POST /)
|
|
13
|
+
* @property {Object} editContact - Update an existing contact (PATCH /:id)
|
|
14
|
+
* @property {Object} getContacts - Retrieve contacts list (GET /)
|
|
15
|
+
* @property {Object} deleteContact - Delete a contact (DELETE /:id)
|
|
16
|
+
*/
|
|
17
|
+
exports.contract = (0, core_1.initContract)().router({
|
|
18
|
+
postContact: {
|
|
19
|
+
method: "POST",
|
|
20
|
+
path: "/",
|
|
21
|
+
body: index_js_2.ContactSchemas.contactInput,
|
|
22
|
+
responses: {
|
|
23
|
+
201: index_js_2.ContactSchemas.contactData,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
editContact: {
|
|
27
|
+
method: "PATCH",
|
|
28
|
+
path: "/:id",
|
|
29
|
+
body: index_js_2.ContactSchemas.contactInput,
|
|
30
|
+
responses: {
|
|
31
|
+
200: index_js_2.ContactSchemas.contactData,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
getContacts: {
|
|
35
|
+
method: "GET",
|
|
36
|
+
path: "/",
|
|
37
|
+
query: zod_1.z.object({ orderByDesc: zod_1.z.string() }),
|
|
38
|
+
responses: {
|
|
39
|
+
200: zod_1.z.array(index_js_2.ContactSchemas.contactData),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
deleteContact: {
|
|
43
|
+
method: "DELETE",
|
|
44
|
+
path: "/:id",
|
|
45
|
+
body: zod_1.z.object({}),
|
|
46
|
+
responses: {
|
|
47
|
+
200: zod_1.z.object({}),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}, {
|
|
51
|
+
commonResponses: index_js_1.commonAPIResponses,
|
|
52
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/features/contact/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./repository.js"), exports);
|