prostgles-types 4.0.133 → 4.0.135

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
@@ -5,10 +5,9 @@ export type UserLike = {
5
5
  [key: string]: any;
6
6
  };
7
7
  /**
8
- * - withPassword: email and password required
9
- * - withMagicLink: email required
8
+ * Used to hint to the client which login mode is available
10
9
  */
11
- export type AuthType = "withPassword" | "withMagicLink";
10
+ export type LocalLoginMode = "email" | "email+password";
12
11
  /**
13
12
  * Auth object sent from server to client
14
13
  */
@@ -27,12 +26,12 @@ export type AuthSocketSchema = {
27
26
  /**
28
27
  * Email login methods enabled on the server
29
28
  */
30
- loginType: AuthType | undefined;
29
+ loginType: LocalLoginMode | undefined;
31
30
  /**
32
31
  * Email registration methods enabled on the server
33
32
  */
34
- register: {
35
- type: AuthType;
33
+ signupWithEmailAndPassword: {
34
+ minPasswordLength: number;
36
35
  url: string;
37
36
  } | undefined;
38
37
  /**
@@ -68,29 +67,29 @@ export declare namespace AuthRequest {
68
67
  type RegisterData = Pick<LoginData, "username" | "password">;
69
68
  }
70
69
  export type CommonAuthFailure = Failure<"server-error" | "rate-limit-exceeded" | "something-went-wrong">;
71
- export type AuthFailure = CommonAuthFailure | {
72
- success: false;
73
- code: "no-match";
74
- message?: string;
75
- } | {
76
- success: false;
77
- code: "inactive-account";
78
- message?: string;
79
- };
80
70
  export declare namespace AuthResponse {
81
71
  type AuthSuccess = {
82
72
  success: true;
83
73
  code?: undefined;
84
74
  message?: string;
85
75
  };
76
+ type AuthFailure = CommonAuthFailure | {
77
+ success: false;
78
+ code: "no-match";
79
+ message?: string;
80
+ } | {
81
+ success: false;
82
+ code: "inactive-account";
83
+ message?: string;
84
+ };
86
85
  type MagicLinkAuthSuccess = AuthSuccess;
87
- type MagicLinkAuthFailure = AuthFailure | Failure<"expired-magic-link">;
86
+ type MagicLinkAuthFailure = AuthFailure | Failure<"expired-magic-link" | "invalid-magic-link" | "used-magic-link">;
88
87
  type OAuthRegisterSuccess = AuthSuccess;
89
88
  type OAuthRegisterFailure = CommonAuthFailure | Failure<"provider-issue">;
90
89
  type PasswordLoginSuccess = AuthSuccess;
91
90
  type PasswordLoginFailure = AuthFailure | Failure<"totp-token-missing" | "invalid-username" | "username-missing" | "password-missing" | "invalid-password" | "is-from-OAuth" | "is-from-magic-link" | "invalid-totp-recovery-code" | "invalid-totp-code" | "email-not-confirmed">;
92
91
  type PasswordRegisterSuccess = Success<"email-verification-code-sent" | "already-registered-but-did-not-confirm-email">;
93
- type PasswordRegisterFailure = CommonAuthFailure | Failure<"weak-password" | "user-already-registered" | "username-missing" | "password-missing" | "inactive-account">;
92
+ type PasswordRegisterFailure = CommonAuthFailure | Failure<"weak-password" | "user-already-registered" | "username-missing" | "password-missing" | "invalid-email-confirmation-code" | "expired-email-confirmation-code" | "inactive-account">;
94
93
  }
95
94
  export {};
96
95
  //# 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,CA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C,kBAAkB,CACrB,CAAC;CACP"}
package/lib/auth.ts CHANGED
@@ -14,10 +14,9 @@ export type UserLike = {
14
14
  };
15
15
 
16
16
  /**
17
- * - withPassword: email and password required
18
- * - withMagicLink: email required
17
+ * Used to hint to the client which login mode is available
19
18
  */
20
- export type AuthType = "withPassword" | "withMagicLink";
19
+ export type LocalLoginMode = "email" | "email+password";
21
20
 
22
21
  /**
23
22
  * Auth object sent from server to client
@@ -37,12 +36,12 @@ export type AuthSocketSchema = {
37
36
  /**
38
37
  * Email login methods enabled on the server
39
38
  */
40
- loginType: AuthType | undefined;
39
+ loginType: LocalLoginMode | undefined;
41
40
 
42
41
  /**
43
42
  * Email registration methods enabled on the server
44
43
  */
45
- register: { type: AuthType; url: string } | undefined;
44
+ signupWithEmailAndPassword: { minPasswordLength: number; url: string } | undefined;
46
45
 
47
46
  /**
48
47
  * If server auth publicRoutes is set up and AuthGuard is not explicitly disabled ( disableSocketAuthGuard: true ):
@@ -76,11 +75,6 @@ export type CommonAuthFailure = Failure<
76
75
  "server-error" | "rate-limit-exceeded" | "something-went-wrong"
77
76
  >;
78
77
 
79
- export type AuthFailure =
80
- | CommonAuthFailure
81
- | { success: false; code: "no-match"; message?: string }
82
- | { success: false; code: "inactive-account"; message?: string };
83
-
84
78
  export declare namespace AuthResponse {
85
79
  export type AuthSuccess = {
86
80
  success: true;
@@ -88,8 +82,15 @@ export declare namespace AuthResponse {
88
82
  message?: string;
89
83
  };
90
84
 
85
+ export type AuthFailure =
86
+ | CommonAuthFailure
87
+ | { success: false; code: "no-match"; message?: string }
88
+ | { success: false; code: "inactive-account"; message?: string };
89
+
91
90
  export type MagicLinkAuthSuccess = AuthSuccess;
92
- export type MagicLinkAuthFailure = AuthFailure | Failure<"expired-magic-link">;
91
+ export type MagicLinkAuthFailure =
92
+ | AuthFailure
93
+ | Failure<"expired-magic-link" | "invalid-magic-link" | "used-magic-link">;
93
94
 
94
95
  export type OAuthRegisterSuccess = AuthSuccess;
95
96
  export type OAuthRegisterFailure = CommonAuthFailure | Failure<"provider-issue">;
@@ -120,6 +121,8 @@ export declare namespace AuthResponse {
120
121
  | "user-already-registered"
121
122
  | "username-missing"
122
123
  | "password-missing"
124
+ | "invalid-email-confirmation-code"
125
+ | "expired-email-confirmation-code"
123
126
  | "inactive-account"
124
127
  >;
125
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-types",
3
- "version": "4.0.133",
3
+ "version": "4.0.135",
4
4
  "description": "",
5
5
  "main": "dist/index_umd.js",
6
6
  "types": "dist/index.d.ts",