@23blocks/block-authentication 6.3.6 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/lib/services/api-keys.service.d.ts +4 -1
- package/dist/src/lib/services/api-keys.service.d.ts.map +1 -1
- package/dist/src/lib/services/auth.service.d.ts +70 -20
- package/dist/src/lib/services/auth.service.d.ts.map +1 -1
- package/dist/src/lib/services/avatars.service.d.ts +23 -9
- package/dist/src/lib/services/avatars.service.d.ts.map +1 -1
- package/dist/src/lib/services/jwks.service.d.ts +1 -1
- package/dist/src/lib/services/mfa.service.d.ts +19 -6
- package/dist/src/lib/services/mfa.service.d.ts.map +1 -1
- package/dist/src/lib/services/oauth.service.d.ts +30 -11
- package/dist/src/lib/services/oauth.service.d.ts.map +1 -1
- package/dist/src/lib/services/oidc.service.d.ts +1 -1
- package/dist/src/lib/services/roles.service.d.ts +1 -1
- package/dist/src/lib/services/tenants.service.d.ts +1 -1
- package/dist/src/lib/services/users.service.d.ts +92 -25
- package/dist/src/lib/services/users.service.d.ts.map +1 -1
- package/dist/src/lib/types/auth.d.ts +22 -3
- package/dist/src/lib/types/auth.d.ts.map +1 -1
- package/dist/src/lib/types/user.d.ts +27 -2
- package/dist/src/lib/types/user.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,10 @@ import type { Transport, PageResult, ListParams } from '@23blocks/contracts';
|
|
|
2
2
|
import type { ApiKey, ApiKeyWithSecret, CreateApiKeyRequest, UpdateApiKeyRequest, RevokeApiKeyRequest } from '../types/index.js';
|
|
3
3
|
import type { AuthenticationBlockConfig } from '../authentication.block.js';
|
|
4
4
|
/**
|
|
5
|
-
* API Keys service
|
|
5
|
+
* API Keys service - create, manage, and monitor API keys with scopes, rate limits, and usage tracking.
|
|
6
|
+
*
|
|
7
|
+
* @note `create()` and `regenerate()` return `ApiKeyWithSecret` which includes the secret key.
|
|
8
|
+
* The secret is only available at creation/regeneration time and cannot be retrieved later.
|
|
6
9
|
*/
|
|
7
10
|
export interface ApiKeysService {
|
|
8
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/api-keys.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,KAAK,EACV,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAE5E
|
|
1
|
+
{"version":3,"file":"api-keys.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/api-keys.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,KAAK,EACV,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvD;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvC;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEhE;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExE;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAExD;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzE;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC1F;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,aAAa,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,yBAAyB,GACjC,cAAc,CA4HhB"}
|
|
@@ -2,83 +2,133 @@ import type { Transport } from '@23blocks/contracts';
|
|
|
2
2
|
import type { SignInRequest, SignInResponse, SignUpRequest, SignUpResponse, PasswordResetRequest, PasswordUpdateRequest, TokenValidationResponse, RefreshTokenRequest, RefreshTokenResponse, MagicLinkRequest, MagicLinkVerifyRequest, InvitationRequest, AcceptInvitationRequest, ResendConfirmationRequest, ValidateEmailRequest, ValidateEmailResponse, ValidateDocumentRequest, ValidateDocumentResponse, ResendInvitationRequest, AccountRecoveryRequest, AccountRecoveryResponse, CompleteRecoveryRequest, User } from '../types/index.js';
|
|
3
3
|
import type { AuthenticationBlockConfig } from '../authentication.block.js';
|
|
4
4
|
/**
|
|
5
|
-
* Authentication service
|
|
5
|
+
* Authentication service - handles sign in, sign up, sign out, password management,
|
|
6
|
+
* magic links, invitations, email confirmation, and account recovery.
|
|
6
7
|
*/
|
|
7
8
|
export interface AuthService {
|
|
8
9
|
/**
|
|
9
|
-
* Sign in with email and password
|
|
10
|
+
* Sign in with email and password.
|
|
11
|
+
*
|
|
12
|
+
* @returns SignInResponse containing `user` (with role/avatar/profile if included),
|
|
13
|
+
* `accessToken`, optional `refreshToken`, `tokenType`, and `expiresIn`.
|
|
14
|
+
* @example
|
|
15
|
+
* const { user, accessToken } = await auth.auth.signIn({
|
|
16
|
+
* email: 'user@example.com',
|
|
17
|
+
* password: 'password',
|
|
18
|
+
* });
|
|
10
19
|
*/
|
|
11
20
|
signIn(request: SignInRequest): Promise<SignInResponse>;
|
|
12
21
|
/**
|
|
13
|
-
* Sign up a new user
|
|
22
|
+
* Sign up a new user.
|
|
23
|
+
*
|
|
24
|
+
* @returns SignUpResponse containing `user`, optional `accessToken` (may be absent
|
|
25
|
+
* if email confirmation is required), and optional `message`.
|
|
26
|
+
* @note If email confirmation is enabled, `accessToken` will be undefined until confirmed.
|
|
14
27
|
*/
|
|
15
28
|
signUp(request: SignUpRequest): Promise<SignUpResponse>;
|
|
16
29
|
/**
|
|
17
|
-
* Sign out the current user
|
|
30
|
+
* Sign out the current user. Invalidates the current session server-side.
|
|
18
31
|
*/
|
|
19
32
|
signOut(): Promise<void>;
|
|
20
33
|
/**
|
|
21
|
-
* Validate the current token and get user info
|
|
34
|
+
* Validate the current token and get basic user info.
|
|
35
|
+
*
|
|
36
|
+
* @returns TokenValidationResponse with `user` (without relationships) and `valid: true`.
|
|
37
|
+
* @note Unlike `getCurrentUser()`, this does NOT include role, avatar, or profile relationships.
|
|
38
|
+
* Use this for lightweight token checks; use `getCurrentUser()` for full user data.
|
|
22
39
|
*/
|
|
23
40
|
validateToken(): Promise<TokenValidationResponse>;
|
|
24
41
|
/**
|
|
25
|
-
* Get the current authenticated user
|
|
42
|
+
* Get the current authenticated user with all relationships pre-loaded.
|
|
43
|
+
*
|
|
44
|
+
* @returns User with `role`, `avatar`, and `profile` relationships populated.
|
|
45
|
+
* Access profile data via `user.profile?.firstName`, role via `user.role?.name`.
|
|
46
|
+
* @example
|
|
47
|
+
* const user = await auth.auth.getCurrentUser();
|
|
48
|
+
* console.log(user.profile?.firstName); // 'Jane'
|
|
49
|
+
* console.log(user.role?.name); // 'admin'
|
|
50
|
+
* console.log(user.avatar?.url); // 'https://...'
|
|
26
51
|
*/
|
|
27
52
|
getCurrentUser(): Promise<User>;
|
|
28
53
|
/**
|
|
29
|
-
* Request a password reset email
|
|
54
|
+
* Request a password reset email. Sends an email with a reset link.
|
|
55
|
+
*
|
|
56
|
+
* @param request - Contains `email` and optional `redirectUrl` for the reset page.
|
|
30
57
|
*/
|
|
31
58
|
requestPasswordReset(request: PasswordResetRequest): Promise<void>;
|
|
32
59
|
/**
|
|
33
|
-
* Update password
|
|
60
|
+
* Update password using either a reset token or the current password.
|
|
61
|
+
*
|
|
62
|
+
* @param request - Provide `resetPasswordToken` for reset flow, or `currentPassword` for change flow.
|
|
34
63
|
*/
|
|
35
64
|
updatePassword(request: PasswordUpdateRequest): Promise<void>;
|
|
36
65
|
/**
|
|
37
|
-
* Refresh the access token
|
|
66
|
+
* Refresh the access token using a refresh token.
|
|
67
|
+
*
|
|
68
|
+
* @returns RefreshTokenResponse with new `accessToken`, optional new `refreshToken`,
|
|
69
|
+
* `tokenType`, and `expiresIn`.
|
|
38
70
|
*/
|
|
39
71
|
refreshToken(request: RefreshTokenRequest): Promise<RefreshTokenResponse>;
|
|
40
72
|
/**
|
|
41
|
-
* Request a magic link for passwordless login
|
|
73
|
+
* Request a magic link for passwordless login. Sends an email with a login link.
|
|
42
74
|
*/
|
|
43
75
|
requestMagicLink(request: MagicLinkRequest): Promise<void>;
|
|
44
76
|
/**
|
|
45
|
-
* Verify a magic link token
|
|
77
|
+
* Verify a magic link token and sign in.
|
|
78
|
+
*
|
|
79
|
+
* @returns SignInResponse with `user`, `accessToken`, optional `refreshToken`.
|
|
46
80
|
*/
|
|
47
81
|
verifyMagicLink(request: MagicLinkVerifyRequest): Promise<SignInResponse>;
|
|
48
82
|
/**
|
|
49
|
-
* Send an invitation to a new user
|
|
83
|
+
* Send an invitation email to a new user.
|
|
84
|
+
*
|
|
85
|
+
* @param request - Contains `email`, optional `roleId`, and optional `redirectUrl`.
|
|
50
86
|
*/
|
|
51
87
|
sendInvitation(request: InvitationRequest): Promise<void>;
|
|
52
88
|
/**
|
|
53
|
-
* Accept an invitation
|
|
89
|
+
* Accept an invitation and create the user's account.
|
|
90
|
+
*
|
|
91
|
+
* @returns SignInResponse with the new `user`, `accessToken`, optional `refreshToken`.
|
|
54
92
|
*/
|
|
55
93
|
acceptInvitation(request: AcceptInvitationRequest): Promise<SignInResponse>;
|
|
56
94
|
/**
|
|
57
|
-
* Confirm email
|
|
95
|
+
* Confirm email address using a confirmation token (from the confirmation email link).
|
|
96
|
+
*
|
|
97
|
+
* @returns The confirmed User.
|
|
58
98
|
*/
|
|
59
99
|
confirmEmail(token: string): Promise<User>;
|
|
60
100
|
/**
|
|
61
|
-
* Resend confirmation email
|
|
101
|
+
* Resend the confirmation email for an unconfirmed user.
|
|
62
102
|
*/
|
|
63
103
|
resendConfirmation(request: ResendConfirmationRequest): Promise<void>;
|
|
64
104
|
/**
|
|
65
|
-
* Validate email before registration
|
|
105
|
+
* Validate an email before registration. Checks format, existence, and account status.
|
|
106
|
+
*
|
|
107
|
+
* @returns ValidateEmailResponse with `exists`, `wellFormed`, `canRecover`, `accountStatus`.
|
|
66
108
|
*/
|
|
67
109
|
validateEmail(request: ValidateEmailRequest): Promise<ValidateEmailResponse>;
|
|
68
110
|
/**
|
|
69
|
-
* Validate document before registration
|
|
111
|
+
* Validate a document (e.g., ID number) before registration. Checks existence and account status.
|
|
112
|
+
*
|
|
113
|
+
* @returns ValidateDocumentResponse with `exists`, `canRecover`, `maskedEmail`, `accountStatus`.
|
|
70
114
|
*/
|
|
71
115
|
validateDocument(request: ValidateDocumentRequest): Promise<ValidateDocumentResponse>;
|
|
72
116
|
/**
|
|
73
|
-
* Resend invitation email
|
|
117
|
+
* Resend an invitation email to a previously invited user.
|
|
118
|
+
*
|
|
119
|
+
* @returns The User whose invitation was resent.
|
|
74
120
|
*/
|
|
75
121
|
resendInvitation(request: ResendInvitationRequest): Promise<User>;
|
|
76
122
|
/**
|
|
77
|
-
* Request account recovery
|
|
123
|
+
* Request account recovery for a deleted/deactivated account. Sends a recovery email.
|
|
124
|
+
*
|
|
125
|
+
* @returns AccountRecoveryResponse with `success` and `message`.
|
|
78
126
|
*/
|
|
79
127
|
requestAccountRecovery(request: AccountRecoveryRequest): Promise<AccountRecoveryResponse>;
|
|
80
128
|
/**
|
|
81
|
-
* Complete account recovery
|
|
129
|
+
* Complete account recovery by setting a new password with the recovery token.
|
|
130
|
+
*
|
|
131
|
+
* @returns The recovered User.
|
|
82
132
|
*/
|
|
83
133
|
completeAccountRecovery(request: CompleteRecoveryRequest): Promise<User>;
|
|
84
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,IAAI,EACL,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAE5E
|
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,IAAI,EACL,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAE5E;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;OAUG;IACH,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAExD;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAExD;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;;;;;OAMG;IACH,aAAa,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAElD;;;;;;;;;;OAUG;IACH,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC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AC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,yBAAyB,GACjC,WAAW,CAuRb"}
|
|
@@ -2,39 +2,53 @@ import type { Transport, PageResult } from '@23blocks/contracts';
|
|
|
2
2
|
import type { UserAvatarFull, CreateAvatarRequest, AvatarPresignResponse, MultipartPresignRequest, MultipartPresignResponse, MultipartCompleteRequest, MultipartCompleteResponse } from '../types/index.js';
|
|
3
3
|
import type { ListParams } from '@23blocks/contracts';
|
|
4
4
|
/**
|
|
5
|
-
* Avatars
|
|
5
|
+
* Avatars service - manage user profile images with direct S3 upload support.
|
|
6
6
|
*/
|
|
7
7
|
export interface AvatarsService {
|
|
8
8
|
/**
|
|
9
|
-
* List avatars for a user
|
|
9
|
+
* List avatars for a user.
|
|
10
|
+
*
|
|
11
|
+
* @returns Paginated list of UserAvatarFull objects with `url`, `thumbnail`, `fileType`, etc.
|
|
10
12
|
*/
|
|
11
13
|
list(userUniqueId: string, params?: ListParams): Promise<PageResult<UserAvatarFull>>;
|
|
12
14
|
/**
|
|
13
|
-
* Get a
|
|
15
|
+
* Get the avatar for a user.
|
|
16
|
+
*
|
|
17
|
+
* @returns UserAvatarFull with `url`, `thumbnail`, `fileSize`, `fileType`.
|
|
14
18
|
*/
|
|
15
19
|
get(userUniqueId: string): Promise<UserAvatarFull>;
|
|
16
20
|
/**
|
|
17
|
-
* Create
|
|
21
|
+
* Create or replace a user's avatar using a URL (not direct upload).
|
|
22
|
+
*
|
|
23
|
+
* @returns The created UserAvatarFull.
|
|
18
24
|
*/
|
|
19
25
|
create(userUniqueId: string, request: CreateAvatarRequest): Promise<UserAvatarFull>;
|
|
20
26
|
/**
|
|
21
|
-
* Update
|
|
27
|
+
* Update avatar metadata.
|
|
28
|
+
*
|
|
29
|
+
* @returns The updated UserAvatarFull.
|
|
22
30
|
*/
|
|
23
31
|
update(userUniqueId: string, request: Partial<CreateAvatarRequest>): Promise<UserAvatarFull>;
|
|
24
32
|
/**
|
|
25
|
-
* Delete
|
|
33
|
+
* Delete a user's avatar.
|
|
26
34
|
*/
|
|
27
35
|
delete(userUniqueId: string): Promise<void>;
|
|
28
36
|
/**
|
|
29
|
-
* Get presigned URL for direct upload
|
|
37
|
+
* Get a presigned URL for direct-to-S3 avatar upload (single part).
|
|
38
|
+
*
|
|
39
|
+
* @returns AvatarPresignResponse with `uploadUrl` (PUT to S3), `publicUrl`, and `key`.
|
|
30
40
|
*/
|
|
31
41
|
presignUpload(userUniqueId: string, filename: string): Promise<AvatarPresignResponse>;
|
|
32
42
|
/**
|
|
33
|
-
* Get presigned URLs for multipart upload
|
|
43
|
+
* Get presigned URLs for multipart upload (large files).
|
|
44
|
+
*
|
|
45
|
+
* @returns MultipartPresignResponse with `uploadId`, `key`, and `parts[]` (each with `partNumber` and `uploadUrl`).
|
|
34
46
|
*/
|
|
35
47
|
multipartPresign(userUniqueId: string, request: MultipartPresignRequest): Promise<MultipartPresignResponse>;
|
|
36
48
|
/**
|
|
37
|
-
* Complete a multipart upload
|
|
49
|
+
* Complete a multipart upload after all parts have been uploaded.
|
|
50
|
+
*
|
|
51
|
+
* @returns MultipartCompleteResponse with `publicUrl` and `fileName`.
|
|
38
52
|
*/
|
|
39
53
|
multipartComplete(userUniqueId: string, request: MultipartCompleteRequest): Promise<MultipartCompleteResponse>;
|
|
40
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatars.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/avatars.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,mBAAm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AM,EAAE,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAE5G;;;;OAIG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAChH;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,cAAc,CAgHzE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Transport } from '@23blocks/contracts';
|
|
2
2
|
import type { JsonWebKey, JwksResponse, RsaKey, CreateRsaKeyRequest, RotateRsaKeyRequest } from '../types/jwks.js';
|
|
3
3
|
/**
|
|
4
|
-
* JWKS
|
|
4
|
+
* JWKS service - retrieve public JSON Web Keys for JWT verification.
|
|
5
5
|
*/
|
|
6
6
|
export interface JwksService {
|
|
7
7
|
/**
|
|
@@ -1,27 +1,40 @@
|
|
|
1
1
|
import type { Transport } from '@23blocks/contracts';
|
|
2
2
|
import type { MfaSetupResponseFull, MfaEnableRequest, MfaDisableRequest, MfaVerifyRequestFull, MfaStatusResponse, MfaVerificationResponse, MfaOperationResponse } from '../types/index.js';
|
|
3
3
|
/**
|
|
4
|
-
* MFA
|
|
4
|
+
* MFA (Multi-Factor Authentication) service - setup, enable, disable, and verify TOTP-based MFA.
|
|
5
5
|
*/
|
|
6
6
|
export interface MfaService {
|
|
7
7
|
/**
|
|
8
|
-
* Setup MFA for a user
|
|
8
|
+
* Setup MFA for a user. Generates a TOTP secret and QR code URI.
|
|
9
|
+
*
|
|
10
|
+
* @param userUniqueId - The user's UUID.
|
|
11
|
+
* @param regenerate - If true, regenerates the secret even if one exists.
|
|
12
|
+
* @returns MfaSetupResponseFull with `secret`, `qrCodeUri`, `backupCodes`, and `testCode`.
|
|
9
13
|
*/
|
|
10
14
|
setup(userUniqueId: string, regenerate?: boolean): Promise<MfaSetupResponseFull>;
|
|
11
15
|
/**
|
|
12
|
-
* Enable MFA after setup
|
|
16
|
+
* Enable MFA after setup. Requires a valid TOTP code to confirm the user has configured their authenticator.
|
|
17
|
+
*
|
|
18
|
+
* @returns MfaOperationResponse with `enabled: true` and a confirmation `message`.
|
|
13
19
|
*/
|
|
14
20
|
enable(userUniqueId: string, request: MfaEnableRequest): Promise<MfaOperationResponse>;
|
|
15
21
|
/**
|
|
16
|
-
* Disable MFA
|
|
22
|
+
* Disable MFA. Requires the user's password for security verification.
|
|
23
|
+
*
|
|
24
|
+
* @returns MfaOperationResponse with `enabled: false` and a confirmation `message`.
|
|
17
25
|
*/
|
|
18
26
|
disable(userUniqueId: string, request: MfaDisableRequest): Promise<MfaOperationResponse>;
|
|
19
27
|
/**
|
|
20
|
-
* Verify
|
|
28
|
+
* Verify a TOTP code or backup code during sign-in.
|
|
29
|
+
*
|
|
30
|
+
* @param request - Provide either `code` (TOTP) or `backupCode`.
|
|
31
|
+
* @returns MfaVerificationResponse with `valid` and `message`.
|
|
21
32
|
*/
|
|
22
33
|
verify(userUniqueId: string, request: MfaVerifyRequestFull): Promise<MfaVerificationResponse>;
|
|
23
34
|
/**
|
|
24
|
-
* Get MFA status for a user
|
|
35
|
+
* Get the MFA status for a user.
|
|
36
|
+
*
|
|
37
|
+
* @returns MfaStatusResponse with `enabled`, `setupRequired`, `backupCodesRemaining`, `lastUsedAt`.
|
|
25
38
|
*/
|
|
26
39
|
status(userUniqueId: string): Promise<MfaStatusResponse>;
|
|
27
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfa.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/mfa.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB
|
|
1
|
+
{"version":3,"file":"mfa.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/mfa.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEjF;;;;OAIG;IACH,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEvF;;;;OAIG;IACH,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEzF;;;;;OAKG;IACH,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAE9F;;;;OAIG;IACH,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC1D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAwGjE"}
|
|
@@ -1,27 +1,38 @@
|
|
|
1
1
|
import type { Transport } from '@23blocks/contracts';
|
|
2
2
|
import type { OAuthSocialLoginRequest, TenantLoginRequest, TokenIntrospectionResponse, TokenRevokeRequest, TokenRevokeAllRequest, TokenRevokeResponse, TenantContextCreateRequest, TenantContextResponse, TenantContextRevokeRequest, TenantContextAuditEntry, SignInResponse } from '../types/index.js';
|
|
3
3
|
/**
|
|
4
|
-
* OAuth
|
|
4
|
+
* OAuth service - social login, token introspection/revocation, and tenant context switching.
|
|
5
5
|
*/
|
|
6
6
|
export interface OAuthService {
|
|
7
7
|
/**
|
|
8
|
-
* Login with Facebook token
|
|
8
|
+
* Login with a Facebook access token. Creates or signs in the user.
|
|
9
|
+
*
|
|
10
|
+
* @returns SignInResponse with `user`, `accessToken`, optional `refreshToken`.
|
|
9
11
|
*/
|
|
10
12
|
facebookLogin(request: OAuthSocialLoginRequest): Promise<SignInResponse>;
|
|
11
13
|
/**
|
|
12
|
-
* Login with Google token
|
|
14
|
+
* Login with a Google access token. Creates or signs in the user.
|
|
15
|
+
*
|
|
16
|
+
* @returns SignInResponse with `user`, `accessToken`, optional `refreshToken`.
|
|
13
17
|
*/
|
|
14
18
|
googleLogin(request: OAuthSocialLoginRequest): Promise<SignInResponse>;
|
|
15
19
|
/**
|
|
16
|
-
* Login to a specific tenant
|
|
20
|
+
* Login to a specific tenant with email and password.
|
|
21
|
+
*
|
|
22
|
+
* @returns SignInResponse scoped to the target tenant.
|
|
17
23
|
*/
|
|
18
24
|
tenantLogin(request: TenantLoginRequest): Promise<SignInResponse>;
|
|
19
25
|
/**
|
|
20
|
-
* Introspect a token
|
|
26
|
+
* Introspect a token to check validity and get metadata.
|
|
27
|
+
*
|
|
28
|
+
* @param token - The token to introspect (defaults to the current session token).
|
|
29
|
+
* @returns TokenIntrospectionResponse with `active`, `userUniqueId`, `scopes`, `expiresAt`.
|
|
21
30
|
*/
|
|
22
31
|
introspectToken(token?: string): Promise<TokenIntrospectionResponse>;
|
|
23
32
|
/**
|
|
24
|
-
* Refresh an access token using a refresh token
|
|
33
|
+
* Refresh an access token using a refresh token (OAuth2 endpoint).
|
|
34
|
+
*
|
|
35
|
+
* @returns New `accessToken`, optional `refreshToken`, `tokenType`, `expiresIn`.
|
|
25
36
|
*/
|
|
26
37
|
refreshToken(refreshToken: string): Promise<{
|
|
27
38
|
accessToken: string;
|
|
@@ -30,25 +41,33 @@ export interface OAuthService {
|
|
|
30
41
|
expiresIn?: number;
|
|
31
42
|
}>;
|
|
32
43
|
/**
|
|
33
|
-
* Revoke a single token
|
|
44
|
+
* Revoke a single token (access or refresh).
|
|
45
|
+
*
|
|
46
|
+
* @returns TokenRevokeResponse with `revoked`, `message`, `revokedAt`.
|
|
34
47
|
*/
|
|
35
48
|
revokeToken(request: TokenRevokeRequest): Promise<TokenRevokeResponse>;
|
|
36
49
|
/**
|
|
37
|
-
* Revoke all tokens for a user
|
|
50
|
+
* Revoke all tokens for a user (or all tokens for a specific device).
|
|
51
|
+
*
|
|
52
|
+
* @returns TokenRevokeResponse with `revoked`, `message`, `revokedAt`.
|
|
38
53
|
*/
|
|
39
54
|
revokeAllTokens(request: TokenRevokeAllRequest): Promise<TokenRevokeResponse>;
|
|
40
55
|
/**
|
|
41
|
-
* Create a tenant context
|
|
56
|
+
* Create a tenant context - switch the current session to a different tenant/company.
|
|
57
|
+
*
|
|
58
|
+
* @returns TenantContextResponse with `tenantContextToken`, `expiresIn`, `tenantInfo`.
|
|
42
59
|
*/
|
|
43
60
|
createTenantContext(request: TenantContextCreateRequest): Promise<TenantContextResponse>;
|
|
44
61
|
/**
|
|
45
|
-
* Revoke
|
|
62
|
+
* Revoke an active tenant context, returning to the original tenant.
|
|
46
63
|
*/
|
|
47
64
|
revokeTenantContext(request: TenantContextRevokeRequest): Promise<{
|
|
48
65
|
message: string;
|
|
49
66
|
}>;
|
|
50
67
|
/**
|
|
51
|
-
* Get tenant context
|
|
68
|
+
* Get the audit log of tenant context switches.
|
|
69
|
+
*
|
|
70
|
+
* @returns Array of TenantContextAuditEntry with `companyName`, `switchReason`, `active`, `revoked`.
|
|
52
71
|
*/
|
|
53
72
|
getTenantContextAudit(): Promise<TenantContextAuditEntry[]>;
|
|
54
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/oauth.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACvB,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAG3B;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B
|
|
1
|
+
{"version":3,"file":"oauth.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/oauth.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACvB,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAG3B;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEzE;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvE;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAElE;;;;;OAKG;IACH,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAErE;;;;OAIG;IACH,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;QAC1C,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IAEH;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEvE;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE9E;;;;OAIG;IACH,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAEzF;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEvF;;;;OAIG;IACH,qBAAqB,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC;CAC7D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,CA+PrE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Transport } from '@23blocks/contracts';
|
|
2
2
|
import type { OidcDiscovery, OidcAuthorizeRequest, OidcTokenRequest, OidcTokenResponse, OidcUserInfo } from '../types/oidc.js';
|
|
3
3
|
/**
|
|
4
|
-
* OIDC
|
|
4
|
+
* OIDC service - OpenID Connect discovery, authorization, token exchange, userinfo, and session management.
|
|
5
5
|
*/
|
|
6
6
|
export interface OidcService {
|
|
7
7
|
/**
|
|
@@ -2,7 +2,7 @@ import type { Transport, PageResult } from '@23blocks/contracts';
|
|
|
2
2
|
import type { Company, TenantUserFull, CreateTenantUserRequest, ValidateTenantCodeRequest, ValidateTenantCodeResponse, SearchTenantRequest, UpdateTenantUserOnboardingRequest, UpdateTenantUserSalesRequest } from '../types/index.js';
|
|
3
3
|
import type { ListParams } from '@23blocks/contracts';
|
|
4
4
|
/**
|
|
5
|
-
* Tenants
|
|
5
|
+
* Tenants service - manage child tenants, validate tenant codes, search tenants, and manage tenant-user relationships.
|
|
6
6
|
*/
|
|
7
7
|
export interface TenantsService {
|
|
8
8
|
/**
|
|
@@ -44,91 +44,158 @@ export interface UpdateProfileRequest {
|
|
|
44
44
|
payload?: Record<string, unknown>;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Users service
|
|
47
|
+
* Users service - CRUD operations on users, profiles, devices, companies, and subscriptions.
|
|
48
48
|
*/
|
|
49
49
|
export interface UsersService {
|
|
50
50
|
/**
|
|
51
|
-
* List users with pagination and filtering
|
|
51
|
+
* List users with pagination and filtering.
|
|
52
|
+
*
|
|
53
|
+
* @returns PageResult containing User objects (without relationships by default).
|
|
54
|
+
* Use `include: ['role', 'user_avatar', 'user_profile']` in params to load relationships.
|
|
52
55
|
*/
|
|
53
56
|
list(params?: ListParams): Promise<PageResult<User>>;
|
|
54
57
|
/**
|
|
55
|
-
* Get a user by unique ID
|
|
58
|
+
* Get a user by unique ID with role, avatar, and profile pre-loaded.
|
|
59
|
+
*
|
|
60
|
+
* @param uniqueId - The user's UUID (not database ID).
|
|
61
|
+
* @returns User with `role`, `avatar`, and `profile` relationships populated.
|
|
56
62
|
*/
|
|
57
63
|
get(uniqueId: string): Promise<User>;
|
|
58
64
|
/**
|
|
59
|
-
* Get a user by unique ID (
|
|
65
|
+
* Get a user by unique ID via the `/by_unique_id/` endpoint. Same result as `get()`.
|
|
66
|
+
*
|
|
67
|
+
* @param uniqueId - The user's UUID.
|
|
68
|
+
* @returns User with `role`, `avatar`, and `profile` relationships populated.
|
|
60
69
|
*/
|
|
61
70
|
getByUniqueId(uniqueId: string): Promise<User>;
|
|
62
71
|
/**
|
|
63
|
-
* Update a user
|
|
72
|
+
* Update a user's core fields (name, username, nickname, bio, role, status).
|
|
73
|
+
*
|
|
74
|
+
* @param uniqueId - The user's UUID.
|
|
75
|
+
* @returns The updated User.
|
|
76
|
+
* @note This updates the User record, not the profile. Use `updateProfile()` for profile fields.
|
|
64
77
|
*/
|
|
65
78
|
update(uniqueId: string, request: UpdateUserRequest): Promise<User>;
|
|
66
79
|
/**
|
|
67
|
-
* Update user profile
|
|
80
|
+
* Update a user's profile (firstName, lastName, phone, social links, payload, etc.).
|
|
81
|
+
*
|
|
82
|
+
* @param userUniqueId - The user's UUID.
|
|
83
|
+
* @returns The User object (not the profile directly). Access updated profile fields
|
|
84
|
+
* via `user.profile?.firstName`, `user.profile?.payload`, etc.
|
|
85
|
+
* @note Returns a User, not a UserProfile. The updated profile is nested in `user.profile`.
|
|
86
|
+
* @note The `payload` field must be a JSON object, not a string.
|
|
87
|
+
* @example
|
|
88
|
+
* const user = await auth.users.updateProfile(uid, {
|
|
89
|
+
* firstName: 'Jane',
|
|
90
|
+
* payload: { department: 'Engineering' },
|
|
91
|
+
* });
|
|
92
|
+
* console.log(user.profile?.firstName); // 'Jane'
|
|
68
93
|
*/
|
|
69
94
|
updateProfile(userUniqueId: string, request: UpdateProfileRequest): Promise<User>;
|
|
70
95
|
/**
|
|
71
|
-
*
|
|
96
|
+
* Soft-delete a user.
|
|
97
|
+
*
|
|
98
|
+
* @param uniqueId - The user's UUID.
|
|
72
99
|
*/
|
|
73
100
|
delete(uniqueId: string): Promise<void>;
|
|
74
101
|
/**
|
|
75
|
-
* Activate a user
|
|
102
|
+
* Activate a deactivated user.
|
|
103
|
+
*
|
|
104
|
+
* @returns The User with `status: 'active'`.
|
|
76
105
|
*/
|
|
77
106
|
activate(uniqueId: string): Promise<User>;
|
|
78
107
|
/**
|
|
79
|
-
* Deactivate a user
|
|
108
|
+
* Deactivate a user (prevents sign-in without deleting).
|
|
109
|
+
*
|
|
110
|
+
* @returns The User with `status: 'inactive'`.
|
|
80
111
|
*/
|
|
81
112
|
deactivate(uniqueId: string): Promise<User>;
|
|
82
113
|
/**
|
|
83
|
-
* Change user role
|
|
84
|
-
*
|
|
85
|
-
* @param
|
|
86
|
-
* @param
|
|
87
|
-
* @param
|
|
114
|
+
* Change a user's role. Optionally force re-authentication.
|
|
115
|
+
*
|
|
116
|
+
* @param uniqueId - User unique ID.
|
|
117
|
+
* @param roleUniqueId - The unique ID of the new role.
|
|
118
|
+
* @param reason - Reason for role change (minimum 10 characters).
|
|
119
|
+
* @param forceReauth - If true, invalidates the user's existing tokens.
|
|
120
|
+
* @returns The updated User with the new role.
|
|
121
|
+
* @example
|
|
122
|
+
* const user = await auth.users.changeRole(
|
|
123
|
+
* userUid, roleUid, 'Promoted to admin', true
|
|
124
|
+
* );
|
|
88
125
|
*/
|
|
89
126
|
changeRole(uniqueId: string, roleUniqueId: string, reason: string, forceReauth?: boolean): Promise<User>;
|
|
90
127
|
/**
|
|
91
|
-
* Search users
|
|
128
|
+
* Search users by a text query (searches name, email, username).
|
|
129
|
+
*
|
|
130
|
+
* @param query - Free-text search string.
|
|
131
|
+
* @returns Paginated User results.
|
|
92
132
|
*/
|
|
93
133
|
search(query: string, params?: ListParams): Promise<PageResult<User>>;
|
|
94
134
|
/**
|
|
95
|
-
* Advanced search
|
|
135
|
+
* Advanced search by structured criteria or payload fields.
|
|
136
|
+
*
|
|
137
|
+
* @param request - Contains `searchBy` (field-value pairs), `payload` (JSON query), `orderBy`.
|
|
138
|
+
* @returns Paginated User results.
|
|
139
|
+
* @example
|
|
140
|
+
* const results = await auth.users.searchAdvanced({
|
|
141
|
+
* searchBy: { status: 'active', role_id: '123' },
|
|
142
|
+
* payload: { department: 'Engineering' },
|
|
143
|
+
* orderBy: 'created_at desc',
|
|
144
|
+
* });
|
|
96
145
|
*/
|
|
97
146
|
searchAdvanced(request: UserSearchRequest, params?: ListParams): Promise<PageResult<User>>;
|
|
98
147
|
/**
|
|
99
|
-
* Get user profile
|
|
148
|
+
* Get a user's profile directly (not nested in User).
|
|
149
|
+
*
|
|
150
|
+
* @returns UserProfileFull with all profile fields including `payload`.
|
|
100
151
|
*/
|
|
101
152
|
getProfile(userUniqueId: string): Promise<UserProfileFull>;
|
|
102
153
|
/**
|
|
103
|
-
* Create or update user profile
|
|
154
|
+
* Create or update the current user's profile.
|
|
155
|
+
*
|
|
156
|
+
* @returns UserProfileFull with the created/updated profile data.
|
|
157
|
+
* @note The `payload` field accepts both objects and strings (strings are JSON.stringify'd).
|
|
104
158
|
*/
|
|
105
159
|
createProfile(request: ProfileRequest): Promise<UserProfileFull>;
|
|
106
160
|
/**
|
|
107
|
-
* Update email address
|
|
161
|
+
* Update a user's email address. Requires password confirmation.
|
|
162
|
+
*
|
|
163
|
+
* @returns The User with the updated email (may trigger re-confirmation).
|
|
108
164
|
*/
|
|
109
165
|
updateEmail(userUniqueId: string, request: UpdateEmailRequest): Promise<User>;
|
|
110
166
|
/**
|
|
111
|
-
* Get user
|
|
167
|
+
* Get devices registered to a user.
|
|
168
|
+
*
|
|
169
|
+
* @returns Paginated list of UserDeviceFull objects.
|
|
112
170
|
*/
|
|
113
171
|
getDevices(userUniqueId: string, params?: ListParams): Promise<PageResult<UserDeviceFull>>;
|
|
114
172
|
/**
|
|
115
|
-
* Add a device
|
|
173
|
+
* Add a device to the current user.
|
|
174
|
+
*
|
|
175
|
+
* @returns The created UserDeviceFull.
|
|
116
176
|
*/
|
|
117
177
|
addDevice(request: AddDeviceRequest): Promise<UserDeviceFull>;
|
|
118
178
|
/**
|
|
119
|
-
* Get user
|
|
179
|
+
* Get all companies a user belongs to (in multi-tenant setups).
|
|
180
|
+
*
|
|
181
|
+
* @returns Array of Company objects.
|
|
120
182
|
*/
|
|
121
183
|
getCompanies(userUniqueId: string): Promise<Company[]>;
|
|
122
184
|
/**
|
|
123
|
-
* Add subscription to user
|
|
185
|
+
* Add a subscription to a user.
|
|
186
|
+
*
|
|
187
|
+
* @param request - Contains `subscriptionUniqueId` and optional `payload` (object, not string).
|
|
188
|
+
* @returns The created UserSubscription.
|
|
124
189
|
*/
|
|
125
190
|
addSubscription(userUniqueId: string, request: AddUserSubscriptionRequest): Promise<UserSubscription>;
|
|
126
191
|
/**
|
|
127
|
-
* Update user subscription
|
|
192
|
+
* Update a user's subscription.
|
|
193
|
+
*
|
|
194
|
+
* @returns The updated UserSubscription.
|
|
128
195
|
*/
|
|
129
196
|
updateSubscription(userUniqueId: string, request: AddUserSubscriptionRequest): Promise<UserSubscription>;
|
|
130
197
|
/**
|
|
131
|
-
* Resend confirmation email
|
|
198
|
+
* Resend the confirmation email for a specific user (by their UUID, not email).
|
|
132
199
|
*/
|
|
133
200
|
resendConfirmationByUniqueId(userUniqueId: string): Promise<void>;
|
|
134
201
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/users.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,KAAK,EACV,IAAI,EAEJ,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,0BAA0B,EAC1B,OAAO,EACP,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAmF5E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAC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10
|
-
* Sign in response
|
|
10
|
+
* Sign in response - returned by signIn, verifyMagicLink, acceptInvitation, and social login methods.
|
|
11
|
+
*
|
|
12
|
+
* @note The `user` object includes relationships only if the server returns included resources.
|
|
13
|
+
* For guaranteed relationship loading, call `auth.getCurrentUser()` after sign-in.
|
|
11
14
|
*/
|
|
12
15
|
export interface SignInResponse {
|
|
16
|
+
/** The authenticated user. Relationships (role, avatar, profile) may or may not be populated. */
|
|
13
17
|
user: User;
|
|
18
|
+
/** JWT access token for authenticating subsequent requests. */
|
|
14
19
|
accessToken: string;
|
|
20
|
+
/** Refresh token for obtaining new access tokens (if refresh tokens are enabled). */
|
|
15
21
|
refreshToken?: string;
|
|
22
|
+
/** Always 'Bearer'. */
|
|
16
23
|
tokenType: string;
|
|
24
|
+
/** Token lifetime in seconds (if provided by the server). */
|
|
17
25
|
expiresIn?: number;
|
|
18
26
|
}
|
|
19
27
|
/**
|
|
@@ -44,11 +52,17 @@ export interface SignUpRequest {
|
|
|
44
52
|
subscription?: string;
|
|
45
53
|
}
|
|
46
54
|
/**
|
|
47
|
-
* Sign up response
|
|
55
|
+
* Sign up response.
|
|
56
|
+
*
|
|
57
|
+
* @note If email confirmation is required, `accessToken` will be undefined.
|
|
58
|
+
* The user must confirm their email before they can sign in.
|
|
48
59
|
*/
|
|
49
60
|
export interface SignUpResponse {
|
|
61
|
+
/** The newly created user. */
|
|
50
62
|
user: User;
|
|
63
|
+
/** Access token (only present if email confirmation is NOT required). */
|
|
51
64
|
accessToken?: string;
|
|
65
|
+
/** Server message (e.g., 'Confirmation email sent'). */
|
|
52
66
|
message?: string;
|
|
53
67
|
}
|
|
54
68
|
/**
|
|
@@ -68,10 +82,15 @@ export interface PasswordUpdateRequest {
|
|
|
68
82
|
currentPassword?: string;
|
|
69
83
|
}
|
|
70
84
|
/**
|
|
71
|
-
* Token validation response
|
|
85
|
+
* Token validation response.
|
|
86
|
+
*
|
|
87
|
+
* @note The `user` object does NOT include relationships (role, avatar, profile).
|
|
88
|
+
* Use `auth.getCurrentUser()` for user data with relationships.
|
|
72
89
|
*/
|
|
73
90
|
export interface TokenValidationResponse {
|
|
91
|
+
/** The authenticated user (without relationships). */
|
|
74
92
|
user: User;
|
|
93
|
+
/** Always `true` if the request succeeds (throws on invalid token). */
|
|
75
94
|
valid: boolean;
|
|
76
95
|
}
|
|
77
96
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,iGAAiG;IACjG,IAAI,EAAE,IAAI,CAAC;IACX,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MA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AAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import type { IdentityCore, EntityStatus } from '@23blocks/contracts';
|
|
2
2
|
/**
|
|
3
|
-
* User entity
|
|
3
|
+
* User entity - the central identity object in 23blocks.
|
|
4
|
+
*
|
|
5
|
+
* Relationships (`role`, `avatar`, `profile`) are only populated when explicitly
|
|
6
|
+
* included via the `include` parameter or when using endpoints that include them
|
|
7
|
+
* by default (e.g., `auth.getCurrentUser()`, `users.get()`).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // Get user with relationships
|
|
11
|
+
* const user = await auth.auth.getCurrentUser();
|
|
12
|
+
* console.log(user.email); // Always present
|
|
13
|
+
* console.log(user.role?.name); // Only if included
|
|
14
|
+
* console.log(user.avatar?.url); // Only if included
|
|
15
|
+
* console.log(user.profile?.firstName); // Only if included
|
|
16
|
+
* console.log(user.profile?.payload); // Custom JSON object
|
|
4
17
|
*/
|
|
5
18
|
export interface User extends IdentityCore {
|
|
6
19
|
email: string;
|
|
@@ -8,8 +21,11 @@ export interface User extends IdentityCore {
|
|
|
8
21
|
name: string | null;
|
|
9
22
|
nickname: string | null;
|
|
10
23
|
bio: string | null;
|
|
24
|
+
/** Authentication provider (e.g., 'email', 'google', 'facebook') */
|
|
11
25
|
provider: string;
|
|
26
|
+
/** Provider-specific user identifier */
|
|
12
27
|
uid: string;
|
|
28
|
+
/** Role ID (use `role?.name` for the role name when relationship is included) */
|
|
13
29
|
roleId: string | null;
|
|
14
30
|
status: EntityStatus;
|
|
15
31
|
mailStatus: string | null;
|
|
@@ -21,8 +37,11 @@ export interface User extends IdentityCore {
|
|
|
21
37
|
invitationSentAt: Date | null;
|
|
22
38
|
invitationAcceptedAt: Date | null;
|
|
23
39
|
invitationCreatedAt: Date | null;
|
|
40
|
+
/** User's role. Only populated when included (e.g., `include: ['role']`). */
|
|
24
41
|
role?: Role | null;
|
|
42
|
+
/** User's avatar. Only populated when included (e.g., `include: ['user_avatar']`). */
|
|
25
43
|
avatar?: UserAvatar | null;
|
|
44
|
+
/** User's profile. Only populated when included (e.g., `include: ['user_profile']`). */
|
|
26
45
|
profile?: UserProfile | null;
|
|
27
46
|
}
|
|
28
47
|
/**
|
|
@@ -69,7 +88,13 @@ export interface UserAvatar extends IdentityCore {
|
|
|
69
88
|
isPublic: boolean;
|
|
70
89
|
}
|
|
71
90
|
/**
|
|
72
|
-
* User profile
|
|
91
|
+
* User profile - extended demographic and contact information.
|
|
92
|
+
*
|
|
93
|
+
* Accessible via `user.profile` when the relationship is included, or directly
|
|
94
|
+
* via `users.getProfile(userUniqueId)`.
|
|
95
|
+
*
|
|
96
|
+
* @note The `payload` field is a JSON object for storing custom data.
|
|
97
|
+
* When writing, pass an object (not a JSON string).
|
|
73
98
|
*/
|
|
74
99
|
export interface UserProfile extends IdentityCore {
|
|
75
100
|
userUniqueId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,IAAK,SAAQ,YAAY;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,iFAAiF;IACjF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;IAC9B,oBAAoB,EAAE,IAAI,GAAG,IAAI,CAAC;IAClC,mBAAmB,EAAE,IAAI,GAAG,IAA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