@protobase/client 0.53.6 → 0.53.8
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/auth-types.d.ts +3 -1
- package/dist/auth.d.ts +6 -0
- package/dist/auth.js +11 -0
- package/dist/static-session.js +1 -0
- package/package.json +3 -3
package/dist/auth-types.d.ts
CHANGED
|
@@ -32,7 +32,8 @@ export type SamlSignIn = {
|
|
|
32
32
|
/**
|
|
33
33
|
* `needsAdmin` while no user exists yet; `signInMethods` the ways to sign in the server's policy leaves on;
|
|
34
34
|
* `signInFirst` when the sign-in page leads with an emailed code, with the password behind "Use a password"; `passwordReset` when the server can email reset links; `changeEmail` when it can email the code that confirms a new
|
|
35
|
-
* address (see `account.requestEmailChange`); `
|
|
35
|
+
* address (see `account.requestEmailChange`); `accountDeletion` when people may delete their own account (see
|
|
36
|
+
* `deleteAccount`); `signUp` when anyone can make their own account (see
|
|
36
37
|
* `sendSignUpCode`); `socialProviders` the ids of the sign-in providers, for example
|
|
37
38
|
* `github`; `platformSignIn` the one of them the platform adds; `samlProviders` the app's SAML identity providers; `staffSignIn` the operator provider's name when its staff
|
|
38
39
|
* can sign in as people; `organizations` when the app has them; `anonymous` when visitors may browse what the project's
|
|
@@ -46,6 +47,7 @@ export type SetupStatus = {
|
|
|
46
47
|
signInFirst?: 'emailCode';
|
|
47
48
|
passwordReset: boolean;
|
|
48
49
|
changeEmail?: boolean;
|
|
50
|
+
accountDeletion?: boolean;
|
|
49
51
|
signUp?: boolean;
|
|
50
52
|
socialProviders: string[];
|
|
51
53
|
platformSignIn?: PlatformSignIn;
|
package/dist/auth.d.ts
CHANGED
|
@@ -43,6 +43,12 @@ export declare const createAuthSession: (options?: AuthSessionOptions) => {
|
|
|
43
43
|
*/
|
|
44
44
|
signInSaml: (providerId: string, callbackURL: string) => Promise<string>;
|
|
45
45
|
signOut: () => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Deletes the signed-in person's account with its sessions and sign-in methods, when the server allows it
|
|
48
|
+
* (`status().accountDeletion`), and signs this device out. Without `password` the session must have signed in within
|
|
49
|
+
* the last day (`SESSION_EXPIRED`); the last admin (`LAST_ADMIN`) and a locked account (`ACCOUNT_LOCKED`) are refused.
|
|
50
|
+
*/
|
|
51
|
+
deleteAccount: (password?: string) => Promise<void>;
|
|
46
52
|
/**
|
|
47
53
|
* Emails a reset link when an account has this address; the answer is the same either way. The link leads back to
|
|
48
54
|
* `redirectTo`, with `token` (or `error=INVALID_TOKEN`) added to its query.
|
package/dist/auth.js
CHANGED
|
@@ -79,6 +79,7 @@ const createAuthSession = (options = {}) => {
|
|
|
79
79
|
...body.signInFirst === "emailCode" && { signInFirst: "emailCode" },
|
|
80
80
|
passwordReset: Boolean(body.passwordReset),
|
|
81
81
|
...body.changeEmail && { changeEmail: true },
|
|
82
|
+
...body.accountDeletion && { accountDeletion: true },
|
|
82
83
|
...body.signUp && { signUp: true },
|
|
83
84
|
socialProviders: body.socialProviders ?? [],
|
|
84
85
|
...body.platformSignIn && { platformSignIn: body.platformSignIn },
|
|
@@ -135,6 +136,16 @@ const createAuthSession = (options = {}) => {
|
|
|
135
136
|
await client.signOut();
|
|
136
137
|
},
|
|
137
138
|
/**
|
|
139
|
+
* Deletes the signed-in person's account with its sessions and sign-in methods, when the server allows it
|
|
140
|
+
* (`status().accountDeletion`), and signs this device out. Without `password` the session must have signed in within
|
|
141
|
+
* the last day (`SESSION_EXPIRED`); the last admin (`LAST_ADMIN`) and a locked account (`ACCOUNT_LOCKED`) are refused.
|
|
142
|
+
*/
|
|
143
|
+
deleteAccount: async (password) => {
|
|
144
|
+
const { error } = await client.deleteUser(password ? { password } : {});
|
|
145
|
+
if (error) throw authError(error, "Could not delete your account");
|
|
146
|
+
forget();
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
138
149
|
* Emails a reset link when an account has this address; the answer is the same either way. The link leads back to
|
|
139
150
|
* `redirectTo`, with `token` (or `error=INVALID_TOKEN`) added to its query.
|
|
140
151
|
*/
|
package/dist/static-session.js
CHANGED
|
@@ -42,6 +42,7 @@ const createStaticSession = (token, user = {
|
|
|
42
42
|
signInSocial: unsupported("sign in with a provider"),
|
|
43
43
|
signInSaml: unsupported("sign in with a provider"),
|
|
44
44
|
signOut: async () => void 0,
|
|
45
|
+
deleteAccount: unsupported("delete its account"),
|
|
45
46
|
requestPasswordReset: async () => void 0,
|
|
46
47
|
resetPassword: async () => void 0,
|
|
47
48
|
account: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/client",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.8",
|
|
4
4
|
"description": "Typed fetch client for the Protobase REST API.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@better-auth/passkey": "^1.7.12",
|
|
33
|
-
"@protobase/layout": "0.53.
|
|
34
|
-
"@protobase/schema": "0.53.
|
|
33
|
+
"@protobase/layout": "0.53.8",
|
|
34
|
+
"@protobase/schema": "0.53.8",
|
|
35
35
|
"@simplewebauthn/browser": "^13.3.0",
|
|
36
36
|
"better-auth": "^1.7.12"
|
|
37
37
|
}
|