prostgles-types 4.0.126 → 4.0.128
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 +37 -15
- package/dist/auth.d.ts.map +1 -1
- package/lib/auth.ts +23 -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,7 +41,27 @@ 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 = {
|
|
61
|
+
success: false;
|
|
62
|
+
code: "server-error";
|
|
63
|
+
message?: string;
|
|
64
|
+
} | {
|
|
46
65
|
success: false;
|
|
47
66
|
code: "rate-limit-exceeded";
|
|
48
67
|
message?: string;
|
|
@@ -70,19 +89,6 @@ export type OAuthRegisterFailure = CommonAuthFailure | {
|
|
|
70
89
|
code: "provider-issue";
|
|
71
90
|
message?: string;
|
|
72
91
|
};
|
|
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
92
|
export declare namespace AuthResponse {
|
|
87
93
|
type MagicLinkAuthSuccess = {
|
|
88
94
|
success: true;
|
|
@@ -105,6 +111,14 @@ export declare namespace AuthResponse {
|
|
|
105
111
|
success: false;
|
|
106
112
|
code: "totp-token-missing";
|
|
107
113
|
message?: string;
|
|
114
|
+
} | {
|
|
115
|
+
success: false;
|
|
116
|
+
code: "username-missing";
|
|
117
|
+
message?: string;
|
|
118
|
+
} | {
|
|
119
|
+
success: false;
|
|
120
|
+
code: "password-missing";
|
|
121
|
+
message?: string;
|
|
108
122
|
} | {
|
|
109
123
|
success: false;
|
|
110
124
|
code: "invalid-totp-recovery-code";
|
|
@@ -131,6 +145,14 @@ export declare namespace AuthResponse {
|
|
|
131
145
|
success: false;
|
|
132
146
|
code: "weak-password";
|
|
133
147
|
message?: string;
|
|
148
|
+
} | {
|
|
149
|
+
success: false;
|
|
150
|
+
code: "username-missing";
|
|
151
|
+
message?: string;
|
|
152
|
+
} | {
|
|
153
|
+
success: false;
|
|
154
|
+
code: "password-missing";
|
|
155
|
+
message?: string;
|
|
134
156
|
} | {
|
|
135
157
|
success: false;
|
|
136
158
|
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;I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C,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEtE,KAAY,uBAAuB,GAC/B;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,IAAI,EAAE,8BAA8B,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GACzE;QAAE,OAAO,EAAE,IAAI,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,8 +50,26 @@ 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 =
|
|
72
|
+
| { success: false; code: "server-error"; message?: string }
|
|
56
73
|
| { success: false; code: "rate-limit-exceeded"; message?: string }
|
|
57
74
|
| { success: false; code: "something-went-wrong"; message?: string };
|
|
58
75
|
|
|
@@ -71,20 +88,6 @@ export type OAuthRegisterFailure =
|
|
|
71
88
|
| CommonAuthFailure
|
|
72
89
|
| { success: false; code: "provider-issue"; message?: string };
|
|
73
90
|
|
|
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
91
|
export declare namespace AuthResponse {
|
|
89
92
|
export type MagicLinkAuthSuccess = { success: true; code: "magic-link-sent"; message?: string };
|
|
90
93
|
export type MagicLinkAuthFailure =
|
|
@@ -100,6 +103,8 @@ export declare namespace AuthResponse {
|
|
|
100
103
|
export type PasswordLoginFailure =
|
|
101
104
|
| AuthFailure
|
|
102
105
|
| { success: false; code: "totp-token-missing"; message?: string }
|
|
106
|
+
| { success: false; code: "username-missing"; message?: string }
|
|
107
|
+
| { success: false; code: "password-missing"; message?: string }
|
|
103
108
|
| { success: false; code: "invalid-totp-recovery-code"; message?: string }
|
|
104
109
|
| { success: false; code: "invalid-totp-code"; message?: string }
|
|
105
110
|
| { success: false; code: "email-not-confirmed"; message?: string };
|
|
@@ -110,5 +115,7 @@ export declare namespace AuthResponse {
|
|
|
110
115
|
export type PasswordRegisterFailure =
|
|
111
116
|
| CommonAuthFailure
|
|
112
117
|
| { success: false; code: "weak-password"; message?: string }
|
|
118
|
+
| { success: false; code: "username-missing"; message?: string }
|
|
119
|
+
| { success: false; code: "password-missing"; message?: string }
|
|
113
120
|
| { success: false; code: "inactive-account"; message?: string };
|
|
114
121
|
}
|