@axium/client 0.1.5 → 0.2.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/user.d.ts +20 -20
- package/dist/user.js +2 -2
- package/package.json +7 -4
package/dist/user.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
+
import type { NewSessionResponse, Passkey, PasskeyChangeable, Session, User, UserPublic, Verification } from '@axium/core';
|
|
1
2
|
import * as z from 'zod';
|
|
2
|
-
|
|
3
|
-
export declare function login(userId: string): Promise<import("@axium/core").NewSessionResponse>;
|
|
3
|
+
export declare function login(userId: string): Promise<NewSessionResponse>;
|
|
4
4
|
/**
|
|
5
5
|
* Create an elevated session for the user to perform sensitive actions.
|
|
6
6
|
*/
|
|
7
7
|
export declare function elevate(userId: string): Promise<void>;
|
|
8
|
-
export declare function loginByEmail(email: string): Promise<
|
|
9
|
-
export declare function getCurrentSession(): Promise<
|
|
10
|
-
user:
|
|
8
|
+
export declare function loginByEmail(email: string): Promise<NewSessionResponse>;
|
|
9
|
+
export declare function getCurrentSession(): Promise<Session & {
|
|
10
|
+
user: User;
|
|
11
11
|
}>;
|
|
12
|
-
export declare function getSessions(userId: string): Promise<
|
|
13
|
-
export declare function logout(userId: string, ...sessionId: string[]): Promise<
|
|
14
|
-
export declare function logoutAll(userId: string): Promise<
|
|
15
|
-
export declare function logoutCurrentSession(): Promise<
|
|
12
|
+
export declare function getSessions(userId: string): Promise<Session[]>;
|
|
13
|
+
export declare function logout(userId: string, ...sessionId: string[]): Promise<Session[]>;
|
|
14
|
+
export declare function logoutAll(userId: string): Promise<Session[]>;
|
|
15
|
+
export declare function logoutCurrentSession(): Promise<Session>;
|
|
16
16
|
export declare function register(_data: Record<string, FormDataEntryValue>): Promise<void>;
|
|
17
|
-
export declare function userInfo(userId: string): Promise<
|
|
18
|
-
export declare function updateUser(userId: string, data: Record<string, FormDataEntryValue>): Promise<
|
|
19
|
-
export declare function fullUserInfo(userId: string): Promise<
|
|
20
|
-
sessions:
|
|
17
|
+
export declare function userInfo(userId: string): Promise<UserPublic & Partial<User>>;
|
|
18
|
+
export declare function updateUser(userId: string, data: Record<string, FormDataEntryValue>): Promise<User>;
|
|
19
|
+
export declare function fullUserInfo(userId: string): Promise<User & {
|
|
20
|
+
sessions: Session[];
|
|
21
21
|
}>;
|
|
22
|
-
export declare function deleteUser(userId: string): Promise<
|
|
22
|
+
export declare function deleteUser(userId: string): Promise<User>;
|
|
23
23
|
export declare function emailVerificationEnabled(userId: string): Promise<boolean>;
|
|
24
|
-
export declare function sendVerificationEmail(userId: string): Promise<
|
|
25
|
-
export declare function verifyEmail(userId: string, token: string): Promise<
|
|
26
|
-
export declare function getPasskeys(userId: string): Promise<
|
|
24
|
+
export declare function sendVerificationEmail(userId: string): Promise<Verification>;
|
|
25
|
+
export declare function verifyEmail(userId: string, token: string): Promise<void>;
|
|
26
|
+
export declare function getPasskeys(userId: string): Promise<Passkey[]>;
|
|
27
27
|
/**
|
|
28
28
|
* Create a new passkey for an existing user.
|
|
29
29
|
*/
|
|
30
|
-
export declare function createPasskey(userId: string): Promise<
|
|
31
|
-
export declare function updatePasskey(passkeyId: string, data: z.input<typeof PasskeyChangeable>): Promise<
|
|
32
|
-
export declare function deletePasskey(passkeyId: string): Promise<
|
|
30
|
+
export declare function createPasskey(userId: string): Promise<Passkey>;
|
|
31
|
+
export declare function updatePasskey(passkeyId: string, data: z.input<typeof PasskeyChangeable>): Promise<Passkey>;
|
|
32
|
+
export declare function deletePasskey(passkeyId: string): Promise<Passkey>;
|
package/dist/user.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { UserChangeable } from '@axium/core';
|
|
1
2
|
import { startAuthentication, startRegistration } from '@simplewebauthn/browser';
|
|
2
3
|
import * as z from 'zod';
|
|
3
4
|
import { fetchAPI } from './requests.js';
|
|
4
|
-
import { UserChangeable } from '@axium/core';
|
|
5
5
|
export async function login(userId) {
|
|
6
6
|
const options = await fetchAPI('OPTIONS', 'users/:id/auth', { type: 'login' }, userId);
|
|
7
7
|
const response = await startAuthentication({ optionsJSON: options });
|
|
@@ -124,7 +124,7 @@ export async function sendVerificationEmail(userId) {
|
|
|
124
124
|
}
|
|
125
125
|
export async function verifyEmail(userId, token) {
|
|
126
126
|
_checkId(userId);
|
|
127
|
-
|
|
127
|
+
await fetchAPI('POST', 'users/:id/verify_email', { token }, userId);
|
|
128
128
|
}
|
|
129
129
|
export async function getPasskeys(userId) {
|
|
130
130
|
_checkId(userId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"author": "James Prevett <jp@jamespre.dev>",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -23,15 +23,18 @@
|
|
|
23
23
|
],
|
|
24
24
|
"exports": {
|
|
25
25
|
".": "./dist/index.js",
|
|
26
|
-
"./*": "./dist/*.js"
|
|
26
|
+
"./*": "./dist/*.js",
|
|
27
|
+
"./components": "./lib/index.js",
|
|
28
|
+
"./components/*": "./lib/*.svelte"
|
|
27
29
|
},
|
|
28
30
|
"scripts": {
|
|
29
31
|
"build": "tsc"
|
|
30
32
|
},
|
|
31
33
|
"peerDependencies": {
|
|
32
|
-
"@axium/core": ">=0.
|
|
34
|
+
"@axium/core": ">=0.5.0",
|
|
33
35
|
"utilium": "^2.3.8",
|
|
34
|
-
"zod": "^4.0.5"
|
|
36
|
+
"zod": "^4.0.5",
|
|
37
|
+
"svelte": "^5.36.0"
|
|
35
38
|
},
|
|
36
39
|
"dependencies": {
|
|
37
40
|
"@simplewebauthn/browser": "^13.1.0",
|