@meistrari/auth-core 1.22.0 → 1.24.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/index.d.mts +3290 -255
- package/dist/index.d.ts +3290 -255
- package/dist/index.mjs +73 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { defaultStatements } from 'better-auth/plugins/organization/access';
|
|
|
8
8
|
import z, { z as z$1 } from 'zod';
|
|
9
9
|
export { APIError } from 'better-auth';
|
|
10
10
|
|
|
11
|
-
const version = "1.
|
|
11
|
+
const version = "1.24.0";
|
|
12
12
|
|
|
13
13
|
function parsedEnumValues(schema) {
|
|
14
14
|
return Object.fromEntries(
|
|
@@ -102,6 +102,30 @@ const userAdditionalFields = {
|
|
|
102
102
|
type: "date",
|
|
103
103
|
required: false,
|
|
104
104
|
defaultValue: null
|
|
105
|
+
},
|
|
106
|
+
displayName: {
|
|
107
|
+
type: "string",
|
|
108
|
+
input: true,
|
|
109
|
+
required: false,
|
|
110
|
+
defaultValue: null
|
|
111
|
+
},
|
|
112
|
+
title: {
|
|
113
|
+
type: "string",
|
|
114
|
+
input: true,
|
|
115
|
+
required: false,
|
|
116
|
+
defaultValue: null
|
|
117
|
+
},
|
|
118
|
+
pronouns: {
|
|
119
|
+
type: "string",
|
|
120
|
+
input: true,
|
|
121
|
+
required: false,
|
|
122
|
+
defaultValue: null
|
|
123
|
+
},
|
|
124
|
+
preferredLanguage: {
|
|
125
|
+
type: "string",
|
|
126
|
+
input: true,
|
|
127
|
+
required: true,
|
|
128
|
+
defaultValue: "en"
|
|
105
129
|
}
|
|
106
130
|
};
|
|
107
131
|
const organizationAdditionalFields = {
|
|
@@ -1628,6 +1652,49 @@ class SessionAssuranceService {
|
|
|
1628
1652
|
}
|
|
1629
1653
|
}
|
|
1630
1654
|
|
|
1655
|
+
class UserService {
|
|
1656
|
+
constructor(client) {
|
|
1657
|
+
this.client = client;
|
|
1658
|
+
}
|
|
1659
|
+
async changePassword(currentPassword, newPassword) {
|
|
1660
|
+
return await this.client.changePassword({ currentPassword, newPassword, revokeOtherSessions: true });
|
|
1661
|
+
}
|
|
1662
|
+
async updateProfile(profile) {
|
|
1663
|
+
return await this.client.updateUser(profile);
|
|
1664
|
+
}
|
|
1665
|
+
/**
|
|
1666
|
+
* Lists the authentication accounts (providers) linked to the current user.
|
|
1667
|
+
* Returns provider identifiers and timestamps only — never tokens.
|
|
1668
|
+
*
|
|
1669
|
+
* The underlying client is configured with `throw: true`, so it resolves to
|
|
1670
|
+
* the response data directly (the account array), not a `{ data }` envelope.
|
|
1671
|
+
*/
|
|
1672
|
+
async listAccounts() {
|
|
1673
|
+
return await this.client.listAccounts();
|
|
1674
|
+
}
|
|
1675
|
+
/**
|
|
1676
|
+
* Begins linking a social provider to the current user. Resolves to
|
|
1677
|
+
* `{ url, redirect }`; the caller navigates to `url`. Requires an AAL2
|
|
1678
|
+
* session (gated server-side).
|
|
1679
|
+
*/
|
|
1680
|
+
async linkSocial(params) {
|
|
1681
|
+
return await this.client.linkSocial({
|
|
1682
|
+
provider: params.provider,
|
|
1683
|
+
callbackURL: params.callbackURL
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Unlinks a provider from the current user. Requires an AAL2 session (gated
|
|
1688
|
+
* server-side). The server refuses to remove the user's last account.
|
|
1689
|
+
*/
|
|
1690
|
+
async unlinkAccount(params) {
|
|
1691
|
+
return await this.client.unlinkAccount({
|
|
1692
|
+
providerId: params.providerId,
|
|
1693
|
+
accountId: params.accountId
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1631
1698
|
const ApiKeyMetadata = z.object({
|
|
1632
1699
|
user: z.object({
|
|
1633
1700
|
id: z.string(),
|
|
@@ -1674,6 +1741,10 @@ class AuthClient {
|
|
|
1674
1741
|
* Session assurance service for step-up operations
|
|
1675
1742
|
*/
|
|
1676
1743
|
sessionAssurance;
|
|
1744
|
+
/**
|
|
1745
|
+
* Magane the logged-in user's account and profile
|
|
1746
|
+
*/
|
|
1747
|
+
user;
|
|
1677
1748
|
/**
|
|
1678
1749
|
* Admin service for global admin operations
|
|
1679
1750
|
*/
|
|
@@ -1692,6 +1763,7 @@ class AuthClient {
|
|
|
1692
1763
|
this.apiKey = new ApiKeyService(this.client);
|
|
1693
1764
|
this.emailOtp = new EmailOTPService(this.client);
|
|
1694
1765
|
this.sessionAssurance = new SessionAssuranceService(this.client);
|
|
1766
|
+
this.user = new UserService(this.client);
|
|
1695
1767
|
this.admin = new AdminService(this.client);
|
|
1696
1768
|
}
|
|
1697
1769
|
}
|