@temboplus/afloat 0.1.77-beta.9 → 0.1.79
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 +42 -246
- package/esm/mod.d.ts +8 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +7 -0
- package/esm/package.json +3 -0
- package/{dist/lib/error/error.api.d.ts → esm/src/errors/api_error.d.ts} +1 -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/{dist/lib/error/error.permission.d.ts → esm/src/errors/permission_error.d.ts} +2 -1
- package/esm/src/errors/permission_error.d.ts.map +1 -0
- package/esm/src/errors/permission_error.js +70 -0
- package/{dist/modules/team-member/team-member.contract.d.ts → esm/src/features/admin/contract.d.ts} +158 -233
- package/esm/src/features/admin/contract.d.ts.map +1 -0
- package/esm/src/features/admin/contract.js +210 -0
- package/esm/src/features/admin/index.d.ts +4 -0
- package/esm/src/features/admin/index.d.ts.map +1 -0
- package/esm/src/features/admin/index.js +3 -0
- package/esm/src/features/admin/repository.d.ts +114 -0
- package/esm/src/features/admin/repository.d.ts.map +1 -0
- package/esm/src/features/admin/repository.js +248 -0
- package/esm/src/features/admin/schemas.d.ts +146 -0
- package/esm/src/features/admin/schemas.d.ts.map +1 -0
- package/esm/src/features/admin/schemas.js +206 -0
- package/esm/src/features/auth/access/contract.d.ts +14 -0
- package/esm/src/features/auth/access/contract.d.ts.map +1 -0
- package/esm/src/features/auth/access/contract.js +14 -0
- package/esm/src/features/auth/access/repository.d.ts +11 -0
- package/esm/src/features/auth/access/repository.d.ts.map +1 -0
- package/esm/src/features/auth/access/repository.js +25 -0
- package/{dist/modules/auth/auth.contract.d.ts → esm/src/features/auth/contract.d.ts} +19 -16
- package/esm/src/features/auth/contract.d.ts.map +1 -0
- package/esm/src/features/auth/contract.js +43 -0
- package/esm/src/features/auth/identity/contract.d.ts +23 -0
- package/esm/src/features/auth/identity/contract.d.ts.map +1 -0
- package/esm/src/features/auth/identity/contract.js +17 -0
- package/esm/src/features/auth/identity/repository.d.ts +22 -0
- package/esm/src/features/auth/identity/repository.d.ts.map +1 -0
- package/esm/src/features/auth/identity/repository.js +30 -0
- package/esm/src/features/auth/index.d.ts +6 -0
- package/esm/src/features/auth/index.d.ts.map +1 -0
- package/esm/src/features/auth/index.js +5 -0
- package/esm/src/features/auth/manager.d.ts +105 -0
- package/esm/src/features/auth/manager.d.ts.map +1 -0
- package/esm/src/features/auth/manager.js +181 -0
- package/{dist/modules/profile/profile.api-contract.d.ts → esm/src/features/auth/profile/contract.d.ts} +6 -8
- package/esm/src/features/auth/profile/contract.d.ts.map +1 -0
- package/esm/src/features/auth/profile/contract.js +14 -0
- package/esm/src/features/auth/profile/repository.d.ts +11 -0
- package/esm/src/features/auth/profile/repository.d.ts.map +1 -0
- package/esm/src/features/auth/profile/repository.js +25 -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 +69 -0
- package/{dist/modules/auth/storage/client-store.d.ts → esm/src/features/auth/storage/client_store.d.ts} +2 -1
- package/esm/src/features/auth/storage/client_store.d.ts.map +1 -0
- package/esm/src/features/auth/storage/client_store.js +46 -0
- package/{dist/modules/auth/storage/client-token-handler.d.ts → esm/src/features/auth/storage/client_token_handler.d.ts} +1 -0
- package/esm/src/features/auth/storage/client_token_handler.d.ts.map +1 -0
- package/esm/src/features/auth/storage/client_token_handler.js +36 -0
- package/esm/src/features/auth/storage/server_store.d.ts +24 -0
- package/esm/src/features/auth/storage/server_store.d.ts.map +1 -0
- package/esm/src/features/auth/storage/server_store.js +34 -0
- package/esm/src/features/auth/storage/server_token_handler.d.ts +36 -0
- package/esm/src/features/auth/storage/server_token_handler.d.ts.map +1 -0
- package/esm/src/features/auth/storage/server_token_handler.js +115 -0
- package/{dist/modules → esm/src/features}/auth/storage/types.d.ts +2 -1
- package/esm/src/features/auth/storage/types.d.ts.map +1 -0
- package/esm/src/features/auth/storage/types.js +1 -0
- package/{dist/modules/contact/contact.api-contract.d.ts → esm/src/features/contact/contract.d.ts} +55 -88
- 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 +58 -0
- package/esm/src/features/contact/repository.d.ts.map +1 -0
- package/esm/src/features/contact/repository.js +108 -0
- package/{dist/modules/payout/payout.api-contract.d.ts → esm/src/features/payout/contract.d.ts} +197 -340
- 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 +67 -0
- package/esm/src/features/payout/repository.d.ts.map +1 -0
- package/esm/src/features/payout/repository.js +163 -0
- package/{dist/modules/wallet/wallet.contract.d.ts → esm/src/features/wallet/contract.d.ts} +11 -13
- package/esm/src/features/wallet/contract.d.ts.map +1 -0
- package/esm/src/features/wallet/contract.js +38 -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 +57 -0
- package/esm/src/features/wallet/repository.d.ts.map +1 -0
- package/esm/src/features/wallet/repository.js +93 -0
- package/esm/src/models/contact/derivatives/contact.d.ts +172 -0
- package/esm/src/models/contact/derivatives/contact.d.ts.map +1 -0
- package/esm/src/models/contact/derivatives/contact.js +266 -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/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 +146 -0
- package/esm/src/models/index.d.ts +7 -0
- package/esm/src/models/index.d.ts.map +1 -0
- package/esm/src/models/index.js +6 -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 +53 -0
- package/esm/src/models/payout/derivatives/payout.d.ts +158 -0
- package/esm/src/models/payout/derivatives/payout.d.ts.map +1 -0
- package/esm/src/models/payout/derivatives/payout.js +271 -0
- package/esm/src/models/payout/index.d.ts +7 -0
- package/esm/src/models/payout/index.d.ts.map +1 -0
- package/esm/src/models/payout/index.js +6 -0
- package/esm/src/models/payout/narration.d.ts +164 -0
- package/esm/src/models/payout/narration.d.ts.map +1 -0
- package/esm/src/models/payout/narration.js +308 -0
- package/esm/src/models/payout/schemas.d.ts +156 -0
- package/esm/src/models/payout/schemas.d.ts.map +1 -0
- package/esm/src/models/payout/schemas.js +105 -0
- package/esm/src/models/payout/status.d.ts +33 -0
- package/esm/src/models/payout/status.d.ts.map +1 -0
- package/esm/src/models/payout/status.js +34 -0
- package/{dist/modules/login/permission.type.d.ts → esm/src/models/permission.d.ts} +9 -8
- package/esm/src/models/permission.d.ts.map +1 -0
- package/esm/src/models/permission.js +50 -0
- package/esm/src/models/role.d.ts +21 -0
- package/esm/src/models/role.d.ts.map +1 -0
- package/esm/src/models/role.js +73 -0
- package/esm/src/models/user/authenticated-user.d.ts +77 -0
- package/esm/src/models/user/authenticated-user.d.ts.map +1 -0
- package/esm/src/models/user/authenticated-user.js +226 -0
- package/esm/src/models/user/index.d.ts +4 -0
- package/esm/src/models/user/index.d.ts.map +1 -0
- package/esm/src/models/user/index.js +3 -0
- package/esm/src/models/user/managed-user.d.ts +108 -0
- package/esm/src/models/user/managed-user.d.ts.map +1 -0
- package/esm/src/models/user/managed-user.js +255 -0
- package/{dist/modules/profile/profile.model.d.ts → esm/src/models/user/profile.d.ts} +52 -81
- package/esm/src/models/user/profile.d.ts.map +1 -0
- package/esm/src/models/user/profile.js +334 -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 +95 -0
- package/esm/src/models/wallet/schemas.d.ts.map +1 -0
- package/esm/src/models/wallet/schemas.js +35 -0
- package/esm/src/models/wallet/statement_entry.d.ts +160 -0
- package/esm/src/models/wallet/statement_entry.d.ts.map +1 -0
- package/esm/src/models/wallet/statement_entry.js +255 -0
- package/{dist/modules/wallet/wallet.model.d.ts → esm/src/models/wallet/wallet.d.ts} +37 -31
- package/esm/src/models/wallet/wallet.d.ts.map +1 -0
- package/esm/src/models/wallet/wallet.js +279 -0
- package/esm/src/shared/base_repository.d.ts +80 -0
- package/esm/src/shared/base_repository.d.ts.map +1 -0
- package/esm/src/shared/base_repository.js +153 -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/esm/src/shared/token_required_repository.d.ts +78 -0
- package/esm/src/shared/token_required_repository.d.ts.map +1 -0
- package/esm/src/shared/token_required_repository.js +128 -0
- package/package.json +23 -49
- package/script/mod.d.ts +8 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +23 -0
- package/script/npm/src/mod.d.ts +8 -0
- package/script/npm/src/mod.d.ts.map +1 -0
- package/script/npm/src/mod.js +23 -0
- package/script/npm/src/src/errors/api_error.d.ts +63 -0
- package/script/npm/src/src/errors/api_error.d.ts.map +1 -0
- package/script/npm/src/src/errors/api_error.js +94 -0
- package/script/npm/src/src/errors/index.d.ts +3 -0
- package/script/npm/src/src/errors/index.d.ts.map +1 -0
- package/script/npm/src/src/errors/index.js +18 -0
- package/script/npm/src/src/errors/permission_error.d.ts +48 -0
- package/script/npm/src/src/errors/permission_error.d.ts.map +1 -0
- package/script/npm/src/src/errors/permission_error.js +74 -0
- package/script/npm/src/src/features/admin/contract.d.ts +842 -0
- package/script/npm/src/src/features/admin/contract.d.ts.map +1 -0
- package/script/npm/src/src/features/admin/contract.js +213 -0
- package/script/npm/src/src/features/admin/index.d.ts +4 -0
- package/script/npm/src/src/features/admin/index.d.ts.map +1 -0
- package/script/npm/src/src/features/admin/index.js +19 -0
- package/script/npm/src/src/features/admin/repository.d.ts +114 -0
- package/script/npm/src/src/features/admin/repository.d.ts.map +1 -0
- package/script/npm/src/src/features/admin/repository.js +252 -0
- package/script/npm/src/src/features/admin/schemas.d.ts +146 -0
- package/script/npm/src/src/features/admin/schemas.d.ts.map +1 -0
- package/script/npm/src/src/features/admin/schemas.js +209 -0
- package/script/npm/src/src/features/auth/access/contract.d.ts +14 -0
- package/script/npm/src/src/features/auth/access/contract.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/access/contract.js +17 -0
- package/script/npm/src/src/features/auth/access/repository.d.ts +11 -0
- package/script/npm/src/src/features/auth/access/repository.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/access/repository.js +29 -0
- package/script/npm/src/src/features/auth/contract.d.ts +112 -0
- package/script/npm/src/src/features/auth/contract.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/contract.js +46 -0
- package/script/npm/src/src/features/auth/identity/contract.d.ts +23 -0
- package/script/npm/src/src/features/auth/identity/contract.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/identity/contract.js +20 -0
- package/script/npm/src/src/features/auth/identity/repository.d.ts +22 -0
- package/script/npm/src/src/features/auth/identity/repository.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/identity/repository.js +34 -0
- package/script/npm/src/src/features/auth/index.d.ts +6 -0
- package/script/npm/src/src/features/auth/index.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/index.js +21 -0
- package/script/npm/src/src/features/auth/manager.d.ts +105 -0
- package/script/npm/src/src/features/auth/manager.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/manager.js +185 -0
- package/script/npm/src/src/features/auth/profile/contract.d.ts +37 -0
- package/script/npm/src/src/features/auth/profile/contract.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/profile/contract.js +17 -0
- package/script/npm/src/src/features/auth/profile/repository.d.ts +11 -0
- package/script/npm/src/src/features/auth/profile/repository.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/profile/repository.js +29 -0
- package/script/npm/src/src/features/auth/repository.d.ts +30 -0
- package/script/npm/src/src/features/auth/repository.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/repository.js +73 -0
- package/script/npm/src/src/features/auth/storage/client_store.d.ts +30 -0
- package/script/npm/src/src/features/auth/storage/client_store.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/storage/client_store.js +51 -0
- package/script/npm/src/src/features/auth/storage/client_token_handler.d.ts +32 -0
- package/script/npm/src/src/features/auth/storage/client_token_handler.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/storage/client_token_handler.js +40 -0
- package/script/npm/src/src/features/auth/storage/server_store.d.ts +24 -0
- package/script/npm/src/src/features/auth/storage/server_store.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/storage/server_store.js +38 -0
- package/script/npm/src/src/features/auth/storage/server_token_handler.d.ts +36 -0
- package/script/npm/src/src/features/auth/storage/server_token_handler.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/storage/server_token_handler.js +119 -0
- package/script/npm/src/src/features/auth/storage/types.d.ts +42 -0
- package/script/npm/src/src/features/auth/storage/types.d.ts.map +1 -0
- package/script/npm/src/src/features/auth/storage/types.js +2 -0
- package/script/npm/src/src/features/contact/contract.d.ts +170 -0
- package/script/npm/src/src/features/contact/contract.d.ts.map +1 -0
- package/script/npm/src/src/features/contact/contract.js +52 -0
- package/script/npm/src/src/features/contact/index.d.ts +2 -0
- package/script/npm/src/src/features/contact/index.d.ts.map +1 -0
- package/script/npm/src/src/features/contact/index.js +17 -0
- package/script/npm/src/src/features/contact/repository.d.ts +58 -0
- package/script/npm/src/src/features/contact/repository.d.ts.map +1 -0
- package/script/npm/src/src/features/contact/repository.js +112 -0
- package/script/npm/src/src/features/payout/contract.d.ts +623 -0
- package/script/npm/src/src/features/payout/contract.d.ts.map +1 -0
- package/script/npm/src/src/features/payout/contract.js +78 -0
- package/script/npm/src/src/features/payout/index.d.ts +2 -0
- package/script/npm/src/src/features/payout/index.d.ts.map +1 -0
- package/script/npm/src/src/features/payout/index.js +17 -0
- package/script/npm/src/src/features/payout/repository.d.ts +67 -0
- package/script/npm/src/src/features/payout/repository.d.ts.map +1 -0
- package/script/npm/src/src/features/payout/repository.js +167 -0
- package/script/npm/src/src/features/wallet/contract.d.ts +137 -0
- package/script/npm/src/src/features/wallet/contract.d.ts.map +1 -0
- package/script/npm/src/src/features/wallet/contract.js +41 -0
- package/script/npm/src/src/features/wallet/index.d.ts +2 -0
- package/script/npm/src/src/features/wallet/index.d.ts.map +1 -0
- package/script/npm/src/src/features/wallet/index.js +17 -0
- package/script/npm/src/src/features/wallet/repository.d.ts +57 -0
- package/script/npm/src/src/features/wallet/repository.d.ts.map +1 -0
- package/script/npm/src/src/features/wallet/repository.js +97 -0
- package/script/npm/src/src/models/contact/derivatives/contact.d.ts +172 -0
- package/script/npm/src/src/models/contact/derivatives/contact.d.ts.map +1 -0
- package/script/npm/src/src/models/contact/derivatives/contact.js +270 -0
- package/script/npm/src/src/models/contact/derivatives/contact_info.d.ts +188 -0
- package/script/npm/src/src/models/contact/derivatives/contact_info.d.ts.map +1 -0
- package/script/npm/src/src/models/contact/derivatives/contact_info.js +260 -0
- package/script/npm/src/src/models/contact/index.d.ts +5 -0
- package/script/npm/src/src/models/contact/index.d.ts.map +1 -0
- package/script/npm/src/src/models/contact/index.js +20 -0
- package/script/npm/src/src/models/contact/schemas.d.ts +66 -0
- package/script/npm/src/src/models/contact/schemas.d.ts.map +1 -0
- package/script/npm/src/src/models/contact/schemas.js +67 -0
- package/script/npm/src/src/models/contact/validation.d.ts +37 -0
- package/script/npm/src/src/models/contact/validation.d.ts.map +1 -0
- package/script/npm/src/src/models/contact/validation.js +153 -0
- package/script/npm/src/src/models/index.d.ts +7 -0
- package/script/npm/src/src/models/index.d.ts.map +1 -0
- package/script/npm/src/src/models/index.js +22 -0
- package/script/npm/src/src/models/payout/api.d.ts +29 -0
- package/script/npm/src/src/models/payout/api.d.ts.map +1 -0
- package/script/npm/src/src/models/payout/api.js +2 -0
- package/script/npm/src/src/models/payout/channel.d.ts +58 -0
- package/script/npm/src/src/models/payout/channel.d.ts.map +1 -0
- package/script/npm/src/src/models/payout/channel.js +56 -0
- package/script/npm/src/src/models/payout/derivatives/payout.d.ts +158 -0
- package/script/npm/src/src/models/payout/derivatives/payout.d.ts.map +1 -0
- package/script/npm/src/src/models/payout/derivatives/payout.js +275 -0
- package/script/npm/src/src/models/payout/index.d.ts +7 -0
- package/script/npm/src/src/models/payout/index.d.ts.map +1 -0
- package/script/npm/src/src/models/payout/index.js +22 -0
- package/script/npm/src/src/models/payout/narration.d.ts +164 -0
- package/script/npm/src/src/models/payout/narration.d.ts.map +1 -0
- package/script/npm/src/src/models/payout/narration.js +312 -0
- package/script/npm/src/src/models/payout/schemas.d.ts +156 -0
- package/script/npm/src/src/models/payout/schemas.d.ts.map +1 -0
- package/script/npm/src/src/models/payout/schemas.js +108 -0
- package/script/npm/src/src/models/payout/status.d.ts +33 -0
- package/script/npm/src/src/models/payout/status.d.ts.map +1 -0
- package/script/npm/src/src/models/payout/status.js +37 -0
- package/script/npm/src/src/models/permission.d.ts +55 -0
- package/script/npm/src/src/models/permission.d.ts.map +1 -0
- package/script/npm/src/src/models/permission.js +53 -0
- package/script/npm/src/src/models/role.d.ts +21 -0
- package/script/npm/src/src/models/role.d.ts.map +1 -0
- package/script/npm/src/src/models/role.js +77 -0
- package/script/npm/src/src/models/user/authenticated-user.d.ts +77 -0
- package/script/npm/src/src/models/user/authenticated-user.d.ts.map +1 -0
- package/script/npm/src/src/models/user/authenticated-user.js +230 -0
- package/script/npm/src/src/models/user/index.d.ts +4 -0
- package/script/npm/src/src/models/user/index.d.ts.map +1 -0
- package/script/npm/src/src/models/user/index.js +19 -0
- package/script/npm/src/src/models/user/managed-user.d.ts +108 -0
- package/script/npm/src/src/models/user/managed-user.d.ts.map +1 -0
- package/script/npm/src/src/models/user/managed-user.js +260 -0
- package/script/npm/src/src/models/user/profile.d.ts +161 -0
- package/script/npm/src/src/models/user/profile.d.ts.map +1 -0
- package/script/npm/src/src/models/user/profile.js +338 -0
- package/script/npm/src/src/models/wallet/index.d.ts +4 -0
- package/script/npm/src/src/models/wallet/index.d.ts.map +1 -0
- package/script/npm/src/src/models/wallet/index.js +19 -0
- package/script/npm/src/src/models/wallet/schemas.d.ts +95 -0
- package/script/npm/src/src/models/wallet/schemas.d.ts.map +1 -0
- package/script/npm/src/src/models/wallet/schemas.js +38 -0
- package/script/npm/src/src/models/wallet/statement_entry.d.ts +160 -0
- package/script/npm/src/src/models/wallet/statement_entry.d.ts.map +1 -0
- package/script/npm/src/src/models/wallet/statement_entry.js +259 -0
- package/script/npm/src/src/models/wallet/wallet.d.ts +147 -0
- package/script/npm/src/src/models/wallet/wallet.d.ts.map +1 -0
- package/script/npm/src/src/models/wallet/wallet.js +283 -0
- package/script/npm/src/src/shared/base_repository.d.ts +80 -0
- package/script/npm/src/src/shared/base_repository.d.ts.map +1 -0
- package/script/npm/src/src/shared/base_repository.js +157 -0
- package/script/npm/src/src/shared/common_responses.d.ts +13 -0
- package/script/npm/src/src/shared/common_responses.d.ts.map +1 -0
- package/script/npm/src/src/shared/common_responses.js +13 -0
- package/script/npm/src/src/shared/index.d.ts +3 -0
- package/script/npm/src/src/shared/index.d.ts.map +1 -0
- package/script/npm/src/src/shared/index.js +18 -0
- package/script/npm/src/src/shared/token_required_repository.d.ts +78 -0
- package/script/npm/src/src/shared/token_required_repository.d.ts.map +1 -0
- package/script/npm/src/src/shared/token_required_repository.js +132 -0
- package/script/package.json +3 -0
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.esm.js +0 -2
- package/dist/index.esm.js.map +0 -1
- package/dist/lib/api/base-repository.d.ts +0 -175
- package/dist/lib/api/index.d.ts +0 -1
- package/dist/lib/error/error.utils.d.ts +0 -22
- package/dist/lib/error/index.d.ts +0 -3
- package/dist/lib/query/index.d.ts +0 -4
- package/dist/lib/query/pagination/pagination.d.ts +0 -73
- package/dist/lib/query/pagination/pagination.schemas.d.ts +0 -83
- package/dist/lib/query/query.builder.d.ts +0 -71
- package/dist/lib/query/query.types.d.ts +0 -36
- package/dist/modules/auth/auth.manager.d.ts +0 -249
- package/dist/modules/auth/auth.repository.d.ts +0 -83
- package/dist/modules/auth/auth.store.d.ts +0 -139
- package/dist/modules/auth/company-membership.model.d.ts +0 -171
- package/dist/modules/auth/index.d.ts +0 -4
- package/dist/modules/auth/user.model.d.ts +0 -363
- package/dist/modules/contact/contact-info.model.d.ts +0 -485
- package/dist/modules/contact/contact-input-handler.d.ts +0 -16
- package/dist/modules/contact/contact.dtos.d.ts +0 -84
- package/dist/modules/contact/contact.model.d.ts +0 -441
- package/dist/modules/contact/contact.repository.d.ts +0 -116
- package/dist/modules/contact/index.d.ts +0 -4
- package/dist/modules/login/index.d.ts +0 -4
- package/dist/modules/login/login.api-contract.d.ts +0 -51
- package/dist/modules/login/login.dtos.d.ts +0 -85
- package/dist/modules/login/login.model.d.ts +0 -168
- package/dist/modules/login/login.repository.d.ts +0 -58
- package/dist/modules/payout/index.d.ts +0 -5
- package/dist/modules/payout/payout-channel-handler.d.ts +0 -82
- package/dist/modules/payout/payout.dtos.d.ts +0 -605
- package/dist/modules/payout/payout.model.d.ts +0 -379
- package/dist/modules/payout/payout.query.d.ts +0 -133
- package/dist/modules/payout/payout.repository.d.ts +0 -181
- package/dist/modules/profile/index.d.ts +0 -3
- package/dist/modules/profile/profile.dtos.d.ts +0 -80
- package/dist/modules/profile/profile.repository.d.ts +0 -56
- package/dist/modules/team-member/index.d.ts +0 -4
- package/dist/modules/team-member/role.model.d.ts +0 -61
- package/dist/modules/team-member/team-member.dtos.d.ts +0 -261
- package/dist/modules/team-member/team-member.model.d.ts +0 -237
- package/dist/modules/team-member/team-member.repository.d.ts +0 -179
- package/dist/modules/wallet/index.d.ts +0 -7
- package/dist/modules/wallet/narration.model.d.ts +0 -225
- package/dist/modules/wallet/statement-entry.model.d.ts +0 -299
- package/dist/modules/wallet/wallet-manager.session.d.ts +0 -143
- package/dist/modules/wallet/wallet.dtos.d.ts +0 -204
- package/dist/modules/wallet/wallet.query.d.ts +0 -95
- package/dist/modules/wallet/wallet.repository.d.ts +0 -205
- package/dist/modules/wallet/wallet.utils.d.ts +0 -17
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All Afloat Permissions
|
|
3
|
+
*/
|
|
4
|
+
export declare const Permissions: {
|
|
5
|
+
readonly Profile: {
|
|
6
|
+
readonly ViewCurrent: "profile.getCurrent";
|
|
7
|
+
readonly Update: "profile.update";
|
|
8
|
+
};
|
|
9
|
+
readonly Contact: {
|
|
10
|
+
readonly View: "contact.findById";
|
|
11
|
+
readonly List: "contact.findAll";
|
|
12
|
+
readonly Create: "contact.create";
|
|
13
|
+
readonly Update: "contact.update";
|
|
14
|
+
readonly Delete: "contact.delete";
|
|
15
|
+
};
|
|
16
|
+
readonly Payment: {
|
|
17
|
+
readonly View: "payment.findById";
|
|
18
|
+
readonly List: "payment.findAll";
|
|
19
|
+
readonly Create: "payment.create";
|
|
20
|
+
};
|
|
21
|
+
readonly Payout: {
|
|
22
|
+
readonly View: "payout.findById";
|
|
23
|
+
readonly List: "payout.findAll";
|
|
24
|
+
readonly Create: "payout.create";
|
|
25
|
+
readonly Approve: "payout.approve";
|
|
26
|
+
};
|
|
27
|
+
readonly Transfer: {
|
|
28
|
+
readonly View: "transfer.findById";
|
|
29
|
+
readonly List: "transfer.findAll";
|
|
30
|
+
readonly Create: "transfer.create";
|
|
31
|
+
readonly Approve: "transfer.approve";
|
|
32
|
+
};
|
|
33
|
+
readonly Wallet: {
|
|
34
|
+
readonly ViewBalance: "wallet.getBalance";
|
|
35
|
+
readonly ViewStatement: "wallet.getStatement";
|
|
36
|
+
};
|
|
37
|
+
readonly Role: {
|
|
38
|
+
readonly ViewRoles: "role.findAll";
|
|
39
|
+
readonly ViewRole: "role.findById";
|
|
40
|
+
};
|
|
41
|
+
readonly UserManagement: {
|
|
42
|
+
readonly ViewUsers: "login.findAll";
|
|
43
|
+
readonly ViewUser: "login.findById";
|
|
44
|
+
readonly CreateUser: "login.create";
|
|
45
|
+
readonly UpdateUser: "login.update";
|
|
46
|
+
readonly ArchiveUser: "login.archive";
|
|
47
|
+
readonly UnArchiveUser: "login.unarchive";
|
|
48
|
+
readonly ResetPassword: "login.resetPassword";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Permission Type
|
|
53
|
+
*/
|
|
54
|
+
export type Permission = typeof Permissions.Profile[keyof typeof Permissions.Profile] | typeof Permissions.Contact[keyof typeof Permissions.Contact] | typeof Permissions.Payment[keyof typeof Permissions.Payment] | typeof Permissions.Payout[keyof typeof Permissions.Payout] | typeof Permissions.Transfer[keyof typeof Permissions.Transfer] | typeof Permissions.UserManagement[keyof typeof Permissions.UserManagement] | typeof Permissions.Role[keyof typeof Permissions.Role] | typeof Permissions.Wallet[keyof typeof Permissions.Wallet];
|
|
55
|
+
//# sourceMappingURL=permission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/permission.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Cd,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAC5D,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAC5D,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAC5D,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,OAAO,WAAW,CAAC,MAAM,CAAC,GAC1D,OAAO,WAAW,CAAC,QAAQ,CAAC,MAAM,OAAO,WAAW,CAAC,QAAQ,CAAC,GAC9D,OAAO,WAAW,CAAC,cAAc,CAAC,MAAM,OAAO,WAAW,CAAC,cAAc,CAAC,GAC1E,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,OAAO,WAAW,CAAC,IAAI,CAAC,GACtD,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Permissions = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* All Afloat Permissions
|
|
6
|
+
*/
|
|
7
|
+
exports.Permissions = {
|
|
8
|
+
Profile: {
|
|
9
|
+
ViewCurrent: "profile.getCurrent",
|
|
10
|
+
Update: "profile.update",
|
|
11
|
+
},
|
|
12
|
+
Contact: {
|
|
13
|
+
View: "contact.findById",
|
|
14
|
+
List: "contact.findAll",
|
|
15
|
+
Create: "contact.create",
|
|
16
|
+
Update: "contact.update",
|
|
17
|
+
Delete: "contact.delete",
|
|
18
|
+
},
|
|
19
|
+
Payment: {
|
|
20
|
+
View: "payment.findById",
|
|
21
|
+
List: "payment.findAll",
|
|
22
|
+
Create: "payment.create",
|
|
23
|
+
},
|
|
24
|
+
Payout: {
|
|
25
|
+
View: "payout.findById",
|
|
26
|
+
List: "payout.findAll",
|
|
27
|
+
Create: "payout.create",
|
|
28
|
+
Approve: "payout.approve",
|
|
29
|
+
},
|
|
30
|
+
Transfer: {
|
|
31
|
+
View: "transfer.findById",
|
|
32
|
+
List: "transfer.findAll",
|
|
33
|
+
Create: "transfer.create",
|
|
34
|
+
Approve: "transfer.approve",
|
|
35
|
+
},
|
|
36
|
+
Wallet: {
|
|
37
|
+
ViewBalance: "wallet.getBalance",
|
|
38
|
+
ViewStatement: "wallet.getStatement",
|
|
39
|
+
},
|
|
40
|
+
Role: {
|
|
41
|
+
ViewRoles: "role.findAll",
|
|
42
|
+
ViewRole: "role.findById",
|
|
43
|
+
},
|
|
44
|
+
UserManagement: {
|
|
45
|
+
ViewUsers: "login.findAll",
|
|
46
|
+
ViewUser: "login.findById",
|
|
47
|
+
CreateUser: "login.create",
|
|
48
|
+
UpdateUser: "login.update",
|
|
49
|
+
ArchiveUser: "login.archive",
|
|
50
|
+
UnArchiveUser: "login.unarchive",
|
|
51
|
+
ResetPassword: "login.resetPassword",
|
|
52
|
+
},
|
|
53
|
+
}; // Make it deeply readonly
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface RoleData {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
access: string[];
|
|
6
|
+
createdAt: string;
|
|
7
|
+
updatedAt: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class Role {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
readonly permissions: ReadonlySet<string>;
|
|
14
|
+
readonly createdAt: Date;
|
|
15
|
+
readonly updatedAt: Date;
|
|
16
|
+
constructor(data: RoleData);
|
|
17
|
+
hasPermission(permission: string): boolean;
|
|
18
|
+
static from(data: any): Role | undefined;
|
|
19
|
+
toJSON(): any;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=role.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../../../../src/src/models/role.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,IAAI;IACf,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrC,SAAgB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjD,SAAgB,SAAS,EAAE,IAAI,CAAC;IAChC,SAAgB,SAAS,EAAE,IAAI,CAAC;gBAEpB,IAAI,EAAE,QAAQ;IAS1B,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI1C,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS;IAYxC,MAAM,IAAI,GAAG;CAUd"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// deno-lint-ignore-file no-explicit-any
|
|
3
|
+
// ====================== Role Entity ====================== //
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.Role = void 0;
|
|
6
|
+
class Role {
|
|
7
|
+
constructor(data) {
|
|
8
|
+
Object.defineProperty(this, "id", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: void 0
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(this, "name", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "description", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "permissions", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(this, "createdAt", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: void 0
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(this, "updatedAt", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true,
|
|
42
|
+
value: void 0
|
|
43
|
+
});
|
|
44
|
+
this.id = data.id;
|
|
45
|
+
this.name = data.name;
|
|
46
|
+
this.description = data.description;
|
|
47
|
+
this.permissions = new Set(data.access);
|
|
48
|
+
this.createdAt = new Date(data.createdAt);
|
|
49
|
+
this.updatedAt = new Date(data.updatedAt);
|
|
50
|
+
}
|
|
51
|
+
hasPermission(permission) {
|
|
52
|
+
return this.permissions.has(permission);
|
|
53
|
+
}
|
|
54
|
+
static from(data) {
|
|
55
|
+
try {
|
|
56
|
+
if (!data?.id || !data?.name || !Array.isArray(data?.access)) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
return new Role(data);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error("Error creating Role:", error);
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
toJSON() {
|
|
67
|
+
return {
|
|
68
|
+
id: this.id,
|
|
69
|
+
name: this.name,
|
|
70
|
+
description: this.description,
|
|
71
|
+
access: Array.from(this.permissions),
|
|
72
|
+
createdAt: this.createdAt.toISOString(),
|
|
73
|
+
updatedAt: this.updatedAt.toISOString(),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.Role = Role;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Profile } from "./profile.js";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a user in Afloat.
|
|
4
|
+
*
|
|
5
|
+
* This class centralizes user-related logic, simplifying interaction
|
|
6
|
+
* with user-related data and ensuring consistent permission checks across the application.
|
|
7
|
+
*/
|
|
8
|
+
export declare class User {
|
|
9
|
+
/**
|
|
10
|
+
* Logged-in user name
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Logged-in identity: phone-number or email address
|
|
15
|
+
*/
|
|
16
|
+
identity: string;
|
|
17
|
+
/**
|
|
18
|
+
* The user's Afloat profile, containing personal information such as name, contact details, and account information.
|
|
19
|
+
*/
|
|
20
|
+
profile: Profile;
|
|
21
|
+
/**
|
|
22
|
+
* The user's authentication token. This token must be passed in the request headers
|
|
23
|
+
* for all authenticated API endpoints.
|
|
24
|
+
*/
|
|
25
|
+
token: string;
|
|
26
|
+
/**
|
|
27
|
+
* Indicates whether the user is required to change their default password.
|
|
28
|
+
*
|
|
29
|
+
* Afloat users are initially provided with a default username and password. After the first
|
|
30
|
+
* successful login, `resetPassword` will be set to `true` to prompt the user to set a new password.
|
|
31
|
+
*/
|
|
32
|
+
resetPassword: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* A map of permission keys to boolean values, indicating whether the user has access
|
|
35
|
+
* to specific actions or features in the system.
|
|
36
|
+
*/
|
|
37
|
+
private permissionsMap;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new instance of the `User` class.
|
|
40
|
+
*
|
|
41
|
+
* @param userData - An object containing the user's profile, token,
|
|
42
|
+
* permissions (access list), and the `resetPassword` flag.
|
|
43
|
+
*/
|
|
44
|
+
private constructor();
|
|
45
|
+
/**
|
|
46
|
+
* Checks if the user has a specific permission.
|
|
47
|
+
*
|
|
48
|
+
* @param permission - The permission key to check.
|
|
49
|
+
* @returns `true` if the user has the specified permission, otherwise `false`.
|
|
50
|
+
*/
|
|
51
|
+
can(permission: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Serializes the `User` instance to a JSON string.
|
|
54
|
+
*
|
|
55
|
+
* @returns A JSON string representation of the `User` instance, including:
|
|
56
|
+
* - `profile`: The user's profile information. (Requires profile.toJSON() method)
|
|
57
|
+
* - `token`: The user's authentication token.
|
|
58
|
+
* - `resetPassword`: Indicates whether the user must reset their password.
|
|
59
|
+
* - `permissions`: An array of permission keys the user has.
|
|
60
|
+
*/
|
|
61
|
+
toJSON(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new `User` instance from a JSON string.
|
|
64
|
+
*
|
|
65
|
+
* @param jsonString - A JSON string containing user data.
|
|
66
|
+
* @returns A `User` instance reconstructed from the JSON data, or undefined if jsonString is invalid.
|
|
67
|
+
*/
|
|
68
|
+
static fromJSON(jsonString: string): User | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new `User` instance from a data object, JSON string, or object with a Profile instance/object.
|
|
71
|
+
*
|
|
72
|
+
* @param data - The data object, JSON string, or object with Profile instance/object containing user information.
|
|
73
|
+
* @returns A `User` instance, or undefined if data is invalid.
|
|
74
|
+
*/
|
|
75
|
+
static from(data: any): User | undefined;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=authenticated-user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticated-user.d.ts","sourceRoot":"","sources":["../../../../../../src/src/models/user/authenticated-user.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;;GAKG;AACH,qBAAa,IAAI;IACf;;OAEG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACI,QAAQ,EAAE,MAAM,CAAC;IAExB;;OAEG;IACI,OAAO,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACI,KAAK,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACI,aAAa,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,OAAO,CAAC,cAAc,CAA0B;IAEhD;;;;;OAKG;IACH,OAAO;IAwBP;;;;;OAKG;IACI,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAIvC;;;;;;;;OAQG;IACI,MAAM,IAAI,MAAM;IAavB;;;;;OAKG;WACW,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAS5D;;;;;OAKG;WACW,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS;CA4FhD"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.User = void 0;
|
|
4
|
+
// deno-lint-ignore-file no-explicit-any
|
|
5
|
+
const permission_js_1 = require("../permission.js");
|
|
6
|
+
const profile_js_1 = require("./profile.js");
|
|
7
|
+
/**
|
|
8
|
+
* Represents a user in Afloat.
|
|
9
|
+
*
|
|
10
|
+
* This class centralizes user-related logic, simplifying interaction
|
|
11
|
+
* with user-related data and ensuring consistent permission checks across the application.
|
|
12
|
+
*/
|
|
13
|
+
class User {
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new instance of the `User` class.
|
|
16
|
+
*
|
|
17
|
+
* @param userData - An object containing the user's profile, token,
|
|
18
|
+
* permissions (access list), and the `resetPassword` flag.
|
|
19
|
+
*/
|
|
20
|
+
constructor(data) {
|
|
21
|
+
/**
|
|
22
|
+
* Logged-in user name
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(this, "name", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Logged-in identity: phone-number or email address
|
|
32
|
+
*/
|
|
33
|
+
Object.defineProperty(this, "identity", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true,
|
|
37
|
+
value: void 0
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* The user's Afloat profile, containing personal information such as name, contact details, and account information.
|
|
41
|
+
*/
|
|
42
|
+
Object.defineProperty(this, "profile", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true,
|
|
46
|
+
value: void 0
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* The user's authentication token. This token must be passed in the request headers
|
|
50
|
+
* for all authenticated API endpoints.
|
|
51
|
+
*/
|
|
52
|
+
Object.defineProperty(this, "token", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true,
|
|
56
|
+
value: void 0
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Indicates whether the user is required to change their default password.
|
|
60
|
+
*
|
|
61
|
+
* Afloat users are initially provided with a default username and password. After the first
|
|
62
|
+
* successful login, `resetPassword` will be set to `true` to prompt the user to set a new password.
|
|
63
|
+
*/
|
|
64
|
+
Object.defineProperty(this, "resetPassword", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value: void 0
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* A map of permission keys to boolean values, indicating whether the user has access
|
|
72
|
+
* to specific actions or features in the system.
|
|
73
|
+
*/
|
|
74
|
+
Object.defineProperty(this, "permissionsMap", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
configurable: true,
|
|
77
|
+
writable: true,
|
|
78
|
+
value: void 0
|
|
79
|
+
});
|
|
80
|
+
const { profile, token, access, resetPassword, name, identity } = data;
|
|
81
|
+
this.profile = profile;
|
|
82
|
+
this.token = token;
|
|
83
|
+
this.resetPassword = resetPassword;
|
|
84
|
+
this.name = name;
|
|
85
|
+
this.identity = identity;
|
|
86
|
+
this.permissionsMap = {};
|
|
87
|
+
for (const group of Object.values(permission_js_1.Permissions)) {
|
|
88
|
+
for (const perm of Object.values(group)) {
|
|
89
|
+
this.permissionsMap[perm] = access.includes(perm);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Checks if the user has a specific permission.
|
|
95
|
+
*
|
|
96
|
+
* @param permission - The permission key to check.
|
|
97
|
+
* @returns `true` if the user has the specified permission, otherwise `false`.
|
|
98
|
+
*/
|
|
99
|
+
can(permission) {
|
|
100
|
+
return this.permissionsMap[permission] ?? false;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Serializes the `User` instance to a JSON string.
|
|
104
|
+
*
|
|
105
|
+
* @returns A JSON string representation of the `User` instance, including:
|
|
106
|
+
* - `profile`: The user's profile information. (Requires profile.toJSON() method)
|
|
107
|
+
* - `token`: The user's authentication token.
|
|
108
|
+
* - `resetPassword`: Indicates whether the user must reset their password.
|
|
109
|
+
* - `permissions`: An array of permission keys the user has.
|
|
110
|
+
*/
|
|
111
|
+
toJSON() {
|
|
112
|
+
return JSON.stringify({
|
|
113
|
+
profile: this.profile.toObject(),
|
|
114
|
+
token: this.token,
|
|
115
|
+
resetPassword: this.resetPassword,
|
|
116
|
+
name: this.name,
|
|
117
|
+
identity: this.identity,
|
|
118
|
+
permissions: Object.keys(this.permissionsMap).filter((key) => this.permissionsMap[key]),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Creates a new `User` instance from a JSON string.
|
|
123
|
+
*
|
|
124
|
+
* @param jsonString - A JSON string containing user data.
|
|
125
|
+
* @returns A `User` instance reconstructed from the JSON data, or undefined if jsonString is invalid.
|
|
126
|
+
*/
|
|
127
|
+
static fromJSON(jsonString) {
|
|
128
|
+
try {
|
|
129
|
+
return User.from(JSON.parse(jsonString));
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
console.error("Invalid JSON string:", e);
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Creates a new `User` instance from a data object, JSON string, or object with a Profile instance/object.
|
|
138
|
+
*
|
|
139
|
+
* @param data - The data object, JSON string, or object with Profile instance/object containing user information.
|
|
140
|
+
* @returns A `User` instance, or undefined if data is invalid.
|
|
141
|
+
*/
|
|
142
|
+
static from(data) {
|
|
143
|
+
let parsedData;
|
|
144
|
+
// Parse JSON string if needed
|
|
145
|
+
if (typeof data === "string") {
|
|
146
|
+
try {
|
|
147
|
+
parsedData = JSON.parse(data);
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
console.error("Invalid JSON string:", error);
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
parsedData = data;
|
|
156
|
+
}
|
|
157
|
+
if (!parsedData) {
|
|
158
|
+
console.error("Data is null or undefined.");
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
// Handle different profile formats
|
|
162
|
+
let profile;
|
|
163
|
+
let rawProfile = parsedData.profile;
|
|
164
|
+
// Handle stringified profile (the case in the provided sample)
|
|
165
|
+
if (typeof rawProfile === "string") {
|
|
166
|
+
try {
|
|
167
|
+
// Attempt to parse the stringified profile
|
|
168
|
+
rawProfile = JSON.parse(rawProfile);
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
console.error("Failed to parse profile JSON string:", error);
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// Create Profile instance based on what we received
|
|
176
|
+
if (profile_js_1.Profile.is(rawProfile)) {
|
|
177
|
+
// Already a Profile instance
|
|
178
|
+
profile = rawProfile;
|
|
179
|
+
}
|
|
180
|
+
else if (typeof rawProfile === "object" && rawProfile !== null) {
|
|
181
|
+
// Convert object to Profile instance
|
|
182
|
+
profile = profile_js_1.Profile.from(rawProfile);
|
|
183
|
+
if (!profile) {
|
|
184
|
+
console.error("Failed to create Profile from data:", rawProfile);
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else if (typeof rawProfile === "string") {
|
|
189
|
+
profile = profile_js_1.Profile.fromJSON(rawProfile);
|
|
190
|
+
if (!profile) {
|
|
191
|
+
console.error("Failed to create Profile from JSON data:", rawProfile);
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
console.error("Invalid profile format:", typeof rawProfile);
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
// Validate other required fields
|
|
200
|
+
if (!parsedData.token || typeof parsedData.token !== "string" ||
|
|
201
|
+
!parsedData.name || typeof parsedData.name !== "string" ||
|
|
202
|
+
!parsedData.identity || typeof parsedData.identity !== "string" ||
|
|
203
|
+
!Array.isArray(parsedData.permissions) &&
|
|
204
|
+
!Array.isArray(parsedData.access) ||
|
|
205
|
+
typeof parsedData.resetPassword !== "boolean") {
|
|
206
|
+
console.error("Missing or invalid required User fields:", {
|
|
207
|
+
token: typeof parsedData.token,
|
|
208
|
+
name: typeof parsedData.name,
|
|
209
|
+
identity: typeof parsedData.identity,
|
|
210
|
+
permissions: Array.isArray(parsedData.permissions),
|
|
211
|
+
access: Array.isArray(parsedData.access),
|
|
212
|
+
resetPassword: typeof parsedData.resetPassword,
|
|
213
|
+
});
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
// Support both 'permissions' and 'access' field names
|
|
217
|
+
const access = parsedData.access || parsedData.permissions;
|
|
218
|
+
// Create and return the User instance
|
|
219
|
+
const args = {
|
|
220
|
+
profile: profile,
|
|
221
|
+
token: parsedData.token,
|
|
222
|
+
access: access,
|
|
223
|
+
resetPassword: parsedData.resetPassword,
|
|
224
|
+
name: parsedData.name,
|
|
225
|
+
identity: parsedData.identity,
|
|
226
|
+
};
|
|
227
|
+
return new User(args);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
exports.User = User;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/src/models/user/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./profile.js"), exports);
|
|
18
|
+
__exportStar(require("./authenticated-user.js"), exports);
|
|
19
|
+
__exportStar(require("./managed-user.js"), exports);
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Role, type RoleData } from "../role.js";
|
|
2
|
+
export interface UserEntityData {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
identity: string;
|
|
6
|
+
profileId: string;
|
|
7
|
+
permissions: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Base user entity - represents a user in the system
|
|
11
|
+
*/
|
|
12
|
+
export declare class UserEntity {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly identity: string;
|
|
16
|
+
readonly profileId: string;
|
|
17
|
+
readonly permissions: ReadonlySet<string>;
|
|
18
|
+
constructor(data: UserEntityData);
|
|
19
|
+
/**
|
|
20
|
+
* Check if user has a specific permission
|
|
21
|
+
*/
|
|
22
|
+
can(permission: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Check if user has any of the specified permissions
|
|
25
|
+
*/
|
|
26
|
+
canAny(permissions: string[]): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Check if user has all of the specified permissions
|
|
29
|
+
*/
|
|
30
|
+
canAll(permissions: string[]): boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface AuthenticatedUserData {
|
|
33
|
+
name: string;
|
|
34
|
+
identity: string;
|
|
35
|
+
profileId: string;
|
|
36
|
+
profile: any;
|
|
37
|
+
token: string;
|
|
38
|
+
resetPassword: boolean;
|
|
39
|
+
permissions: string[];
|
|
40
|
+
sessionId?: string;
|
|
41
|
+
expiresAt?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ManagedUserData {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
identity: string;
|
|
47
|
+
type: string;
|
|
48
|
+
profileId: string;
|
|
49
|
+
roleId: string;
|
|
50
|
+
resetPassword: boolean;
|
|
51
|
+
isActive: boolean;
|
|
52
|
+
isArchived: boolean;
|
|
53
|
+
role?: RoleData;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Represents a user from the admin management perspective.
|
|
59
|
+
* Same person as AuthenticatedUser but with management metadata and capabilities.
|
|
60
|
+
*/
|
|
61
|
+
export declare class ManagedUser extends UserEntity {
|
|
62
|
+
readonly type: string;
|
|
63
|
+
readonly roleId: string;
|
|
64
|
+
readonly resetPassword: boolean;
|
|
65
|
+
readonly isActive: boolean;
|
|
66
|
+
readonly isArchived: boolean;
|
|
67
|
+
readonly role?: Role;
|
|
68
|
+
readonly createdAt: Date;
|
|
69
|
+
readonly updatedAt: Date;
|
|
70
|
+
constructor(data: ManagedUserData);
|
|
71
|
+
/**
|
|
72
|
+
* Check if user account is active
|
|
73
|
+
*/
|
|
74
|
+
isAccountActive(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Check if user account is archived
|
|
77
|
+
*/
|
|
78
|
+
isAccountArchived(): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Check if user needs to reset password
|
|
81
|
+
*/
|
|
82
|
+
needsPasswordReset(): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Get comprehensive account status
|
|
85
|
+
*/
|
|
86
|
+
getAccountStatus(): {
|
|
87
|
+
status: "active" | "inactive" | "archived" | "password_reset_required";
|
|
88
|
+
label: string;
|
|
89
|
+
color: "success" | "warning" | "error" | "default";
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Get role display name
|
|
94
|
+
*/
|
|
95
|
+
getRoleName(): string;
|
|
96
|
+
/**
|
|
97
|
+
* Get formatted creation date
|
|
98
|
+
*/
|
|
99
|
+
getCreatedDate(): string;
|
|
100
|
+
/**
|
|
101
|
+
* Get time since last update
|
|
102
|
+
*/
|
|
103
|
+
getLastUpdateInfo(): string;
|
|
104
|
+
static from(data: any): ManagedUser | undefined;
|
|
105
|
+
static createMany(dataArray: any[]): ManagedUser[];
|
|
106
|
+
toJSON(): any;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=managed-user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-user.d.ts","sourceRoot":"","sources":["../../../../../../src/src/models/user/managed-user.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;gBAErC,IAAI,EAAE,cAAc;IAQhC;;OAEG;IACH,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAIhC;;OAEG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO;IAItC;;OAEG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO;CAGvC;AAID,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,WAAY,SAAQ,UAAU;IACzC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,aAAa,EAAE,OAAO,CAAC;IACvC,SAAgB,QAAQ,EAAE,OAAO,CAAC;IAClC,SAAgB,UAAU,EAAE,OAAO,CAAC;IACpC,SAAgB,IAAI,CAAC,EAAE,IAAI,CAAC;IAC5B,SAAgB,SAAS,EAAE,IAAI,CAAC;IAChC,SAAgB,SAAS,EAAE,IAAI,CAAC;gBAEpB,IAAI,EAAE,eAAe;IA0BjC;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;OAEG;IACH,iBAAiB,IAAI,OAAO;IAI5B;;OAEG;IACH,kBAAkB,IAAI,OAAO;IAI7B;;OAEG;IACH,gBAAgB,IAAI;QAClB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,yBAAyB,CAAC;QACvE,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;QACnD,WAAW,EAAE,MAAM,CAAC;KACrB;IAoCD;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,iBAAiB,IAAI,MAAM;IAY3B,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,WAAW,GAAG,SAAS;IAa/C,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,WAAW,EAAE;IAMlD,MAAM,IAAI,GAAG;CAgBd"}
|