prostgles-types 4.0.127 → 4.0.129

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
@@ -41,6 +41,16 @@ export type AuthSocketSchema = {
41
41
  */
42
42
  pathGuard?: boolean;
43
43
  };
44
+ type Failure<Code extends string> = {
45
+ success: false;
46
+ code: Code;
47
+ message?: string;
48
+ };
49
+ type Success<Code extends string> = {
50
+ success: true;
51
+ code: Code;
52
+ message?: string;
53
+ };
44
54
  export declare namespace AuthRequest {
45
55
  type LoginData = {
46
56
  /**
@@ -48,7 +58,7 @@ export declare namespace AuthRequest {
48
58
  */
49
59
  username: string;
50
60
  /**
51
- * Undefined if loginType is withMagicLink
61
+ * Undefined if loginType must be withMagicLink
52
62
  */
53
63
  password?: string;
54
64
  remember_me?: boolean;
@@ -57,15 +67,7 @@ export declare namespace AuthRequest {
57
67
  };
58
68
  type RegisterData = Pick<LoginData, "username" | "password">;
59
69
  }
60
- export type CommonAuthFailure = {
61
- success: false;
62
- code: "rate-limit-exceeded";
63
- message?: string;
64
- } | {
65
- success: false;
66
- code: "something-went-wrong";
67
- message?: string;
68
- };
70
+ export type CommonAuthFailure = Failure<"server-error" | "rate-limit-exceeded" | "something-went-wrong">;
69
71
  export type AuthFailure = CommonAuthFailure | {
70
72
  success: false;
71
73
  code: "no-match";
@@ -75,84 +77,20 @@ export type AuthFailure = CommonAuthFailure | {
75
77
  code: "inactive-account";
76
78
  message?: string;
77
79
  };
78
- export type AuthSuccess = {
79
- success: true;
80
- code?: undefined;
81
- message?: string;
82
- };
83
- export type OAuthRegisterFailure = CommonAuthFailure | {
84
- success: false;
85
- code: "provider-issue";
86
- message?: string;
87
- };
88
80
  export declare namespace AuthResponse {
89
- type MagicLinkAuthSuccess = {
81
+ type AuthSuccess = {
90
82
  success: true;
91
- code: "magic-link-sent";
92
- message?: string;
93
- };
94
- type MagicLinkAuthFailure = AuthFailure | {
95
- success: false;
96
- code: "expired-magic-link";
83
+ code?: undefined;
97
84
  message?: string;
98
85
  };
86
+ type MagicLinkAuthSuccess = AuthSuccess;
87
+ type MagicLinkAuthFailure = AuthFailure | Failure<"expired-magic-link">;
99
88
  type OAuthRegisterSuccess = AuthSuccess;
100
- type OAuthRegisterFailure = CommonAuthFailure | {
101
- success: false;
102
- code: "provider-issue";
103
- message?: string;
104
- };
89
+ type OAuthRegisterFailure = CommonAuthFailure | Failure<"provider-issue">;
105
90
  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
- };
91
+ type PasswordLoginFailure = AuthFailure | Failure<"totp-token-missing" | "username-missing" | "password-missing" | "invalid-totp-recovery-code" | "invalid-totp-code" | "email-not-confirmed">;
92
+ type PasswordRegisterSuccess = Success<"email-verification-code-sent" | "already-registered-but-did-not-confirm-email">;
93
+ type PasswordRegisterFailure = CommonAuthFailure | Failure<"weak-password" | "username-missing" | "password-missing" | "inactive-account">;
157
94
  }
95
+ export {};
158
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jB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF,KAAY,oBAAoB,GAAG,WAAW,CAAC;IAC/C,KAAY,oBAAoB,GAAG,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAE/E,KAAY,oBAAoB,GAAG,WAAW,CAAC;IAC/C,KAAY,oBAAoB,GAAG,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEjF,KAAY,oBAAoB,GAAG,WAAW,CAAC;IAC/C,KAAY,oBAAoB,GAC5B,WAAW,GACX,OAAO,CACH,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,4BAA4B,GAC5B,mBAAmB,GACnB,qBAAqB,CACxB,CAAC;IAEN,KAAY,uBAAuB,GAAG,OAAO,CAC3C,8BAA8B,GAAG,8CAA8C,CAChF,CAAC;IACF,KAAY,uBAAuB,GAC/B,iBAAiB,GACjB,OAAO,CAAC,eAAe,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,kBAAkB,CAAC,CAAC;CAC7F"}
package/lib/auth.ts CHANGED
@@ -50,6 +50,10 @@ export type AuthSocketSchema = {
50
50
  */
51
51
  pathGuard?: boolean;
52
52
  };
53
+
54
+ type Failure<Code extends string> = { success: false; code: Code; message?: string };
55
+ type Success<Code extends string> = { success: true; code: Code; message?: string };
56
+
53
57
  export declare namespace AuthRequest {
54
58
  export type LoginData = {
55
59
  /**
@@ -57,7 +61,7 @@ export declare namespace AuthRequest {
57
61
  */
58
62
  username: string;
59
63
  /**
60
- * Undefined if loginType is withMagicLink
64
+ * Undefined if loginType must be withMagicLink
61
65
  */
62
66
  password?: string;
63
67
  remember_me?: boolean;
@@ -68,53 +72,44 @@ export declare namespace AuthRequest {
68
72
  export type RegisterData = Pick<LoginData, "username" | "password">;
69
73
  }
70
74
 
71
- export type CommonAuthFailure =
72
- | { success: false; code: "rate-limit-exceeded"; message?: string }
73
- | { success: false; code: "something-went-wrong"; message?: string };
75
+ export type CommonAuthFailure = Failure<
76
+ "server-error" | "rate-limit-exceeded" | "something-went-wrong"
77
+ >;
74
78
 
75
79
  export type AuthFailure =
76
80
  | CommonAuthFailure
77
81
  | { success: false; code: "no-match"; message?: string }
78
82
  | { success: false; code: "inactive-account"; message?: string };
79
83
 
80
- export type AuthSuccess = {
81
- success: true;
82
- code?: undefined;
83
- message?: string;
84
- };
85
-
86
- export type OAuthRegisterFailure =
87
- | CommonAuthFailure
88
- | { success: false; code: "provider-issue"; message?: string };
89
-
90
84
  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 };
85
+ export type AuthSuccess = {
86
+ success: true;
87
+ code?: undefined;
88
+ message?: string;
89
+ };
90
+
91
+ export type MagicLinkAuthSuccess = AuthSuccess;
92
+ export type MagicLinkAuthFailure = AuthFailure | Failure<"expired-magic-link">;
95
93
 
96
94
  export type OAuthRegisterSuccess = AuthSuccess;
97
- export type OAuthRegisterFailure =
98
- | CommonAuthFailure
99
- | { success: false; code: "provider-issue"; message?: string };
95
+ export type OAuthRegisterFailure = CommonAuthFailure | Failure<"provider-issue">;
100
96
 
101
97
  export type PasswordLoginSuccess = AuthSuccess;
102
98
  export type PasswordLoginFailure =
103
99
  | 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 };
100
+ | Failure<
101
+ | "totp-token-missing"
102
+ | "username-missing"
103
+ | "password-missing"
104
+ | "invalid-totp-recovery-code"
105
+ | "invalid-totp-code"
106
+ | "email-not-confirmed"
107
+ >;
108
+
109
+ export type PasswordRegisterSuccess = Success<
110
+ "email-verification-code-sent" | "already-registered-but-did-not-confirm-email"
111
+ >;
114
112
  export type PasswordRegisterFailure =
115
113
  | 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 };
114
+ | Failure<"weak-password" | "username-missing" | "password-missing" | "inactive-account">;
120
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-types",
3
- "version": "4.0.127",
3
+ "version": "4.0.129",
4
4
  "description": "",
5
5
  "main": "dist/index_umd.js",
6
6
  "types": "dist/index.d.ts",