@temboplus/afloat 0.1.81 → 0.2.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -42
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/lib/api/base-repository.d.ts +177 -0
- package/dist/lib/api/index.d.ts +1 -0
- package/{esm/src/errors/api_error.d.ts → dist/lib/error/error.api.d.ts} +0 -1
- package/{script/npm/src/src/errors/permission_error.d.ts → dist/lib/error/error.permission.d.ts} +1 -2
- package/dist/lib/error/error.utils.d.ts +22 -0
- package/dist/lib/error/index.d.ts +3 -0
- package/dist/lib/query/index.d.ts +4 -0
- package/dist/lib/query/pagination/pagination.d.ts +73 -0
- package/dist/lib/query/pagination/pagination.schemas.d.ts +83 -0
- package/dist/lib/query/query.builder.d.ts +75 -0
- package/dist/lib/query/query.types.d.ts +36 -0
- package/{esm/src/features/auth/contract.d.ts → dist/modules/auth/auth.contract.d.ts} +16 -19
- package/dist/modules/auth/auth.repository.d.ts +83 -0
- package/dist/modules/auth/company-membership.model.d.ts +171 -0
- package/dist/modules/auth/index.d.ts +3 -0
- package/dist/modules/auth/user.model.d.ts +363 -0
- package/dist/modules/beneficiary/beneficiary-info.model.d.ts +178 -0
- package/dist/modules/beneficiary/beneficiary-input-handler.d.ts +16 -0
- package/dist/modules/beneficiary/beneficiary.api-contract.d.ts +203 -0
- package/dist/modules/beneficiary/beneficiary.dtos.d.ts +84 -0
- package/dist/modules/beneficiary/beneficiary.model.d.ts +441 -0
- package/dist/modules/beneficiary/beneficiary.repository.d.ts +116 -0
- package/dist/modules/beneficiary/index.d.ts +6 -0
- package/dist/modules/login/index.d.ts +4 -0
- package/dist/modules/login/login.api-contract.d.ts +51 -0
- package/dist/modules/login/login.dtos.d.ts +85 -0
- package/dist/modules/login/login.model.d.ts +168 -0
- package/dist/modules/login/login.repository.d.ts +58 -0
- package/{esm/src/models/permission.d.ts → dist/modules/login/permission.type.d.ts} +9 -10
- package/dist/modules/payout/index.d.ts +5 -0
- package/dist/modules/payout/payout-channel-handler.d.ts +82 -0
- package/{esm/src/features/payout/contract.d.ts → dist/modules/payout/payout.api-contract.d.ts} +350 -207
- package/dist/modules/payout/payout.dtos.d.ts +607 -0
- package/dist/modules/payout/payout.model.d.ts +383 -0
- package/dist/modules/payout/payout.query.d.ts +134 -0
- package/dist/modules/payout/payout.repository.d.ts +204 -0
- package/dist/modules/profile/index.d.ts +3 -0
- package/{script/npm/src/src/features/auth/profile/contract.d.ts → dist/modules/profile/profile.api-contract.d.ts} +8 -6
- package/dist/modules/profile/profile.dtos.d.ts +80 -0
- package/{script/npm/src/src/models/user/profile.d.ts → dist/modules/profile/profile.model.d.ts} +81 -52
- package/dist/modules/profile/profile.repository.d.ts +56 -0
- package/dist/modules/team-member/index.d.ts +4 -0
- package/dist/modules/team-member/role.model.d.ts +61 -0
- package/{esm/src/features/admin/contract.d.ts → dist/modules/team-member/team-member.contract.d.ts} +229 -154
- package/dist/modules/team-member/team-member.dtos.d.ts +261 -0
- package/dist/modules/team-member/team-member.model.d.ts +237 -0
- package/dist/modules/team-member/team-member.repository.d.ts +179 -0
- package/dist/modules/wallet/index.d.ts +6 -0
- package/dist/modules/wallet/narration.model.d.ts +225 -0
- package/dist/modules/wallet/statement-entry.model.d.ts +299 -0
- package/{script/npm/src/src/features/wallet/contract.d.ts → dist/modules/wallet/wallet.contract.d.ts} +17 -15
- package/dist/modules/wallet/wallet.dtos.d.ts +204 -0
- package/{esm/src/models/wallet/wallet.d.ts → dist/modules/wallet/wallet.model.d.ts} +34 -40
- package/dist/modules/wallet/wallet.query.d.ts +95 -0
- package/dist/modules/wallet/wallet.repository.d.ts +205 -0
- package/dist/modules/wallet/wallet.utils.d.ts +17 -0
- package/package.json +49 -23
- package/LICENSE +0 -7
- package/esm/mod.d.ts +0 -8
- package/esm/mod.d.ts.map +0 -1
- package/esm/mod.js +0 -7
- package/esm/package.json +0 -3
- package/esm/src/errors/api_error.d.ts.map +0 -1
- package/esm/src/errors/api_error.js +0 -90
- package/esm/src/errors/index.d.ts +0 -3
- package/esm/src/errors/index.d.ts.map +0 -1
- package/esm/src/errors/index.js +0 -2
- package/esm/src/errors/permission_error.d.ts +0 -48
- package/esm/src/errors/permission_error.d.ts.map +0 -1
- package/esm/src/errors/permission_error.js +0 -70
- package/esm/src/features/admin/contract.d.ts.map +0 -1
- package/esm/src/features/admin/contract.js +0 -210
- package/esm/src/features/admin/index.d.ts +0 -4
- package/esm/src/features/admin/index.d.ts.map +0 -1
- package/esm/src/features/admin/index.js +0 -3
- package/esm/src/features/admin/repository.d.ts +0 -114
- package/esm/src/features/admin/repository.d.ts.map +0 -1
- package/esm/src/features/admin/repository.js +0 -248
- package/esm/src/features/admin/schemas.d.ts +0 -146
- package/esm/src/features/admin/schemas.d.ts.map +0 -1
- package/esm/src/features/admin/schemas.js +0 -206
- package/esm/src/features/auth/access/contract.d.ts +0 -14
- package/esm/src/features/auth/access/contract.d.ts.map +0 -1
- package/esm/src/features/auth/access/contract.js +0 -14
- package/esm/src/features/auth/access/repository.d.ts +0 -11
- package/esm/src/features/auth/access/repository.d.ts.map +0 -1
- package/esm/src/features/auth/access/repository.js +0 -25
- package/esm/src/features/auth/contract.d.ts.map +0 -1
- package/esm/src/features/auth/contract.js +0 -43
- package/esm/src/features/auth/identity/contract.d.ts +0 -23
- package/esm/src/features/auth/identity/contract.d.ts.map +0 -1
- package/esm/src/features/auth/identity/contract.js +0 -17
- package/esm/src/features/auth/identity/repository.d.ts +0 -22
- package/esm/src/features/auth/identity/repository.d.ts.map +0 -1
- package/esm/src/features/auth/identity/repository.js +0 -30
- package/esm/src/features/auth/index.d.ts +0 -6
- package/esm/src/features/auth/index.d.ts.map +0 -1
- package/esm/src/features/auth/index.js +0 -5
- package/esm/src/features/auth/manager.d.ts +0 -105
- package/esm/src/features/auth/manager.d.ts.map +0 -1
- package/esm/src/features/auth/manager.js +0 -181
- package/esm/src/features/auth/profile/contract.d.ts +0 -37
- package/esm/src/features/auth/profile/contract.d.ts.map +0 -1
- package/esm/src/features/auth/profile/contract.js +0 -14
- package/esm/src/features/auth/profile/repository.d.ts +0 -11
- package/esm/src/features/auth/profile/repository.d.ts.map +0 -1
- package/esm/src/features/auth/profile/repository.js +0 -25
- package/esm/src/features/auth/repository.d.ts +0 -30
- package/esm/src/features/auth/repository.d.ts.map +0 -1
- package/esm/src/features/auth/repository.js +0 -69
- package/esm/src/features/auth/storage/client_store.d.ts +0 -30
- package/esm/src/features/auth/storage/client_store.d.ts.map +0 -1
- package/esm/src/features/auth/storage/client_store.js +0 -46
- package/esm/src/features/auth/storage/client_token_handler.d.ts +0 -32
- package/esm/src/features/auth/storage/client_token_handler.d.ts.map +0 -1
- package/esm/src/features/auth/storage/client_token_handler.js +0 -36
- package/esm/src/features/auth/storage/server_store.d.ts +0 -24
- package/esm/src/features/auth/storage/server_store.d.ts.map +0 -1
- package/esm/src/features/auth/storage/server_store.js +0 -34
- package/esm/src/features/auth/storage/server_token_handler.d.ts +0 -36
- package/esm/src/features/auth/storage/server_token_handler.d.ts.map +0 -1
- package/esm/src/features/auth/storage/server_token_handler.js +0 -115
- package/esm/src/features/auth/storage/types.d.ts +0 -42
- package/esm/src/features/auth/storage/types.d.ts.map +0 -1
- package/esm/src/features/auth/storage/types.js +0 -1
- package/esm/src/features/contact/contract.d.ts +0 -170
- package/esm/src/features/contact/contract.d.ts.map +0 -1
- package/esm/src/features/contact/contract.js +0 -49
- package/esm/src/features/contact/index.d.ts +0 -2
- package/esm/src/features/contact/index.d.ts.map +0 -1
- package/esm/src/features/contact/index.js +0 -1
- package/esm/src/features/contact/repository.d.ts +0 -58
- package/esm/src/features/contact/repository.d.ts.map +0 -1
- package/esm/src/features/contact/repository.js +0 -108
- package/esm/src/features/payout/contract.d.ts.map +0 -1
- package/esm/src/features/payout/contract.js +0 -75
- package/esm/src/features/payout/index.d.ts +0 -2
- package/esm/src/features/payout/index.d.ts.map +0 -1
- package/esm/src/features/payout/index.js +0 -1
- package/esm/src/features/payout/repository.d.ts +0 -67
- package/esm/src/features/payout/repository.d.ts.map +0 -1
- package/esm/src/features/payout/repository.js +0 -179
- package/esm/src/features/wallet/contract.d.ts +0 -137
- package/esm/src/features/wallet/contract.d.ts.map +0 -1
- package/esm/src/features/wallet/contract.js +0 -38
- package/esm/src/features/wallet/index.d.ts +0 -2
- package/esm/src/features/wallet/index.d.ts.map +0 -1
- package/esm/src/features/wallet/index.js +0 -1
- package/esm/src/features/wallet/repository.d.ts +0 -57
- package/esm/src/features/wallet/repository.d.ts.map +0 -1
- package/esm/src/features/wallet/repository.js +0 -93
- package/esm/src/models/contact/derivatives/contact.d.ts +0 -172
- package/esm/src/models/contact/derivatives/contact.d.ts.map +0 -1
- package/esm/src/models/contact/derivatives/contact.js +0 -266
- package/esm/src/models/contact/derivatives/contact_info.d.ts +0 -188
- package/esm/src/models/contact/derivatives/contact_info.d.ts.map +0 -1
- package/esm/src/models/contact/derivatives/contact_info.js +0 -255
- package/esm/src/models/contact/index.d.ts +0 -5
- package/esm/src/models/contact/index.d.ts.map +0 -1
- package/esm/src/models/contact/index.js +0 -4
- package/esm/src/models/contact/schemas.d.ts +0 -66
- package/esm/src/models/contact/schemas.d.ts.map +0 -1
- package/esm/src/models/contact/schemas.js +0 -64
- package/esm/src/models/contact/validation.d.ts +0 -37
- package/esm/src/models/contact/validation.d.ts.map +0 -1
- package/esm/src/models/contact/validation.js +0 -146
- package/esm/src/models/index.d.ts +0 -7
- package/esm/src/models/index.d.ts.map +0 -1
- package/esm/src/models/index.js +0 -6
- package/esm/src/models/payout/api.d.ts +0 -29
- package/esm/src/models/payout/api.d.ts.map +0 -1
- package/esm/src/models/payout/api.js +0 -1
- package/esm/src/models/payout/channel.d.ts +0 -58
- package/esm/src/models/payout/channel.d.ts.map +0 -1
- package/esm/src/models/payout/channel.js +0 -53
- package/esm/src/models/payout/derivatives/payout.d.ts +0 -158
- package/esm/src/models/payout/derivatives/payout.d.ts.map +0 -1
- package/esm/src/models/payout/derivatives/payout.js +0 -271
- package/esm/src/models/payout/index.d.ts +0 -7
- package/esm/src/models/payout/index.d.ts.map +0 -1
- package/esm/src/models/payout/index.js +0 -6
- package/esm/src/models/payout/narration.d.ts +0 -164
- package/esm/src/models/payout/narration.d.ts.map +0 -1
- package/esm/src/models/payout/narration.js +0 -308
- package/esm/src/models/payout/schemas.d.ts +0 -156
- package/esm/src/models/payout/schemas.d.ts.map +0 -1
- package/esm/src/models/payout/schemas.js +0 -105
- package/esm/src/models/payout/status.d.ts +0 -33
- package/esm/src/models/payout/status.d.ts.map +0 -1
- package/esm/src/models/payout/status.js +0 -34
- package/esm/src/models/permission.d.ts.map +0 -1
- package/esm/src/models/permission.js +0 -50
- package/esm/src/models/role.d.ts +0 -21
- package/esm/src/models/role.d.ts.map +0 -1
- package/esm/src/models/role.js +0 -73
- package/esm/src/models/user/authenticated-user.d.ts +0 -77
- package/esm/src/models/user/authenticated-user.d.ts.map +0 -1
- package/esm/src/models/user/authenticated-user.js +0 -226
- package/esm/src/models/user/index.d.ts +0 -4
- package/esm/src/models/user/index.d.ts.map +0 -1
- package/esm/src/models/user/index.js +0 -3
- package/esm/src/models/user/managed-user.d.ts +0 -108
- package/esm/src/models/user/managed-user.d.ts.map +0 -1
- package/esm/src/models/user/managed-user.js +0 -255
- package/esm/src/models/user/profile.d.ts +0 -161
- package/esm/src/models/user/profile.d.ts.map +0 -1
- package/esm/src/models/user/profile.js +0 -334
- package/esm/src/models/wallet/index.d.ts +0 -4
- package/esm/src/models/wallet/index.d.ts.map +0 -1
- package/esm/src/models/wallet/index.js +0 -3
- package/esm/src/models/wallet/schemas.d.ts +0 -95
- package/esm/src/models/wallet/schemas.d.ts.map +0 -1
- package/esm/src/models/wallet/schemas.js +0 -35
- package/esm/src/models/wallet/statement_entry.d.ts +0 -160
- package/esm/src/models/wallet/statement_entry.d.ts.map +0 -1
- package/esm/src/models/wallet/statement_entry.js +0 -255
- package/esm/src/models/wallet/wallet.d.ts.map +0 -1
- package/esm/src/models/wallet/wallet.js +0 -279
- package/esm/src/shared/base_repository.d.ts +0 -80
- package/esm/src/shared/base_repository.d.ts.map +0 -1
- package/esm/src/shared/base_repository.js +0 -153
- package/esm/src/shared/common_responses.d.ts +0 -13
- package/esm/src/shared/common_responses.d.ts.map +0 -1
- package/esm/src/shared/common_responses.js +0 -10
- package/esm/src/shared/index.d.ts +0 -3
- package/esm/src/shared/index.d.ts.map +0 -1
- package/esm/src/shared/index.js +0 -2
- package/esm/src/shared/token_required_repository.d.ts +0 -78
- package/esm/src/shared/token_required_repository.d.ts.map +0 -1
- package/esm/src/shared/token_required_repository.js +0 -128
- package/script/mod.d.ts +0 -8
- package/script/mod.d.ts.map +0 -1
- package/script/mod.js +0 -23
- package/script/npm/src/mod.d.ts +0 -8
- package/script/npm/src/mod.d.ts.map +0 -1
- package/script/npm/src/mod.js +0 -23
- package/script/npm/src/src/errors/api_error.d.ts +0 -63
- package/script/npm/src/src/errors/api_error.d.ts.map +0 -1
- package/script/npm/src/src/errors/api_error.js +0 -94
- package/script/npm/src/src/errors/index.d.ts +0 -3
- package/script/npm/src/src/errors/index.d.ts.map +0 -1
- package/script/npm/src/src/errors/index.js +0 -18
- package/script/npm/src/src/errors/permission_error.d.ts.map +0 -1
- package/script/npm/src/src/errors/permission_error.js +0 -74
- package/script/npm/src/src/features/admin/contract.d.ts +0 -842
- package/script/npm/src/src/features/admin/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/admin/contract.js +0 -213
- package/script/npm/src/src/features/admin/index.d.ts +0 -4
- package/script/npm/src/src/features/admin/index.d.ts.map +0 -1
- package/script/npm/src/src/features/admin/index.js +0 -19
- package/script/npm/src/src/features/admin/repository.d.ts +0 -114
- package/script/npm/src/src/features/admin/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/admin/repository.js +0 -252
- package/script/npm/src/src/features/admin/schemas.d.ts +0 -146
- package/script/npm/src/src/features/admin/schemas.d.ts.map +0 -1
- package/script/npm/src/src/features/admin/schemas.js +0 -209
- package/script/npm/src/src/features/auth/access/contract.d.ts +0 -14
- package/script/npm/src/src/features/auth/access/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/access/contract.js +0 -17
- package/script/npm/src/src/features/auth/access/repository.d.ts +0 -11
- package/script/npm/src/src/features/auth/access/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/access/repository.js +0 -29
- package/script/npm/src/src/features/auth/contract.d.ts +0 -112
- package/script/npm/src/src/features/auth/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/contract.js +0 -46
- package/script/npm/src/src/features/auth/identity/contract.d.ts +0 -23
- package/script/npm/src/src/features/auth/identity/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/identity/contract.js +0 -20
- package/script/npm/src/src/features/auth/identity/repository.d.ts +0 -22
- package/script/npm/src/src/features/auth/identity/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/identity/repository.js +0 -34
- package/script/npm/src/src/features/auth/index.d.ts +0 -6
- package/script/npm/src/src/features/auth/index.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/index.js +0 -21
- package/script/npm/src/src/features/auth/manager.d.ts +0 -105
- package/script/npm/src/src/features/auth/manager.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/manager.js +0 -185
- package/script/npm/src/src/features/auth/profile/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/profile/contract.js +0 -17
- package/script/npm/src/src/features/auth/profile/repository.d.ts +0 -11
- package/script/npm/src/src/features/auth/profile/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/profile/repository.js +0 -29
- package/script/npm/src/src/features/auth/repository.d.ts +0 -30
- package/script/npm/src/src/features/auth/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/repository.js +0 -73
- package/script/npm/src/src/features/auth/storage/client_store.d.ts +0 -30
- package/script/npm/src/src/features/auth/storage/client_store.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/storage/client_store.js +0 -51
- package/script/npm/src/src/features/auth/storage/client_token_handler.d.ts +0 -32
- package/script/npm/src/src/features/auth/storage/client_token_handler.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/storage/client_token_handler.js +0 -40
- package/script/npm/src/src/features/auth/storage/server_store.d.ts +0 -24
- package/script/npm/src/src/features/auth/storage/server_store.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/storage/server_store.js +0 -38
- package/script/npm/src/src/features/auth/storage/server_token_handler.d.ts +0 -36
- package/script/npm/src/src/features/auth/storage/server_token_handler.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/storage/server_token_handler.js +0 -119
- package/script/npm/src/src/features/auth/storage/types.d.ts +0 -42
- package/script/npm/src/src/features/auth/storage/types.d.ts.map +0 -1
- package/script/npm/src/src/features/auth/storage/types.js +0 -2
- package/script/npm/src/src/features/contact/contract.d.ts +0 -170
- package/script/npm/src/src/features/contact/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/contact/contract.js +0 -52
- package/script/npm/src/src/features/contact/index.d.ts +0 -2
- package/script/npm/src/src/features/contact/index.d.ts.map +0 -1
- package/script/npm/src/src/features/contact/index.js +0 -17
- package/script/npm/src/src/features/contact/repository.d.ts +0 -58
- package/script/npm/src/src/features/contact/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/contact/repository.js +0 -112
- package/script/npm/src/src/features/payout/contract.d.ts +0 -623
- package/script/npm/src/src/features/payout/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/payout/contract.js +0 -78
- package/script/npm/src/src/features/payout/index.d.ts +0 -2
- package/script/npm/src/src/features/payout/index.d.ts.map +0 -1
- package/script/npm/src/src/features/payout/index.js +0 -17
- package/script/npm/src/src/features/payout/repository.d.ts +0 -67
- package/script/npm/src/src/features/payout/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/payout/repository.js +0 -183
- package/script/npm/src/src/features/wallet/contract.d.ts.map +0 -1
- package/script/npm/src/src/features/wallet/contract.js +0 -41
- package/script/npm/src/src/features/wallet/index.d.ts +0 -2
- package/script/npm/src/src/features/wallet/index.d.ts.map +0 -1
- package/script/npm/src/src/features/wallet/index.js +0 -17
- package/script/npm/src/src/features/wallet/repository.d.ts +0 -57
- package/script/npm/src/src/features/wallet/repository.d.ts.map +0 -1
- package/script/npm/src/src/features/wallet/repository.js +0 -97
- package/script/npm/src/src/models/contact/derivatives/contact.d.ts +0 -172
- package/script/npm/src/src/models/contact/derivatives/contact.d.ts.map +0 -1
- package/script/npm/src/src/models/contact/derivatives/contact.js +0 -270
- package/script/npm/src/src/models/contact/derivatives/contact_info.d.ts +0 -188
- package/script/npm/src/src/models/contact/derivatives/contact_info.d.ts.map +0 -1
- package/script/npm/src/src/models/contact/derivatives/contact_info.js +0 -260
- package/script/npm/src/src/models/contact/index.d.ts +0 -5
- package/script/npm/src/src/models/contact/index.d.ts.map +0 -1
- package/script/npm/src/src/models/contact/index.js +0 -20
- package/script/npm/src/src/models/contact/schemas.d.ts +0 -66
- package/script/npm/src/src/models/contact/schemas.d.ts.map +0 -1
- package/script/npm/src/src/models/contact/schemas.js +0 -67
- package/script/npm/src/src/models/contact/validation.d.ts +0 -37
- package/script/npm/src/src/models/contact/validation.d.ts.map +0 -1
- package/script/npm/src/src/models/contact/validation.js +0 -153
- package/script/npm/src/src/models/index.d.ts +0 -7
- package/script/npm/src/src/models/index.d.ts.map +0 -1
- package/script/npm/src/src/models/index.js +0 -22
- package/script/npm/src/src/models/payout/api.d.ts +0 -29
- package/script/npm/src/src/models/payout/api.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/api.js +0 -2
- package/script/npm/src/src/models/payout/channel.d.ts +0 -58
- package/script/npm/src/src/models/payout/channel.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/channel.js +0 -56
- package/script/npm/src/src/models/payout/derivatives/payout.d.ts +0 -158
- package/script/npm/src/src/models/payout/derivatives/payout.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/derivatives/payout.js +0 -275
- package/script/npm/src/src/models/payout/index.d.ts +0 -7
- package/script/npm/src/src/models/payout/index.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/index.js +0 -22
- package/script/npm/src/src/models/payout/narration.d.ts +0 -164
- package/script/npm/src/src/models/payout/narration.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/narration.js +0 -312
- package/script/npm/src/src/models/payout/schemas.d.ts +0 -156
- package/script/npm/src/src/models/payout/schemas.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/schemas.js +0 -108
- package/script/npm/src/src/models/payout/status.d.ts +0 -33
- package/script/npm/src/src/models/payout/status.d.ts.map +0 -1
- package/script/npm/src/src/models/payout/status.js +0 -37
- package/script/npm/src/src/models/permission.d.ts +0 -55
- package/script/npm/src/src/models/permission.d.ts.map +0 -1
- package/script/npm/src/src/models/permission.js +0 -53
- package/script/npm/src/src/models/role.d.ts +0 -21
- package/script/npm/src/src/models/role.d.ts.map +0 -1
- package/script/npm/src/src/models/role.js +0 -77
- package/script/npm/src/src/models/user/authenticated-user.d.ts +0 -77
- package/script/npm/src/src/models/user/authenticated-user.d.ts.map +0 -1
- package/script/npm/src/src/models/user/authenticated-user.js +0 -230
- package/script/npm/src/src/models/user/index.d.ts +0 -4
- package/script/npm/src/src/models/user/index.d.ts.map +0 -1
- package/script/npm/src/src/models/user/index.js +0 -19
- package/script/npm/src/src/models/user/managed-user.d.ts +0 -108
- package/script/npm/src/src/models/user/managed-user.d.ts.map +0 -1
- package/script/npm/src/src/models/user/managed-user.js +0 -260
- package/script/npm/src/src/models/user/profile.d.ts.map +0 -1
- package/script/npm/src/src/models/user/profile.js +0 -338
- package/script/npm/src/src/models/wallet/index.d.ts +0 -4
- package/script/npm/src/src/models/wallet/index.d.ts.map +0 -1
- package/script/npm/src/src/models/wallet/index.js +0 -19
- package/script/npm/src/src/models/wallet/schemas.d.ts +0 -95
- package/script/npm/src/src/models/wallet/schemas.d.ts.map +0 -1
- package/script/npm/src/src/models/wallet/schemas.js +0 -38
- package/script/npm/src/src/models/wallet/statement_entry.d.ts +0 -160
- package/script/npm/src/src/models/wallet/statement_entry.d.ts.map +0 -1
- package/script/npm/src/src/models/wallet/statement_entry.js +0 -259
- package/script/npm/src/src/models/wallet/wallet.d.ts +0 -147
- package/script/npm/src/src/models/wallet/wallet.d.ts.map +0 -1
- package/script/npm/src/src/models/wallet/wallet.js +0 -283
- package/script/npm/src/src/shared/base_repository.d.ts +0 -80
- package/script/npm/src/src/shared/base_repository.d.ts.map +0 -1
- package/script/npm/src/src/shared/base_repository.js +0 -157
- package/script/npm/src/src/shared/common_responses.d.ts +0 -13
- package/script/npm/src/src/shared/common_responses.d.ts.map +0 -1
- package/script/npm/src/src/shared/common_responses.js +0 -13
- package/script/npm/src/src/shared/index.d.ts +0 -3
- package/script/npm/src/src/shared/index.d.ts.map +0 -1
- package/script/npm/src/src/shared/index.js +0 -18
- package/script/npm/src/src/shared/token_required_repository.d.ts +0 -78
- package/script/npm/src/src/shared/token_required_repository.d.ts.map +0 -1
- package/script/npm/src/src/shared/token_required_repository.js +0 -132
- package/script/package.json +0 -3
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { BaseRepository } from "@/lib/api/index.js";
|
|
2
|
+
import { Payout } from "@/modules/payout/payout.model.js";
|
|
3
|
+
import { Amount } from "@temboplus/frontend-core";
|
|
4
|
+
import { PayoutAPI } from "./payout.api-contract.js";
|
|
5
|
+
import { PayoutChannel } from "./payout.dtos.js";
|
|
6
|
+
import { PayoutQuery } from "./payout.query.js";
|
|
7
|
+
import { PayoutFilters } from "./payout.dtos.js";
|
|
8
|
+
import { Paged } from "@/lib/query/index.js";
|
|
9
|
+
import { Wallet } from "../wallet/wallet.model.js";
|
|
10
|
+
import { BeneficiaryInfo } from "../beneficiary/beneficiary-info.model.js";
|
|
11
|
+
/**
|
|
12
|
+
* Input type for payout creation mutation
|
|
13
|
+
*/
|
|
14
|
+
export interface CreatePayoutInput {
|
|
15
|
+
/** The wallet to pay from */
|
|
16
|
+
wallet: Wallet;
|
|
17
|
+
/** The payout channel to use (MOBILE or BANK) */
|
|
18
|
+
channel: PayoutChannel;
|
|
19
|
+
/** Contact information for the payout receiver */
|
|
20
|
+
receiver: BeneficiaryInfo;
|
|
21
|
+
/** The amount to pay out */
|
|
22
|
+
amount: Amount;
|
|
23
|
+
/** Optional notes/narration for the payout */
|
|
24
|
+
notes?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Input type for payout approval mutation
|
|
28
|
+
*/
|
|
29
|
+
export interface ApprovePayoutInput {
|
|
30
|
+
id: string;
|
|
31
|
+
notes?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Input type for payout rejection mutation
|
|
35
|
+
*/
|
|
36
|
+
export interface RejectPayoutInput {
|
|
37
|
+
id: string;
|
|
38
|
+
notes?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Flexible query input type - supports the class, filters interface, URL params, etc.
|
|
42
|
+
*/
|
|
43
|
+
export type PayoutQueryInput = PayoutQuery | PayoutFilters | Record<string, string> | URLSearchParams | null | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Repository class for managing payout operations including creation, approval,
|
|
46
|
+
* rejection, and retrieval of payouts.
|
|
47
|
+
*
|
|
48
|
+
* This repository handles pure API communication without permission checking.
|
|
49
|
+
* Permission validation should be handled at the service layer or route handlers.
|
|
50
|
+
*
|
|
51
|
+
* @extends {BaseRepository<PayoutAPI>}
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const repo = new PayoutRepository({ token: userToken });
|
|
56
|
+
* const payouts = await repo.getPayouts();
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare class PayoutRepository extends BaseRepository<PayoutAPI> {
|
|
60
|
+
/**
|
|
61
|
+
* Creates an instance of PayoutRepository initialized with the payout contract.
|
|
62
|
+
*
|
|
63
|
+
* @param options - Optional configuration
|
|
64
|
+
* @param options.token - Authentication token for API calls
|
|
65
|
+
* @param options.root - Custom API root URL
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const repo = new PayoutRepository({
|
|
70
|
+
* token: "user-auth-token"
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
constructor(options?: {
|
|
75
|
+
token?: string;
|
|
76
|
+
root?: string;
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* Get paginated payouts with filtering.
|
|
80
|
+
* Always returns paginated results with metadata.
|
|
81
|
+
*
|
|
82
|
+
* @param query - Query parameters in any supported format
|
|
83
|
+
* @returns Promise resolving to paginated payouts
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* // From API route with URL search params
|
|
88
|
+
* const { searchParams } = new URL(req.url);
|
|
89
|
+
* const result = await repo.getPayouts(searchParams);
|
|
90
|
+
*
|
|
91
|
+
* // From client with typed params
|
|
92
|
+
* const filters: PayoutFilters = { page: 1, limit: 20, approvalStatus: 'Pending' };
|
|
93
|
+
* const result2 = await repo.getPayouts(filters);
|
|
94
|
+
*
|
|
95
|
+
* // With PayoutQuery instance
|
|
96
|
+
* const query = PayoutQuery.create().wherePending().withPagination(1, 50);
|
|
97
|
+
* const result3 = await repo.getPayouts(query);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
getPayouts(query?: PayoutQueryInput): Promise<Paged<Payout>>;
|
|
101
|
+
/**
|
|
102
|
+
* Get all payouts without pagination.
|
|
103
|
+
* Returns a plain array of all matching results.
|
|
104
|
+
*
|
|
105
|
+
* @param query - Query parameters (pagination params will be ignored)
|
|
106
|
+
* @returns Promise resolving to array of all payouts
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* // Get all pending payouts for a dropdown
|
|
111
|
+
* const allPending = await repo.getAllPayouts({ approvalStatus: 'Pending' });
|
|
112
|
+
*
|
|
113
|
+
* // Get all payouts without any filters
|
|
114
|
+
* const allPayouts = await repo.getAllPayouts();
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
getAllPayouts(query?: PayoutQueryInput): Promise<Payout[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Convenience method for Next.js API routes.
|
|
120
|
+
* Extracts search params directly from Request object and returns paginated results.
|
|
121
|
+
*/
|
|
122
|
+
getPayoutsFromRequest(req: Request): Promise<Paged<Payout>>;
|
|
123
|
+
/**
|
|
124
|
+
* Creates a new payout with the provided input data.
|
|
125
|
+
*
|
|
126
|
+
* @param input - The payout creation data
|
|
127
|
+
* @param input.wallet - The wallet to pay from
|
|
128
|
+
* @param input.channel - The payout channel to use
|
|
129
|
+
* @param input.receiver - Contact information for the payout receiver
|
|
130
|
+
* @param input.amount - The amount to pay out
|
|
131
|
+
* @param input.notes - Optional notes for the payout
|
|
132
|
+
* @returns Promise that resolves to the created payout
|
|
133
|
+
* @throws {APIError} If the input is invalid or if the creation operation fails
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const payout = await repo.pay({
|
|
138
|
+
* wallet: selectedWallet,
|
|
139
|
+
* channel: PayoutChannel.MOBILE,
|
|
140
|
+
* receiver: { name: "John Doe", phone: "+255123456789" },
|
|
141
|
+
* amount: Amount.from(10000, "TZS"),
|
|
142
|
+
* notes: "Payment for services"
|
|
143
|
+
* });
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
pay(input: CreatePayoutInput): Promise<Payout>;
|
|
147
|
+
/**
|
|
148
|
+
* Approves a payout with optional notes.
|
|
149
|
+
*
|
|
150
|
+
* @param input.id - The ID of the payout to approve
|
|
151
|
+
* @param input.notes - Optional notes for the approval
|
|
152
|
+
* @returns Promise that resolves to the approved payout
|
|
153
|
+
* @throws {APIError} If payout is not found, already approved, or if the operation fails
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const approvedPayout = await repo.approve({
|
|
158
|
+
* id: "payout-id",
|
|
159
|
+
* notes: "Approved after verification"
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
approve(input: ApprovePayoutInput): Promise<Payout>;
|
|
164
|
+
/**
|
|
165
|
+
* Rejects a payout with optional notes.
|
|
166
|
+
*
|
|
167
|
+
* @param input.id - The ID of the payout to reject
|
|
168
|
+
* @param input.notes - Optional notes for the rejection
|
|
169
|
+
* @returns Promise that resolves to the rejected payout
|
|
170
|
+
* @throws {APIError} If payout is not found, already rejected, or if the operation fails
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const rejectedPayout = await repo.reject({
|
|
175
|
+
* id: "payout-id",
|
|
176
|
+
* notes: "Insufficient documentation"
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
reject(input: RejectPayoutInput): Promise<Payout>;
|
|
181
|
+
/**
|
|
182
|
+
* Retrieves a payout by its ID.
|
|
183
|
+
*
|
|
184
|
+
* @param id - The ID of the payout to retrieve
|
|
185
|
+
* @returns Promise that resolves to the payout instance if found
|
|
186
|
+
* @throws {APIError} If the payout is not found or another error occurs
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* const payout = await repo.getByID("payout-id");
|
|
191
|
+
* console.log(`Payout status: ${payout.status}`);
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
getByID(id: string): Promise<Payout>;
|
|
195
|
+
/**
|
|
196
|
+
* Get count of payouts matching a query
|
|
197
|
+
* Uses the same query syntax as getPayouts but only returns the count
|
|
198
|
+
*/
|
|
199
|
+
count(query?: PayoutQueryInput): Promise<number>;
|
|
200
|
+
/**
|
|
201
|
+
* Check if any payouts exist matching a query
|
|
202
|
+
*/
|
|
203
|
+
exists(query?: PayoutQueryInput): Promise<boolean>;
|
|
204
|
+
}
|
|
@@ -8,13 +8,14 @@ export declare const profileContract: {
|
|
|
8
8
|
responses: {
|
|
9
9
|
200: import("zod").ZodObject<{
|
|
10
10
|
id: import("zod").ZodString;
|
|
11
|
-
firstName: import("zod").
|
|
12
|
-
lastName: import("zod").
|
|
11
|
+
firstName: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
12
|
+
lastName: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
13
13
|
displayName: import("zod").ZodString;
|
|
14
|
-
phone: import("zod").
|
|
14
|
+
phone: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
15
15
|
accountNo: import("zod").ZodString;
|
|
16
|
-
email: import("zod").
|
|
17
|
-
|
|
16
|
+
email: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
17
|
+
autoApprove: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
18
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
18
19
|
id: string;
|
|
19
20
|
displayName: string;
|
|
20
21
|
accountNo: string;
|
|
@@ -22,6 +23,7 @@ export declare const profileContract: {
|
|
|
22
23
|
lastName?: string | null | undefined;
|
|
23
24
|
phone?: string | null | undefined;
|
|
24
25
|
email?: string | null | undefined;
|
|
26
|
+
autoApprove?: boolean | null | undefined;
|
|
25
27
|
}, {
|
|
26
28
|
id: string;
|
|
27
29
|
displayName: string;
|
|
@@ -30,8 +32,8 @@ export declare const profileContract: {
|
|
|
30
32
|
lastName?: string | null | undefined;
|
|
31
33
|
phone?: string | null | undefined;
|
|
32
34
|
email?: string | null | undefined;
|
|
35
|
+
autoApprove?: boolean | null | undefined;
|
|
33
36
|
}>;
|
|
34
37
|
};
|
|
35
38
|
};
|
|
36
39
|
};
|
|
37
|
-
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
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 | null | undefined} firstName - User's first name, can be null or undefined
|
|
10
|
+
* @property {string | null | undefined} lastName - User's last name, can be null or undefined
|
|
11
|
+
* @property {string} displayName - User's display name
|
|
12
|
+
* @property {string | null | undefined} phone - User's contact phone number, can be null or undefined
|
|
13
|
+
* @property {string} accountNo - User's account number
|
|
14
|
+
* @property {string | null | undefined} email - User's email address, can be null or undefined
|
|
15
|
+
* @property {boolean | null | undefined} autoApprove - Auto-approval setting, can be null or undefined
|
|
16
|
+
*/
|
|
17
|
+
declare const profileDTOSchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
21
|
+
displayName: z.ZodString;
|
|
22
|
+
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
accountNo: z.ZodString;
|
|
24
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
id: string;
|
|
28
|
+
displayName: string;
|
|
29
|
+
accountNo: string;
|
|
30
|
+
firstName?: string | null | undefined;
|
|
31
|
+
lastName?: string | null | undefined;
|
|
32
|
+
phone?: string | null | undefined;
|
|
33
|
+
email?: string | null | undefined;
|
|
34
|
+
autoApprove?: boolean | null | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
id: string;
|
|
37
|
+
displayName: string;
|
|
38
|
+
accountNo: string;
|
|
39
|
+
firstName?: string | null | undefined;
|
|
40
|
+
lastName?: string | null | undefined;
|
|
41
|
+
phone?: string | null | undefined;
|
|
42
|
+
email?: string | null | undefined;
|
|
43
|
+
autoApprove?: boolean | null | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* TypeScript type representing a validated user profile.
|
|
47
|
+
* Use this type for profile instances that have been validated against the schema.
|
|
48
|
+
*/
|
|
49
|
+
export type ProfileDTO = z.infer<typeof profileDTOSchema>;
|
|
50
|
+
export declare const ProfileDTOSchemas: {
|
|
51
|
+
profileDTOSchema: z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
+
displayName: z.ZodString;
|
|
56
|
+
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
|
+
accountNo: z.ZodString;
|
|
58
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
id: string;
|
|
62
|
+
displayName: string;
|
|
63
|
+
accountNo: string;
|
|
64
|
+
firstName?: string | null | undefined;
|
|
65
|
+
lastName?: string | null | undefined;
|
|
66
|
+
phone?: string | null | undefined;
|
|
67
|
+
email?: string | null | undefined;
|
|
68
|
+
autoApprove?: boolean | null | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
id: string;
|
|
71
|
+
displayName: string;
|
|
72
|
+
accountNo: string;
|
|
73
|
+
firstName?: string | null | undefined;
|
|
74
|
+
lastName?: string | null | undefined;
|
|
75
|
+
phone?: string | null | undefined;
|
|
76
|
+
email?: string | null | undefined;
|
|
77
|
+
autoApprove?: boolean | null | undefined;
|
|
78
|
+
}>;
|
|
79
|
+
};
|
|
80
|
+
export {};
|
package/{script/npm/src/src/models/user/profile.d.ts → dist/modules/profile/profile.model.d.ts}
RENAMED
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { PhoneNumber } from "@temboplus/frontend-core";
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
* This type helper ensures type safety when implementing the actual schema.
|
|
3
|
+
* Zod schema for Profile JSON serialization
|
|
6
4
|
*/
|
|
7
|
-
|
|
5
|
+
export declare const ProfileJSONSchema: z.ZodObject<{
|
|
8
6
|
id: z.ZodString;
|
|
9
|
-
firstName: z.
|
|
10
|
-
lastName: z.
|
|
7
|
+
firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
9
|
displayName: z.ZodString;
|
|
12
|
-
phone: z.
|
|
10
|
+
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
11
|
accountNo: z.ZodString;
|
|
14
|
-
email: z.
|
|
12
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
14
|
+
version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
id: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
accountNo: string;
|
|
19
|
+
version: string;
|
|
20
|
+
firstName?: string | null | undefined;
|
|
21
|
+
lastName?: string | null | undefined;
|
|
22
|
+
phone?: string | null | undefined;
|
|
23
|
+
email?: string | null | undefined;
|
|
24
|
+
autoApprove?: boolean | null | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
id: string;
|
|
27
|
+
displayName: string;
|
|
28
|
+
accountNo: string;
|
|
29
|
+
firstName?: string | null | undefined;
|
|
30
|
+
lastName?: string | null | undefined;
|
|
31
|
+
phone?: string | null | undefined;
|
|
32
|
+
email?: string | null | undefined;
|
|
33
|
+
autoApprove?: boolean | null | undefined;
|
|
34
|
+
version?: string | undefined;
|
|
15
35
|
}>;
|
|
16
36
|
/**
|
|
17
|
-
*
|
|
18
|
-
* Defines validation rules and constraints for each profile field.
|
|
19
|
-
*
|
|
20
|
-
* @const {ProfileType}
|
|
21
|
-
*
|
|
22
|
-
* @property {string} id - Unique identifier for the profile
|
|
23
|
-
* @property {string | null | undefined} firstName - User's first name, can be null or undefined
|
|
24
|
-
* @property {string | null | undefined} lastName - User's last name, can be null or undefined
|
|
25
|
-
* @property {string} displayName - User's display name
|
|
26
|
-
* @property {string | null | undefined} phone - User's contact phone number, can be null or undefined
|
|
27
|
-
* @property {string} accountNo - User's account number
|
|
28
|
-
* @property {string | null | undefined} email - User's email address, can be null or undefined
|
|
29
|
-
*/
|
|
30
|
-
export declare const profileSchema: ProfileZodSchemaType;
|
|
31
|
-
/**
|
|
32
|
-
* TypeScript type representing a validated user profile.
|
|
33
|
-
* Use this type for profile instances that have been validated against the schema.
|
|
37
|
+
* Infer the ProfileJSON type from the schema
|
|
34
38
|
*/
|
|
35
|
-
export type
|
|
39
|
+
export type ProfileJSON = z.infer<typeof ProfileJSONSchema>;
|
|
36
40
|
/**
|
|
37
41
|
* Represents a user profile in the system.
|
|
38
42
|
*
|
|
@@ -48,16 +52,45 @@ export declare class Profile {
|
|
|
48
52
|
private _lastName?;
|
|
49
53
|
/** User's display name, can be used for presentation */
|
|
50
54
|
private _displayName;
|
|
51
|
-
/** User's phone number
|
|
55
|
+
/** User's phone number */
|
|
52
56
|
private _phone?;
|
|
53
57
|
/** User's account number */
|
|
54
58
|
private _accountNo;
|
|
55
59
|
/** User's email address */
|
|
56
60
|
private _email?;
|
|
61
|
+
/** Auto-approval setting */
|
|
62
|
+
private _autoApprove?;
|
|
57
63
|
/**
|
|
58
64
|
* Gets the profile schema used for validation.
|
|
59
65
|
*/
|
|
60
|
-
static get schema():
|
|
66
|
+
static get schema(): z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
70
|
+
displayName: z.ZodString;
|
|
71
|
+
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
accountNo: z.ZodString;
|
|
73
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
id: string;
|
|
77
|
+
displayName: string;
|
|
78
|
+
accountNo: string;
|
|
79
|
+
firstName?: string | null | undefined;
|
|
80
|
+
lastName?: string | null | undefined;
|
|
81
|
+
phone?: string | null | undefined;
|
|
82
|
+
email?: string | null | undefined;
|
|
83
|
+
autoApprove?: boolean | null | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
id: string;
|
|
86
|
+
displayName: string;
|
|
87
|
+
accountNo: string;
|
|
88
|
+
firstName?: string | null | undefined;
|
|
89
|
+
lastName?: string | null | undefined;
|
|
90
|
+
phone?: string | null | undefined;
|
|
91
|
+
email?: string | null | undefined;
|
|
92
|
+
autoApprove?: boolean | null | undefined;
|
|
93
|
+
}>;
|
|
61
94
|
/**
|
|
62
95
|
* Creates a new Profile instance with the provided data.
|
|
63
96
|
*
|
|
@@ -79,6 +112,7 @@ export declare class Profile {
|
|
|
79
112
|
phone?: string | null;
|
|
80
113
|
accountNo: string;
|
|
81
114
|
email?: string | null;
|
|
115
|
+
autoApprove?: boolean | null;
|
|
82
116
|
}): Profile | undefined;
|
|
83
117
|
/**
|
|
84
118
|
* Gets the profile's unique identifier.
|
|
@@ -99,7 +133,7 @@ export declare class Profile {
|
|
|
99
133
|
/**
|
|
100
134
|
* Gets the user's phone number object.
|
|
101
135
|
*/
|
|
102
|
-
get phone():
|
|
136
|
+
get phone(): string | null | undefined;
|
|
103
137
|
/**
|
|
104
138
|
* Gets the user's account number.
|
|
105
139
|
*/
|
|
@@ -109,39 +143,20 @@ export declare class Profile {
|
|
|
109
143
|
*/
|
|
110
144
|
get email(): string | null | undefined;
|
|
111
145
|
/**
|
|
112
|
-
* Gets the
|
|
146
|
+
* Gets the auto-approval setting.
|
|
113
147
|
*/
|
|
114
|
-
get
|
|
148
|
+
get autoApprove(): boolean | null | undefined;
|
|
115
149
|
/**
|
|
116
150
|
* Gets the user's name for display purposes.
|
|
117
151
|
* Returns the display name if it exists, otherwise returns the first and last name combined.
|
|
118
152
|
*/
|
|
119
153
|
getName(): string;
|
|
120
|
-
/**
|
|
121
|
-
* Creates a plain object representation of the profile for validation or serialization.
|
|
122
|
-
*
|
|
123
|
-
* @returns A plain object matching the ProfileType interface
|
|
124
|
-
*/
|
|
125
|
-
toObject(): ProfileType;
|
|
126
|
-
/**
|
|
127
|
-
* Converts the profile to a JSON string.
|
|
128
|
-
*
|
|
129
|
-
* @returns A JSON string representation of the profile
|
|
130
|
-
*/
|
|
131
|
-
toJSON(): string;
|
|
132
154
|
/**
|
|
133
155
|
* Validates the profile data against the Zod schema.
|
|
134
156
|
*
|
|
135
157
|
* @returns True if the profile is valid, false otherwise
|
|
136
158
|
*/
|
|
137
159
|
validate(): boolean;
|
|
138
|
-
/**
|
|
139
|
-
* Creates a Profile instance from a JSON string.
|
|
140
|
-
*
|
|
141
|
-
* @param jsonString - JSON string containing profile data
|
|
142
|
-
* @returns A new Profile instance, or undefined if parsing failed
|
|
143
|
-
*/
|
|
144
|
-
static fromJSON(jsonString: string): Profile | undefined;
|
|
145
160
|
/**
|
|
146
161
|
* Creates a Profile instance from a plain object.
|
|
147
162
|
*
|
|
@@ -156,6 +171,20 @@ export declare class Profile {
|
|
|
156
171
|
* @returns Type predicate indicating if the object is a valid Profile
|
|
157
172
|
*/
|
|
158
173
|
static is(obj: unknown): obj is Profile;
|
|
174
|
+
/**
|
|
175
|
+
* Serializes the Profile instance to a JSON-compatible object
|
|
176
|
+
*/
|
|
177
|
+
toJSON(): ProfileJSON;
|
|
178
|
+
/**
|
|
179
|
+
* Serializes the Profile instance to a JSON string
|
|
180
|
+
*/
|
|
181
|
+
toJSONString(): string;
|
|
182
|
+
/**
|
|
183
|
+
* Creates a Profile instance from a JSON-compatible object or string
|
|
184
|
+
*/
|
|
185
|
+
static fromJSON(json: ProfileJSON | string): Profile | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* Type guard using Zod schema validation
|
|
188
|
+
*/
|
|
189
|
+
static isProfileJSON(obj: unknown): obj is ProfileJSON;
|
|
159
190
|
}
|
|
160
|
-
export {};
|
|
161
|
-
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BaseRepository } from "@/lib/api/base-repository.js";
|
|
2
|
+
import { profileContract } from "./profile.api-contract.js";
|
|
3
|
+
import { Profile } from "./profile.model.js";
|
|
4
|
+
/**
|
|
5
|
+
* Repository class for managing user profile operations.
|
|
6
|
+
* Handles retrieving and updating user profile information from the API.
|
|
7
|
+
*
|
|
8
|
+
* This repository handles pure API communication without permission checking.
|
|
9
|
+
* Permission validation should be handled at the service layer or route handlers.
|
|
10
|
+
*
|
|
11
|
+
* @extends {BaseRepository<typeof profileContract>}
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const repo = new ProfileRepository({ token: userToken });
|
|
16
|
+
* const profile = await repo.getCurrentProfile();
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class ProfileRepository extends BaseRepository<typeof profileContract> {
|
|
20
|
+
/**
|
|
21
|
+
* Creates an instance of ProfileRepository.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Optional configuration
|
|
24
|
+
* @param options.token - Authentication token for API calls
|
|
25
|
+
* @param options.root - Custom API root URL
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const repo = new ProfileRepository({
|
|
30
|
+
* token: "user-auth-token",
|
|
31
|
+
* root: "base-api-url"
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
constructor(options?: {
|
|
36
|
+
token?: string;
|
|
37
|
+
root?: string;
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves the current user's profile information.
|
|
41
|
+
*
|
|
42
|
+
* @returns Promise that resolves to the user's profile
|
|
43
|
+
* @throws {APIError} If the request fails, profile data is invalid, or returns an unexpected status
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* try {
|
|
48
|
+
* const profile = await repo.getCurrentProfile();
|
|
49
|
+
* console.log(`User: ${profile.name}, Email: ${profile.email}`);
|
|
50
|
+
* } catch (error) {
|
|
51
|
+
* console.error("Failed to get profile:", error.message);
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
getCurrentProfile(): Promise<Profile>;
|
|
56
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { RoleDTO } from "./team-member.dtos.js";
|
|
3
|
+
/**
|
|
4
|
+
* Zod schema for Role JSON serialization
|
|
5
|
+
*/
|
|
6
|
+
export declare const RoleJSONSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
description: z.ZodOptional<z.ZodString>;
|
|
10
|
+
access: z.ZodArray<z.ZodString, "many">;
|
|
11
|
+
createdAt: z.ZodString;
|
|
12
|
+
updatedAt: z.ZodString;
|
|
13
|
+
version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
name: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
id: string;
|
|
18
|
+
version: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
access: string[];
|
|
21
|
+
description?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
name: string;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
id: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
access: string[];
|
|
28
|
+
version?: string | undefined;
|
|
29
|
+
description?: string | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Infer the RoleJSON type from the schema
|
|
33
|
+
*/
|
|
34
|
+
export type RoleJSON = z.infer<typeof RoleJSONSchema>;
|
|
35
|
+
export declare class Role {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly description?: string;
|
|
39
|
+
readonly permissions: ReadonlySet<string>;
|
|
40
|
+
readonly createdAt: Date;
|
|
41
|
+
readonly updatedAt: Date;
|
|
42
|
+
constructor(data: RoleDTO);
|
|
43
|
+
hasPermission(permission: string): boolean;
|
|
44
|
+
static from(data: RoleDTO): Role | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Serializes the Role instance to a JSON-compatible object
|
|
47
|
+
*/
|
|
48
|
+
toJSON(): RoleJSON;
|
|
49
|
+
/**
|
|
50
|
+
* Serializes the Role instance to a JSON string
|
|
51
|
+
*/
|
|
52
|
+
toJSONString(): string;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a Role instance from a JSON-compatible object or string
|
|
55
|
+
*/
|
|
56
|
+
static fromJSON(json: RoleJSON | string): Role | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Type guard using Zod schema validation
|
|
59
|
+
*/
|
|
60
|
+
static isRoleJSON(obj: unknown): obj is RoleJSON;
|
|
61
|
+
}
|