prostgles-types 4.0.125 → 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 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";
@@ -60,66 +75,84 @@ export type AuthFailure = CommonAuthFailure | {
60
75
  code: "inactive-account";
61
76
  message?: string;
62
77
  };
63
- export type MagicLinkAuthFailure = AuthFailure | {
64
- success: false;
65
- code: "expired-magic-link";
66
- message?: string;
67
- };
68
78
  export type AuthSuccess = {
69
79
  success: true;
70
80
  code?: undefined;
71
81
  message?: string;
72
82
  };
73
- export type RegisterSuccess = {
74
- success: true;
75
- code: "email-verification-code-sent";
76
- message?: string;
77
- } | {
78
- success: true;
79
- code: "magic-link-sent";
80
- message?: string;
81
- } | {
82
- success: true;
83
- code: "already-registered-but-did-not-confirm-email";
84
- message?: string;
85
- };
86
- export type RegisterFailure = CommonAuthFailure | {
87
- success: false;
88
- code: "weak-password";
89
- message?: string;
90
- } | {
91
- success: false;
92
- code: "totp-token-missing";
93
- message?: string;
94
- } | {
95
- success: false;
96
- code: "invalid-totp-recovery-code";
97
- message?: string;
98
- } | {
99
- success: false;
100
- code: "invalid-totp-code";
101
- message?: string;
102
- } | {
83
+ export type OAuthRegisterFailure = CommonAuthFailure | {
103
84
  success: false;
104
85
  code: "provider-issue";
105
86
  message?: string;
106
87
  };
107
- export type PasswordAuthFailure = AuthFailure | {
108
- success: false;
109
- code: "email-not-confirmed";
110
- message?: string;
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
- };
88
+ export declare namespace AuthResponse {
89
+ type MagicLinkAuthSuccess = {
90
+ success: true;
91
+ code: "magic-link-sent";
92
+ message?: string;
93
+ };
94
+ type MagicLinkAuthFailure = AuthFailure | {
95
+ success: false;
96
+ code: "expired-magic-link";
97
+ message?: string;
98
+ };
99
+ type OAuthRegisterSuccess = AuthSuccess;
100
+ type OAuthRegisterFailure = CommonAuthFailure | {
101
+ success: false;
102
+ code: "provider-issue";
103
+ message?: string;
104
+ };
105
+ type PasswordLoginSuccess = AuthSuccess;
106
+ type PasswordLoginFailure = AuthFailure | {
107
+ success: false;
108
+ code: "totp-token-missing";
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;
118
+ } | {
119
+ success: false;
120
+ code: "invalid-totp-recovery-code";
121
+ message?: string;
122
+ } | {
123
+ success: false;
124
+ code: "invalid-totp-code";
125
+ message?: string;
126
+ } | {
127
+ success: false;
128
+ code: "email-not-confirmed";
129
+ message?: string;
130
+ };
131
+ type PasswordRegisterSuccess = {
132
+ success: true;
133
+ code: "email-verification-code-sent";
134
+ message?: string;
135
+ } | {
136
+ success: true;
137
+ code: "already-registered-but-did-not-confirm-email";
138
+ message?: string;
139
+ };
140
+ type PasswordRegisterFailure = CommonAuthFailure | {
141
+ success: false;
142
+ code: "weak-password";
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;
152
+ } | {
153
+ success: false;
154
+ code: "inactive-account";
155
+ message?: string;
156
+ };
157
+ }
125
158
  //# 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,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,GAAG,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,eAAe,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAE3B;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,GAAG,SAAS,CAAC;IAE1E;;OAEG;IACH,SAAS,EAAE,QAAQ,GAAG,SAAS,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAEtD;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,qBAAqB,CAAC;IAAC,OAAO,CAAC,EAAE,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ED
@@ -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 }
@@ -61,43 +77,44 @@ export type AuthFailure =
61
77
  | { success: false; code: "no-match"; message?: string }
62
78
  | { success: false; code: "inactive-account"; message?: string };
63
79
 
64
- export type MagicLinkAuthFailure =
65
- | AuthFailure
66
- | { success: false; code: "expired-magic-link"; message?: string };
67
-
68
80
  export type AuthSuccess = {
69
81
  success: true;
70
82
  code?: undefined;
71
83
  message?: string;
72
84
  };
73
85
 
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 =
86
+ export type OAuthRegisterFailure =
80
87
  | CommonAuthFailure
81
- | { success: false; code: "weak-password"; message?: string }
82
- | { success: false; code: "totp-token-missing"; message?: string }
83
- | { success: false; code: "invalid-totp-recovery-code"; message?: string }
84
- | { success: false; code: "invalid-totp-code"; message?: string }
85
88
  | { success: false; code: "provider-issue"; message?: string };
86
89
 
87
- export type PasswordAuthFailure =
88
- | AuthFailure
89
- | { success: false; code: "email-not-confirmed"; message?: string };
90
+ export declare namespace AuthResponse {
91
+ export type MagicLinkAuthSuccess = { success: true; code: "magic-link-sent"; message?: string };
92
+ export type MagicLinkAuthFailure =
93
+ | AuthFailure
94
+ | { success: false; code: "expired-magic-link"; message?: string };
90
95
 
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
- };
96
+ export type OAuthRegisterSuccess = AuthSuccess;
97
+ export type OAuthRegisterFailure =
98
+ | CommonAuthFailure
99
+ | { success: false; code: "provider-issue"; message?: string };
100
+
101
+ export type PasswordLoginSuccess = AuthSuccess;
102
+ export type PasswordLoginFailure =
103
+ | AuthFailure
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 }
107
+ | { success: false; code: "invalid-totp-recovery-code"; message?: string }
108
+ | { success: false; code: "invalid-totp-code"; message?: string }
109
+ | { success: false; code: "email-not-confirmed"; message?: string };
110
+
111
+ export type PasswordRegisterSuccess =
112
+ | { success: true; code: "email-verification-code-sent"; message?: string }
113
+ | { success: true; code: "already-registered-but-did-not-confirm-email"; message?: string };
114
+ export type PasswordRegisterFailure =
115
+ | CommonAuthFailure
116
+ | { success: false; code: "weak-password"; message?: string }
117
+ | { success: false; code: "username-missing"; message?: string }
118
+ | { success: false; code: "password-missing"; message?: string }
119
+ | { success: false; code: "inactive-account"; message?: string };
120
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-types",
3
- "version": "4.0.125",
3
+ "version": "4.0.127",
4
4
  "description": "",
5
5
  "main": "dist/index_umd.js",
6
6
  "types": "dist/index.d.ts",