prostgles-types 4.0.126 → 4.0.127
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.d.ts +33 -15
- package/dist/auth.d.ts.map +1 -1
- package/lib/auth.ts +22 -16
- package/package.json +1 -1
package/dist/auth.d.ts
CHANGED
|
@@ -19,8 +19,7 @@ export type AuthSocketSchema = {
|
|
|
19
19
|
*/
|
|
20
20
|
user: UserLike | undefined;
|
|
21
21
|
/**
|
|
22
|
-
* Identity providers enabled on the server
|
|
23
|
-
* if undefined, the server does not support social login
|
|
22
|
+
* Identity providers enabled and configured on the server.
|
|
24
23
|
*/
|
|
25
24
|
providers: Partial<Record<IdentityProvider, {
|
|
26
25
|
url: string;
|
|
@@ -42,6 +41,22 @@ export type AuthSocketSchema = {
|
|
|
42
41
|
*/
|
|
43
42
|
pathGuard?: boolean;
|
|
44
43
|
};
|
|
44
|
+
export declare namespace AuthRequest {
|
|
45
|
+
type LoginData = {
|
|
46
|
+
/**
|
|
47
|
+
* Email or username
|
|
48
|
+
*/
|
|
49
|
+
username: string;
|
|
50
|
+
/**
|
|
51
|
+
* Undefined if loginType is withMagicLink
|
|
52
|
+
*/
|
|
53
|
+
password?: string;
|
|
54
|
+
remember_me?: boolean;
|
|
55
|
+
totp_token?: string;
|
|
56
|
+
totp_recovery_code?: string;
|
|
57
|
+
};
|
|
58
|
+
type RegisterData = Pick<LoginData, "username" | "password">;
|
|
59
|
+
}
|
|
45
60
|
export type CommonAuthFailure = {
|
|
46
61
|
success: false;
|
|
47
62
|
code: "rate-limit-exceeded";
|
|
@@ -70,19 +85,6 @@ export type OAuthRegisterFailure = CommonAuthFailure | {
|
|
|
70
85
|
code: "provider-issue";
|
|
71
86
|
message?: string;
|
|
72
87
|
};
|
|
73
|
-
export type LoginData = {
|
|
74
|
-
/**
|
|
75
|
-
* Email or username
|
|
76
|
-
*/
|
|
77
|
-
username: string;
|
|
78
|
-
/**
|
|
79
|
-
* Undefined if loginType is withMagicLink
|
|
80
|
-
*/
|
|
81
|
-
password?: string;
|
|
82
|
-
remember_me?: boolean;
|
|
83
|
-
totp_token?: string;
|
|
84
|
-
totp_recovery_code?: string;
|
|
85
|
-
};
|
|
86
88
|
export declare namespace AuthResponse {
|
|
87
89
|
type MagicLinkAuthSuccess = {
|
|
88
90
|
success: true;
|
|
@@ -105,6 +107,14 @@ export declare namespace AuthResponse {
|
|
|
105
107
|
success: false;
|
|
106
108
|
code: "totp-token-missing";
|
|
107
109
|
message?: string;
|
|
110
|
+
} | {
|
|
111
|
+
success: false;
|
|
112
|
+
code: "username-missing";
|
|
113
|
+
message?: string;
|
|
114
|
+
} | {
|
|
115
|
+
success: false;
|
|
116
|
+
code: "password-missing";
|
|
117
|
+
message?: string;
|
|
108
118
|
} | {
|
|
109
119
|
success: false;
|
|
110
120
|
code: "invalid-totp-recovery-code";
|
|
@@ -131,6 +141,14 @@ export declare namespace AuthResponse {
|
|
|
131
141
|
success: false;
|
|
132
142
|
code: "weak-password";
|
|
133
143
|
message?: string;
|
|
144
|
+
} | {
|
|
145
|
+
success: false;
|
|
146
|
+
code: "username-missing";
|
|
147
|
+
message?: string;
|
|
148
|
+
} | {
|
|
149
|
+
success: false;
|
|
150
|
+
code: "password-missing";
|
|
151
|
+
message?: string;
|
|
134
152
|
} | {
|
|
135
153
|
success: false;
|
|
136
154
|
code: "inactive-account";
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../lib/auth.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,OAAO,GACP,UAAU,GACV,SAAS,GACT,UAAU,CAAC;AAEf,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,GA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AI,CAAC;QAAC,IAAI,EAAE,8CAA8C,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9F,KAAY,uBAAuB,GAC/B,iBAAiB,GACjB;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,eAAe,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3D;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,kBAAkB,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9D;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,kBAAkB,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9D;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,kBAAkB,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpE"}
|
package/lib/auth.ts
CHANGED
|
@@ -30,8 +30,7 @@ export type AuthSocketSchema = {
|
|
|
30
30
|
user: UserLike | undefined;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Identity providers enabled on the server
|
|
34
|
-
* if undefined, the server does not support social login
|
|
33
|
+
* Identity providers enabled and configured on the server.
|
|
35
34
|
*/
|
|
36
35
|
providers: Partial<Record<IdentityProvider, { url: string }>> | undefined;
|
|
37
36
|
|
|
@@ -51,6 +50,23 @@ export type AuthSocketSchema = {
|
|
|
51
50
|
*/
|
|
52
51
|
pathGuard?: boolean;
|
|
53
52
|
};
|
|
53
|
+
export declare namespace AuthRequest {
|
|
54
|
+
export type LoginData = {
|
|
55
|
+
/**
|
|
56
|
+
* Email or username
|
|
57
|
+
*/
|
|
58
|
+
username: string;
|
|
59
|
+
/**
|
|
60
|
+
* Undefined if loginType is withMagicLink
|
|
61
|
+
*/
|
|
62
|
+
password?: string;
|
|
63
|
+
remember_me?: boolean;
|
|
64
|
+
totp_token?: string;
|
|
65
|
+
totp_recovery_code?: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type RegisterData = Pick<LoginData, "username" | "password">;
|
|
69
|
+
}
|
|
54
70
|
|
|
55
71
|
export type CommonAuthFailure =
|
|
56
72
|
| { success: false; code: "rate-limit-exceeded"; message?: string }
|
|
@@ -71,20 +87,6 @@ export type OAuthRegisterFailure =
|
|
|
71
87
|
| CommonAuthFailure
|
|
72
88
|
| { success: false; code: "provider-issue"; message?: string };
|
|
73
89
|
|
|
74
|
-
export type LoginData = {
|
|
75
|
-
/**
|
|
76
|
-
* Email or username
|
|
77
|
-
*/
|
|
78
|
-
username: string;
|
|
79
|
-
/**
|
|
80
|
-
* Undefined if loginType is withMagicLink
|
|
81
|
-
*/
|
|
82
|
-
password?: string;
|
|
83
|
-
remember_me?: boolean;
|
|
84
|
-
totp_token?: string;
|
|
85
|
-
totp_recovery_code?: string;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
90
|
export declare namespace AuthResponse {
|
|
89
91
|
export type MagicLinkAuthSuccess = { success: true; code: "magic-link-sent"; message?: string };
|
|
90
92
|
export type MagicLinkAuthFailure =
|
|
@@ -100,6 +102,8 @@ export declare namespace AuthResponse {
|
|
|
100
102
|
export type PasswordLoginFailure =
|
|
101
103
|
| AuthFailure
|
|
102
104
|
| { success: false; code: "totp-token-missing"; message?: string }
|
|
105
|
+
| { success: false; code: "username-missing"; message?: string }
|
|
106
|
+
| { success: false; code: "password-missing"; message?: string }
|
|
103
107
|
| { success: false; code: "invalid-totp-recovery-code"; message?: string }
|
|
104
108
|
| { success: false; code: "invalid-totp-code"; message?: string }
|
|
105
109
|
| { success: false; code: "email-not-confirmed"; message?: string };
|
|
@@ -110,5 +114,7 @@ export declare namespace AuthResponse {
|
|
|
110
114
|
export type PasswordRegisterFailure =
|
|
111
115
|
| CommonAuthFailure
|
|
112
116
|
| { success: false; code: "weak-password"; message?: string }
|
|
117
|
+
| { success: false; code: "username-missing"; message?: string }
|
|
118
|
+
| { success: false; code: "password-missing"; message?: string }
|
|
113
119
|
| { success: false; code: "inactive-account"; message?: string };
|
|
114
120
|
}
|