@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,94 @@
|
|
|
1
|
+
import { BaseRepository } from "../../shared/base_repository.js";
|
|
2
|
+
import { contract } from "./contract.js";
|
|
3
|
+
import { Contact, } from "../../models/contact/index.js";
|
|
4
|
+
import { AfloatAuth } from "../auth/index.js";
|
|
5
|
+
import { Permissions } from "../../models/index.js";
|
|
6
|
+
import { PermissionError } from "../../errors/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* Repository class for managing `Contact` data through API interactions.
|
|
9
|
+
* Extends the `BaseRepository` to leverage shared functionality.
|
|
10
|
+
*/
|
|
11
|
+
export class ContactRepository extends BaseRepository {
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of `ContactRepository` using the contact contract.
|
|
14
|
+
*/
|
|
15
|
+
constructor() {
|
|
16
|
+
super("contact", contract);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new contact record.
|
|
20
|
+
* @param {ContactInput} input - The data required to create a new contact.
|
|
21
|
+
* @returns {Promise<Contact>} A promise that resolves to the newly created contact.
|
|
22
|
+
* @throws {APIError} If the response status code is not 201.
|
|
23
|
+
*/
|
|
24
|
+
async create(input) {
|
|
25
|
+
if (!AfloatAuth.instance.checkPermission(Permissions.Contact.Create)) {
|
|
26
|
+
throw new PermissionError({
|
|
27
|
+
message: "You are not authorized to add contacts.",
|
|
28
|
+
requiredPermissions: [Permissions.Contact.Create],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const result = await this.client.postContact({ body: input });
|
|
32
|
+
const data = this.handleResponse(result, 201);
|
|
33
|
+
return Contact.create(data);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Updates an existing contact record by ID.
|
|
37
|
+
* @param {string} id - The unique identifier of the contact to edit.
|
|
38
|
+
* @param {ContactInput} input - The data to update the contact with.
|
|
39
|
+
* @returns {Promise<Contact>} A promise that resolves to the updated contact.
|
|
40
|
+
* @throws {APIError} If the response status code is not 200.
|
|
41
|
+
*/
|
|
42
|
+
async edit(id, input) {
|
|
43
|
+
if (!AfloatAuth.instance.checkPermission(Permissions.Contact.Update)) {
|
|
44
|
+
throw new PermissionError({
|
|
45
|
+
message: "You are not authorized to update contacts.",
|
|
46
|
+
requiredPermissions: [Permissions.Contact.Update],
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const result = await this.client.editContact({
|
|
50
|
+
params: { id },
|
|
51
|
+
body: input,
|
|
52
|
+
});
|
|
53
|
+
const data = this.handleResponse(result, 200);
|
|
54
|
+
return Contact.create(data);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Deletes a contact record by ID.
|
|
58
|
+
* @param {string} id - The unique identifier of the contact to remove.
|
|
59
|
+
* @returns {Promise<void>} A promise that resolves when the deletion is complete.
|
|
60
|
+
* @throws {APIError} If the response status code is not 200.
|
|
61
|
+
*/
|
|
62
|
+
async remove(id) {
|
|
63
|
+
if (!AfloatAuth.instance.checkPermission(Permissions.Contact.Delete)) {
|
|
64
|
+
throw new PermissionError({
|
|
65
|
+
message: "You are not authorized to delete contacts.",
|
|
66
|
+
requiredPermissions: [Permissions.Contact.Delete],
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const result = await this.client.deleteContact({ params: { id } });
|
|
70
|
+
this.handleResponse(result, 200);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves all contacts
|
|
74
|
+
* Results are ordered in descending order by default.
|
|
75
|
+
*
|
|
76
|
+
* @returns {Promise<Contact[]>} A promise that resolves to an array of contacts.
|
|
77
|
+
* @throws {APIError} If the response status code is not 200 or the range is invalid.
|
|
78
|
+
* @example
|
|
79
|
+
* const repository = new ContactRepository();
|
|
80
|
+
* repository.getAll().then(contacts => console.log(contacts));
|
|
81
|
+
*/
|
|
82
|
+
async getAll() {
|
|
83
|
+
if (!AfloatAuth.instance.checkPermission(Permissions.Contact.List)) {
|
|
84
|
+
throw new PermissionError({
|
|
85
|
+
message: "You are not authorized to view contacts.",
|
|
86
|
+
requiredPermissions: [Permissions.Contact.List],
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const query = { orderByDesc: "createdAt" };
|
|
90
|
+
const result = await this.client.getContacts({ query });
|
|
91
|
+
const data = this.handleResponse(result, 200);
|
|
92
|
+
return Contact.createMany(data);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { STATEMENT_OUTPUT_TYPE } from "../../models/wallet/index.js";
|
|
3
|
+
export declare const contract: {
|
|
4
|
+
genStatementPDF: {
|
|
5
|
+
method: "POST";
|
|
6
|
+
body: z.ZodObject<{
|
|
7
|
+
end_date: z.ZodDate;
|
|
8
|
+
start_date: z.ZodDate;
|
|
9
|
+
account_no: z.ZodOptional<z.ZodString>;
|
|
10
|
+
return_file_type: z.ZodEnum<[STATEMENT_OUTPUT_TYPE.EXCEL, STATEMENT_OUTPUT_TYPE.PDF]>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
end_date: Date;
|
|
13
|
+
start_date: Date;
|
|
14
|
+
return_file_type: STATEMENT_OUTPUT_TYPE;
|
|
15
|
+
account_no?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
end_date: Date;
|
|
18
|
+
start_date: Date;
|
|
19
|
+
return_file_type: STATEMENT_OUTPUT_TYPE;
|
|
20
|
+
account_no?: string | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
path: "/statement";
|
|
23
|
+
responses: {
|
|
24
|
+
201: z.ZodObject<{
|
|
25
|
+
file: z.ZodString;
|
|
26
|
+
file_extension: z.ZodString;
|
|
27
|
+
mime_type: z.ZodString;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
file: string;
|
|
30
|
+
file_extension: string;
|
|
31
|
+
mime_type: string;
|
|
32
|
+
}, {
|
|
33
|
+
file: string;
|
|
34
|
+
file_extension: string;
|
|
35
|
+
mime_type: string;
|
|
36
|
+
}>;
|
|
37
|
+
202: z.ZodObject<{
|
|
38
|
+
message: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
message: string;
|
|
41
|
+
}, {
|
|
42
|
+
message: string;
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
genAccountDetailsPDF: {
|
|
47
|
+
method: "POST";
|
|
48
|
+
body: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
49
|
+
path: "/account_details";
|
|
50
|
+
responses: {
|
|
51
|
+
201: z.ZodObject<{
|
|
52
|
+
file: z.ZodString;
|
|
53
|
+
file_extension: z.ZodString;
|
|
54
|
+
mime_type: z.ZodString;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
file: string;
|
|
57
|
+
file_extension: string;
|
|
58
|
+
mime_type: string;
|
|
59
|
+
}, {
|
|
60
|
+
file: string;
|
|
61
|
+
file_extension: string;
|
|
62
|
+
mime_type: string;
|
|
63
|
+
}>;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/files-gen/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCnB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { initContract } from "@ts-rest/core";
|
|
3
|
+
import { STATEMENT_OUTPUT_TYPE } from "../../models/wallet/index.js";
|
|
4
|
+
export const contract = initContract().router({
|
|
5
|
+
genStatementPDF: {
|
|
6
|
+
method: "POST",
|
|
7
|
+
path: "/statement",
|
|
8
|
+
body: z.object({
|
|
9
|
+
end_date: z.date(),
|
|
10
|
+
start_date: z.date(),
|
|
11
|
+
account_no: z.string().optional(),
|
|
12
|
+
return_file_type: z.enum([
|
|
13
|
+
STATEMENT_OUTPUT_TYPE.EXCEL,
|
|
14
|
+
STATEMENT_OUTPUT_TYPE.PDF,
|
|
15
|
+
]),
|
|
16
|
+
}),
|
|
17
|
+
responses: {
|
|
18
|
+
201: z.object({
|
|
19
|
+
file: z.string(),
|
|
20
|
+
file_extension: z.string(),
|
|
21
|
+
mime_type: z.string(),
|
|
22
|
+
}),
|
|
23
|
+
202: z.object({
|
|
24
|
+
message: z.string(),
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
genAccountDetailsPDF: {
|
|
29
|
+
method: "POST",
|
|
30
|
+
path: "/account_details",
|
|
31
|
+
body: z.object({}),
|
|
32
|
+
responses: {
|
|
33
|
+
201: z.object({
|
|
34
|
+
file: z.string(),
|
|
35
|
+
file_extension: z.string(),
|
|
36
|
+
mime_type: z.string(),
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { contract } from "./contract.js";
|
|
2
|
+
import { BaseRepository } from "../../shared/index.js";
|
|
3
|
+
import type { ClientInferRequest, ClientInferResponseBody } from "@ts-rest/core";
|
|
4
|
+
import type { StatementFile } from "../../models/wallet/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Type definition for statement generation input parameters.
|
|
7
|
+
* Inferred from the contract's genStatementPDF endpoint request body.
|
|
8
|
+
* @typedef {ClientInferRequest<typeof contract.genStatementPDF>["body"]} GenStatementInput
|
|
9
|
+
*/
|
|
10
|
+
type GenStatementInput = ClientInferRequest<typeof contract.genStatementPDF>["body"];
|
|
11
|
+
/**
|
|
12
|
+
* Type definition for account details response.
|
|
13
|
+
* Inferred from the contract's genAccountDetailsPDF endpoint response body.
|
|
14
|
+
* @typedef {ClientInferResponseBody<typeof contract.genAccountDetailsPDF>} GenAccountDetailsResponse
|
|
15
|
+
*/
|
|
16
|
+
type GenAccountDetailsResponse = ClientInferResponseBody<typeof contract.genAccountDetailsPDF>;
|
|
17
|
+
/**
|
|
18
|
+
* Repository class for managing file generation operations including
|
|
19
|
+
* statement PDFs and account details documents.
|
|
20
|
+
* @extends {BaseRepository<typeof contract>}
|
|
21
|
+
*/
|
|
22
|
+
export declare class AfloatFilesRepo extends BaseRepository<typeof contract> {
|
|
23
|
+
/**
|
|
24
|
+
* Creates an instance of AfloatFilesRepo initialized with the files generation contract.
|
|
25
|
+
* Configures the repository with the PDF maker service endpoint.
|
|
26
|
+
*/
|
|
27
|
+
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* Generates and downloads a statement PDF based on the provided parameters.
|
|
30
|
+
* @param {GenStatementInput} body - The statement generation parameters
|
|
31
|
+
* @param {Date} body.start_date - Start date for the statement period
|
|
32
|
+
* @param {Date} body.end_date - End date for the statement period
|
|
33
|
+
* @param {string} body.return_file_type - Desired file format for the statement
|
|
34
|
+
* @param {string} [body.account_no] - Optional account number to generate statement for
|
|
35
|
+
* @throws {APIError} If the statement generation operation fails
|
|
36
|
+
* @returns {Promise<StatementFile>} The generated statement file
|
|
37
|
+
*/
|
|
38
|
+
downloadStatement(body: GenStatementInput): Promise<StatementFile>;
|
|
39
|
+
/**
|
|
40
|
+
* Generates a PDF containing detailed account information.
|
|
41
|
+
* @throws {APIError} If the PDF generation operation fails
|
|
42
|
+
* @returns {Promise<GenAccountDetailsResponse>} The generated account details PDF
|
|
43
|
+
*/
|
|
44
|
+
genAccountDetailsPDF(): Promise<GenAccountDetailsResponse>;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/files-gen/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;;GAIG;AACH,KAAK,iBAAiB,GAAG,kBAAkB,CACzC,OAAO,QAAQ,CAAC,eAAe,CAChC,CAAC,MAAM,CAAC,CAAC;AAEV;;;;GAIG;AACH,KAAK,yBAAyB,GAAG,uBAAuB,CACtD,OAAO,QAAQ,CAAC,oBAAoB,CACrC,CAAC;AAEF;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,cAAc,CAAC,OAAO,QAAQ,CAAC;IAClE;;;OAGG;;IAOH;;;;;;;;;OASG;IACG,iBAAiB,CACrB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,aAAa,CAAC;IAUzB;;;;OAIG;IACG,oBAAoB,IAAI,OAAO,CAAC,yBAAyB,CAAC;CAWjE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { contract } from "./contract.js";
|
|
2
|
+
import { BaseRepository } from "../../shared/index.js";
|
|
3
|
+
import { APIError } from "../../errors/api_error.js";
|
|
4
|
+
/**
|
|
5
|
+
* Repository class for managing file generation operations including
|
|
6
|
+
* statement PDFs and account details documents.
|
|
7
|
+
* @extends {BaseRepository<typeof contract>}
|
|
8
|
+
*/
|
|
9
|
+
export class AfloatFilesRepo extends BaseRepository {
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of AfloatFilesRepo initialized with the files generation contract.
|
|
12
|
+
* Configures the repository with the PDF maker service endpoint.
|
|
13
|
+
*/
|
|
14
|
+
constructor() {
|
|
15
|
+
super("wallet", contract, {
|
|
16
|
+
root: "https://api.afloat.money/pdf-maker/afloat",
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generates and downloads a statement PDF based on the provided parameters.
|
|
21
|
+
* @param {GenStatementInput} body - The statement generation parameters
|
|
22
|
+
* @param {Date} body.start_date - Start date for the statement period
|
|
23
|
+
* @param {Date} body.end_date - End date for the statement period
|
|
24
|
+
* @param {string} body.return_file_type - Desired file format for the statement
|
|
25
|
+
* @param {string} [body.account_no] - Optional account number to generate statement for
|
|
26
|
+
* @throws {APIError} If the statement generation operation fails
|
|
27
|
+
* @returns {Promise<StatementFile>} The generated statement file
|
|
28
|
+
*/
|
|
29
|
+
async downloadStatement(body) {
|
|
30
|
+
const result = await this.client.genStatementPDF({ body });
|
|
31
|
+
if (result.status === 201) {
|
|
32
|
+
return result.body;
|
|
33
|
+
}
|
|
34
|
+
throw APIError.unknown("An error occurred while generating statement PDF");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generates a PDF containing detailed account information.
|
|
38
|
+
* @throws {APIError} If the PDF generation operation fails
|
|
39
|
+
* @returns {Promise<GenAccountDetailsResponse>} The generated account details PDF
|
|
40
|
+
*/
|
|
41
|
+
async genAccountDetailsPDF() {
|
|
42
|
+
const result = await this.client.genAccountDetailsPDF();
|
|
43
|
+
if (result.status === 201) {
|
|
44
|
+
return result.body;
|
|
45
|
+
}
|
|
46
|
+
throw APIError.unknown("An error occurred while generating account details PDF");
|
|
47
|
+
}
|
|
48
|
+
}
|