prostgles-types 4.0.123 → 4.0.125

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 CHANGED
@@ -4,8 +4,11 @@ export type UserLike = {
4
4
  type: string;
5
5
  [key: string]: any;
6
6
  };
7
- export type EmailAuthType = "withPassword" | "withMagicLink";
8
- export type EmailSignupType = "withPassword" | "withMagicLink";
7
+ /**
8
+ * - withPassword: email and password required
9
+ * - withMagicLink: email required
10
+ */
11
+ export type AuthType = "withPassword" | "withMagicLink";
9
12
  /**
10
13
  * Auth object sent from server to client
11
14
  */
@@ -25,12 +28,12 @@ export type AuthSocketSchema = {
25
28
  /**
26
29
  * Email login methods enabled on the server
27
30
  */
28
- loginType: EmailAuthType | undefined;
31
+ loginType: AuthType | undefined;
29
32
  /**
30
33
  * Email registration methods enabled on the server
31
34
  */
32
35
  register: {
33
- type: EmailSignupType;
36
+ type: AuthType;
34
37
  url: string;
35
38
  } | undefined;
36
39
  /**
@@ -39,19 +42,7 @@ export type AuthSocketSchema = {
39
42
  */
40
43
  pathGuard?: boolean;
41
44
  };
42
- export type EmailRegisterResponse = {
43
- success: true;
44
- code: "must-confirm-email";
45
- message?: string;
46
- } | {
47
- success: true;
48
- code: "magic-link-sent";
49
- message?: string;
50
- } | {
51
- success: true;
52
- code: "already-registered-but-did-not-confirm-email";
53
- message?: string;
54
- } | {
45
+ export type CommonAuthFailure = {
55
46
  success: false;
56
47
  code: "rate-limit-exceeded";
57
48
  message?: string;
@@ -59,39 +50,46 @@ export type EmailRegisterResponse = {
59
50
  success: false;
60
51
  code: "something-went-wrong";
61
52
  message?: string;
62
- } | {
63
- success: false;
64
- code: "weak-password";
65
- message?: string;
66
53
  };
67
- export type EmailLoginResponse = {
68
- success: true;
69
- code?: undefined;
54
+ export type AuthFailure = CommonAuthFailure | {
55
+ success: false;
56
+ code: "no-match";
70
57
  message?: string;
71
- redirect_url?: string;
72
58
  } | {
73
59
  success: false;
74
- code: "must-confirm-email";
60
+ code: "inactive-account";
75
61
  message?: string;
76
- } | {
62
+ };
63
+ export type MagicLinkAuthFailure = AuthFailure | {
77
64
  success: false;
78
65
  code: "expired-magic-link";
79
66
  message?: string;
80
- } | {
81
- success: false;
82
- code: "totp-token-missing";
67
+ };
68
+ export type AuthSuccess = {
69
+ success: true;
70
+ code?: undefined;
71
+ message?: string;
72
+ };
73
+ export type RegisterSuccess = {
74
+ success: true;
75
+ code: "email-verification-code-sent";
83
76
  message?: string;
84
77
  } | {
85
- success: false;
86
- code: "provider-issue";
78
+ success: true;
79
+ code: "magic-link-sent";
87
80
  message?: string;
88
81
  } | {
82
+ success: true;
83
+ code: "already-registered-but-did-not-confirm-email";
84
+ message?: string;
85
+ };
86
+ export type RegisterFailure = CommonAuthFailure | {
89
87
  success: false;
90
- code: "no-match";
88
+ code: "weak-password";
91
89
  message?: string;
92
90
  } | {
93
91
  success: false;
94
- code: "inactive-account";
92
+ code: "totp-token-missing";
95
93
  message?: string;
96
94
  } | {
97
95
  success: false;
@@ -103,11 +101,25 @@ export type EmailLoginResponse = {
103
101
  message?: string;
104
102
  } | {
105
103
  success: false;
106
- code: "something-went-wrong";
104
+ code: "provider-issue";
107
105
  message?: string;
108
- } | {
106
+ };
107
+ export type PasswordAuthFailure = AuthFailure | {
109
108
  success: false;
110
- code: "rate-limit-exceeded";
109
+ code: "email-not-confirmed";
111
110
  message?: string;
112
111
  };
112
+ export type LoginData = {
113
+ /**
114
+ * Email or username
115
+ */
116
+ username: string;
117
+ /**
118
+ * Undefined if loginType is withMagicLink
119
+ */
120
+ password?: string;
121
+ remember_me?: boolean;
122
+ totp_token?: string;
123
+ totp_recovery_code?: string;
124
+ };
113
125
  //# sourceMappingURL=auth.d.ts.map
@@ -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,QA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AE,eAAe,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,oBAAoB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAChE;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,4BAA4B,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACxE;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,mBAAmB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/D;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,MAAM,MAAM,mBAAmB,GAC3B,WAAW,GACX;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,qBAAqB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC"}
package/lib/auth.ts CHANGED
@@ -13,8 +13,11 @@ export type UserLike = {
13
13
  [key: string]: any;
14
14
  };
15
15
 
16
- export type EmailAuthType = "withPassword" | "withMagicLink";
17
- export type EmailSignupType = "withPassword" | "withMagicLink";
16
+ /**
17
+ * - withPassword: email and password required
18
+ * - withMagicLink: email required
19
+ */
20
+ export type AuthType = "withPassword" | "withMagicLink";
18
21
 
19
22
  /**
20
23
  * Auth object sent from server to client
@@ -35,12 +38,12 @@ export type AuthSocketSchema = {
35
38
  /**
36
39
  * Email login methods enabled on the server
37
40
  */
38
- loginType: EmailAuthType | undefined;
41
+ loginType: AuthType | undefined;
39
42
 
40
43
  /**
41
44
  * Email registration methods enabled on the server
42
45
  */
43
- register: { type: EmailSignupType; url: string } | undefined;
46
+ register: { type: AuthType; url: string } | undefined;
44
47
 
45
48
  /**
46
49
  * If server auth publicRoutes is set up and AuthGuard is not explicitly disabled ( disableSocketAuthGuard: true ):
@@ -49,23 +52,52 @@ export type AuthSocketSchema = {
49
52
  pathGuard?: boolean;
50
53
  };
51
54
 
52
- export type EmailRegisterResponse =
53
- | { success: true; code: "must-confirm-email"; message?: string }
54
- | { success: true; code: "magic-link-sent"; message?: string }
55
- | { success: true; code: "already-registered-but-did-not-confirm-email"; message?: string }
55
+ export type CommonAuthFailure =
56
56
  | { success: false; code: "rate-limit-exceeded"; message?: string }
57
- | { success: false; code: "something-went-wrong"; message?: string }
58
- | { success: false; code: "weak-password"; message?: string };
57
+ | { success: false; code: "something-went-wrong"; message?: string };
59
58
 
60
- export type EmailLoginResponse =
61
- | { success: true; code?: undefined; message?: string; redirect_url?: string }
62
- | { success: false; code: "must-confirm-email"; message?: string }
63
- | { success: false; code: "expired-magic-link"; message?: string }
64
- | { success: false; code: "totp-token-missing"; message?: string }
65
- | { success: false; code: "provider-issue"; message?: string }
59
+ export type AuthFailure =
60
+ | CommonAuthFailure
66
61
  | { success: false; code: "no-match"; message?: string }
67
- | { success: false; code: "inactive-account"; message?: string }
62
+ | { success: false; code: "inactive-account"; message?: string };
63
+
64
+ export type MagicLinkAuthFailure =
65
+ | AuthFailure
66
+ | { success: false; code: "expired-magic-link"; message?: string };
67
+
68
+ export type AuthSuccess = {
69
+ success: true;
70
+ code?: undefined;
71
+ message?: string;
72
+ };
73
+
74
+ export type RegisterSuccess =
75
+ | { success: true; code: "email-verification-code-sent"; message?: string }
76
+ | { success: true; code: "magic-link-sent"; message?: string }
77
+ | { success: true; code: "already-registered-but-did-not-confirm-email"; message?: string };
78
+
79
+ export type RegisterFailure =
80
+ | CommonAuthFailure
81
+ | { success: false; code: "weak-password"; message?: string }
82
+ | { success: false; code: "totp-token-missing"; message?: string }
68
83
  | { success: false; code: "invalid-totp-recovery-code"; message?: string }
69
84
  | { success: false; code: "invalid-totp-code"; message?: string }
70
- | { success: false; code: "something-went-wrong"; message?: string }
71
- | { success: false; code: "rate-limit-exceeded"; message?: string };
85
+ | { success: false; code: "provider-issue"; message?: string };
86
+
87
+ export type PasswordAuthFailure =
88
+ | AuthFailure
89
+ | { success: false; code: "email-not-confirmed"; message?: string };
90
+
91
+ export type LoginData = {
92
+ /**
93
+ * Email or username
94
+ */
95
+ username: string;
96
+ /**
97
+ * Undefined if loginType is withMagicLink
98
+ */
99
+ password?: string;
100
+ remember_me?: boolean;
101
+ totp_token?: string;
102
+ totp_recovery_code?: string;
103
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-types",
3
- "version": "4.0.123",
3
+ "version": "4.0.125",
4
4
  "description": "",
5
5
  "main": "dist/index_umd.js",
6
6
  "types": "dist/index.d.ts",