prostgles-types 4.0.128 → 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,19 +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: "server-error";
63
- message?: string;
64
- } | {
65
- success: false;
66
- code: "rate-limit-exceeded";
67
- message?: string;
68
- } | {
69
- success: false;
70
- code: "something-went-wrong";
71
- message?: string;
72
- };
70
+ export type CommonAuthFailure = Failure<"server-error" | "rate-limit-exceeded" | "something-went-wrong">;
73
71
  export type AuthFailure = CommonAuthFailure | {
74
72
  success: false;
75
73
  code: "no-match";
@@ -79,84 +77,20 @@ export type AuthFailure = CommonAuthFailure | {
79
77
  code: "inactive-account";
80
78
  message?: string;
81
79
  };
82
- export type AuthSuccess = {
83
- success: true;
84
- code?: undefined;
85
- message?: string;
86
- };
87
- export type OAuthRegisterFailure = CommonAuthFailure | {
88
- success: false;
89
- code: "provider-issue";
90
- message?: string;
91
- };
92
80
  export declare namespace AuthResponse {
93
- type MagicLinkAuthSuccess = {
81
+ type AuthSuccess = {
94
82
  success: true;
95
- code: "magic-link-sent";
96
- message?: string;
97
- };
98
- type MagicLinkAuthFailure = AuthFailure | {
99
- success: false;
100
- code: "expired-magic-link";
83
+ code?: undefined;
101
84
  message?: string;
102
85
  };
86
+ type MagicLinkAuthSuccess = AuthSuccess;
87
+ type MagicLinkAuthFailure = AuthFailure | Failure<"expired-magic-link">;
103
88
  type OAuthRegisterSuccess = AuthSuccess;
104
- type OAuthRegisterFailure = CommonAuthFailure | {
105
- success: false;
106
- code: "provider-issue";
107
- message?: string;
108
- };
89
+ type OAuthRegisterFailure = CommonAuthFailure | Failure<"provider-issue">;
109
90
  type PasswordLoginSuccess = AuthSuccess;
110
- type PasswordLoginFailure = AuthFailure | {
111
- success: false;
112
- code: "totp-token-missing";
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;
122
- } | {
123
- success: false;
124
- code: "invalid-totp-recovery-code";
125
- message?: string;
126
- } | {
127
- success: false;
128
- code: "invalid-totp-code";
129
- message?: string;
130
- } | {
131
- success: false;
132
- code: "email-not-confirmed";
133
- message?: string;
134
- };
135
- type PasswordRegisterSuccess = {
136
- success: true;
137
- code: "email-verification-code-sent";
138
- message?: string;
139
- } | {
140
- success: true;
141
- code: "already-registered-but-did-not-confirm-email";
142
- message?: string;
143
- };
144
- type PasswordRegisterFailure = CommonAuthFailure | {
145
- success: false;
146
- code: "weak-password";
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;
156
- } | {
157
- success: false;
158
- code: "inactive-account";
159
- message?: string;
160
- };
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">;
161
94
  }
95
+ export {};
162
96
  //# 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;;OAEG;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;AACF,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,KAAY,SAAS,GAAG;QACtB;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B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AAA;CAAE,CAAC;AAEnE,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,KAAY,WAAW,GAAG;QACxB,OAAO,EAAE,IAAI,CAAC;QACd,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,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,54 +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: "server-error"; message?: string }
73
- | { success: false; code: "rate-limit-exceeded"; message?: string }
74
- | { success: false; code: "something-went-wrong"; message?: string };
75
+ export type CommonAuthFailure = Failure<
76
+ "server-error" | "rate-limit-exceeded" | "something-went-wrong"
77
+ >;
75
78
 
76
79
  export type AuthFailure =
77
80
  | CommonAuthFailure
78
81
  | { success: false; code: "no-match"; message?: string }
79
82
  | { success: false; code: "inactive-account"; message?: string };
80
83
 
81
- export type AuthSuccess = {
82
- success: true;
83
- code?: undefined;
84
- message?: string;
85
- };
86
-
87
- export type OAuthRegisterFailure =
88
- | CommonAuthFailure
89
- | { success: false; code: "provider-issue"; message?: string };
90
-
91
84
  export declare namespace AuthResponse {
92
- export type MagicLinkAuthSuccess = { success: true; code: "magic-link-sent"; message?: string };
93
- export type MagicLinkAuthFailure =
94
- | AuthFailure
95
- | { 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">;
96
93
 
97
94
  export type OAuthRegisterSuccess = AuthSuccess;
98
- export type OAuthRegisterFailure =
99
- | CommonAuthFailure
100
- | { success: false; code: "provider-issue"; message?: string };
95
+ export type OAuthRegisterFailure = CommonAuthFailure | Failure<"provider-issue">;
101
96
 
102
97
  export type PasswordLoginSuccess = AuthSuccess;
103
98
  export type PasswordLoginFailure =
104
99
  | AuthFailure
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 }
108
- | { success: false; code: "invalid-totp-recovery-code"; message?: string }
109
- | { success: false; code: "invalid-totp-code"; message?: string }
110
- | { success: false; code: "email-not-confirmed"; message?: string };
111
-
112
- export type PasswordRegisterSuccess =
113
- | { success: true; code: "email-verification-code-sent"; message?: string }
114
- | { 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
+ >;
115
112
  export type PasswordRegisterFailure =
116
113
  | CommonAuthFailure
117
- | { success: false; code: "weak-password"; message?: string }
118
- | { success: false; code: "username-missing"; message?: string }
119
- | { success: false; code: "password-missing"; message?: string }
120
- | { success: false; code: "inactive-account"; message?: string };
114
+ | Failure<"weak-password" | "username-missing" | "password-missing" | "inactive-account">;
121
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-types",
3
- "version": "4.0.128",
3
+ "version": "4.0.129",
4
4
  "description": "",
5
5
  "main": "dist/index_umd.js",
6
6
  "types": "dist/index.d.ts",