@slyxup/core 0.2.4 → 1.0.1
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/.turbo/turbo-build.log +4 -0
- package/LICENSE +21 -0
- package/README.md +35 -8
- package/dist/client.d.ts +119 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +187 -10
- package/dist/client.js.map +1 -1
- package/dist/types.d.ts +50 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/client.ts +397 -19
- package/src/types.ts +58 -2
package/src/types.ts
CHANGED
|
@@ -5,9 +5,11 @@ export interface SlyxupUser {
|
|
|
5
5
|
projectId: string | null;
|
|
6
6
|
email: string;
|
|
7
7
|
emailVerified: boolean;
|
|
8
|
+
username: string | null;
|
|
8
9
|
firstName: string | null;
|
|
9
10
|
lastName: string | null;
|
|
10
11
|
avatarUrl: string | null;
|
|
12
|
+
twoFactorEnabled: boolean;
|
|
11
13
|
preferences: Record<string, unknown> | null;
|
|
12
14
|
createdAt: string;
|
|
13
15
|
updatedAt: string;
|
|
@@ -20,20 +22,23 @@ export interface SlyxupSession {
|
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export interface SignInInput {
|
|
23
|
-
email
|
|
25
|
+
email?: string;
|
|
26
|
+
username?: string;
|
|
24
27
|
password: string;
|
|
25
28
|
projectId?: string;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
export interface SignUpInput extends SignInInput {
|
|
31
|
+
export interface SignUpInput extends Omit<SignInInput, 'username'> {
|
|
29
32
|
firstName?: string;
|
|
30
33
|
lastName?: string;
|
|
34
|
+
username?: string;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
export interface UpdateUserInput {
|
|
34
38
|
firstName?: string;
|
|
35
39
|
lastName?: string;
|
|
36
40
|
avatarUrl?: string;
|
|
41
|
+
username?: string | null;
|
|
37
42
|
preferences?: Record<string, unknown>;
|
|
38
43
|
}
|
|
39
44
|
|
|
@@ -61,6 +66,9 @@ export interface SlyxupSessionInfo {
|
|
|
61
66
|
export interface SessionsResponse {
|
|
62
67
|
ok: true;
|
|
63
68
|
sessions: SlyxupSessionInfo[];
|
|
69
|
+
total: number;
|
|
70
|
+
limit: number;
|
|
71
|
+
offset: number;
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
export interface RevokeSessionsResponse {
|
|
@@ -80,6 +88,52 @@ export interface AuthResponse {
|
|
|
80
88
|
expiresAt?: string;
|
|
81
89
|
}
|
|
82
90
|
|
|
91
|
+
/** Returned by signIn when the account has 2FA enabled. */
|
|
92
|
+
export interface TwoFactorRequiredResponse {
|
|
93
|
+
ok: false;
|
|
94
|
+
code: '2FA_REQUIRED';
|
|
95
|
+
challengeToken: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Union returned by client.auth.signIn. */
|
|
99
|
+
export type SignInResponse = AuthResponse | TwoFactorRequiredResponse;
|
|
100
|
+
|
|
101
|
+
export interface TOTPSetupResponse {
|
|
102
|
+
ok: true;
|
|
103
|
+
secret: string;
|
|
104
|
+
provisioningUri: string;
|
|
105
|
+
accountName: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface EnableTOTPResponse {
|
|
109
|
+
ok: true;
|
|
110
|
+
recoveryCodes: string[];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface TwoFactorStatusResponse {
|
|
114
|
+
ok: boolean;
|
|
115
|
+
enabled: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface ConnectedAccount {
|
|
119
|
+
id: string;
|
|
120
|
+
provider: 'google' | 'github';
|
|
121
|
+
providerAccountId: string;
|
|
122
|
+
createdAt: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface ConnectedAccountsResponse {
|
|
126
|
+
ok: true;
|
|
127
|
+
accounts: ConnectedAccount[];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Input for completing a 2FA sign-in challenge. */
|
|
131
|
+
export interface CompleteSignInInput {
|
|
132
|
+
challengeToken: string;
|
|
133
|
+
code?: string;
|
|
134
|
+
recoveryCode?: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
83
137
|
export interface ErrorResponse {
|
|
84
138
|
ok: false;
|
|
85
139
|
error: string;
|
|
@@ -90,6 +144,8 @@ export type Result<T> = T | ErrorResponse;
|
|
|
90
144
|
export interface SlyxupClientOptions {
|
|
91
145
|
/** Publishable key — pk_test_xxx / pk_live_xxx */
|
|
92
146
|
publishableKey?: string;
|
|
147
|
+
/** Secret key — sk_test_xxx / sk_live_xxx (server-side admin API) */
|
|
148
|
+
secretKey?: string;
|
|
93
149
|
/** API base URL, default https://auth.slyxup.online */
|
|
94
150
|
apiUrl?: string;
|
|
95
151
|
}
|