prostgles-client 4.0.155 → 4.0.157
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 +10 -10
- package/dist/Auth.d.ts.map +1 -1
- package/lib/Auth.ts +10 -8
- package/package.json +1 -1
- package/tests/package-lock.json +1 -1
- package/tests/tsconfig.json +0 -1
package/dist/Auth.d.ts
CHANGED
|
@@ -5,24 +5,24 @@ type Args = {
|
|
|
5
5
|
onReload: VoidFunction | undefined;
|
|
6
6
|
};
|
|
7
7
|
type WithProviderLogin = Partial<Record<IdentityProvider, VoidFunction>>;
|
|
8
|
-
type
|
|
8
|
+
export type AuthResult = {
|
|
9
9
|
success: true;
|
|
10
10
|
} | {
|
|
11
11
|
success: false;
|
|
12
12
|
error: string;
|
|
13
13
|
};
|
|
14
|
-
export type
|
|
14
|
+
export type PasswordLoginData = {
|
|
15
15
|
username: string;
|
|
16
16
|
password: string;
|
|
17
17
|
remember_me?: boolean;
|
|
18
18
|
totp_token?: string;
|
|
19
19
|
totp_recovery_code?: string;
|
|
20
|
-
}
|
|
21
|
-
export type
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
type EmailAuth = {
|
|
25
|
-
withPassword?: PasswordAuth
|
|
20
|
+
};
|
|
21
|
+
export type PasswordRegisterData = Pick<PasswordLoginData, "username" | "password">;
|
|
22
|
+
export type PasswordAuth<T> = (params: T) => Promise<AuthResult>;
|
|
23
|
+
export type MagicLinkAuth = (params: Pick<PasswordLoginData, "username">) => Promise<AuthResult>;
|
|
24
|
+
export type EmailAuth<T> = {
|
|
25
|
+
withPassword?: PasswordAuth<T>;
|
|
26
26
|
withMagicLink?: undefined;
|
|
27
27
|
} | {
|
|
28
28
|
withPassword?: undefined;
|
|
@@ -32,8 +32,8 @@ type LoginSignupOptions = {
|
|
|
32
32
|
prefferedLogin: string;
|
|
33
33
|
login: undefined | {
|
|
34
34
|
withProvider?: WithProviderLogin;
|
|
35
|
-
} & EmailAuth
|
|
36
|
-
register: undefined | EmailAuth
|
|
35
|
+
} & EmailAuth<PasswordLoginData>;
|
|
36
|
+
register: undefined | EmailAuth<PasswordRegisterData>;
|
|
37
37
|
providers: AuthSocketSchema["providers"];
|
|
38
38
|
};
|
|
39
39
|
type AuthStateLoggedOut = LoginSignupOptions & {
|
package/dist/Auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../lib/Auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA0D,KAAK,gBAAgB,EAAY,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../lib/Auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA0D,KAAK,gBAAgB,EAAY,KAAK,gBAAgB,EAAW,MAAM,iBAAiB,CAAC;AAG1K,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,GAAG,CAAC;IACZ,QAAQ,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACvC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;CACpC,CAAA;AAED,KAAK,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC,CAAC;AAEzE,MAAM,MAAM,UAAU,GACpB;IAAE,OAAO,EAAE,IAAI,CAAC;CAAE,GAClB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;CAAE,CAAA;AAEpC,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAAE,CAAC;AACjJ,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC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SAAgB,MAAM,QAAQ,MAAM,iBAmBpD,CAAA"}
|
package/lib/Auth.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnyObject, type AuthGuardLocation, type AuthGuardLocationResponse, type AuthSocketSchema, CHANNELS, type IdentityProvider,
|
|
1
|
+
import { type AnyObject, type AuthGuardLocation, type AuthGuardLocationResponse, type AuthSocketSchema, CHANNELS, type IdentityProvider, isEmpty } from "prostgles-types";
|
|
2
2
|
import { hasWnd } from "./prostgles";
|
|
3
3
|
|
|
4
4
|
type Args = {
|
|
@@ -9,16 +9,18 @@ type Args = {
|
|
|
9
9
|
|
|
10
10
|
type WithProviderLogin = Partial<Record<IdentityProvider, VoidFunction>>;
|
|
11
11
|
|
|
12
|
-
type
|
|
12
|
+
export type AuthResult =
|
|
13
13
|
| { success: true; }
|
|
14
14
|
| { success: false; error: string; }
|
|
15
15
|
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
16
|
+
export type PasswordLoginData = { username: string; password: string; remember_me?: boolean; totp_token?: string; totp_recovery_code?: string; };
|
|
17
|
+
export type PasswordRegisterData = Pick<PasswordLoginData, "username" | "password">
|
|
18
|
+
export type PasswordAuth<T> = (params: T) => Promise<AuthResult>;
|
|
19
|
+
export type MagicLinkAuth = (params: Pick<PasswordLoginData, "username">) => Promise<AuthResult>;
|
|
18
20
|
|
|
19
|
-
type EmailAuth =
|
|
21
|
+
export type EmailAuth<T> =
|
|
20
22
|
| {
|
|
21
|
-
withPassword?: PasswordAuth
|
|
23
|
+
withPassword?: PasswordAuth<T>
|
|
22
24
|
withMagicLink?: undefined;
|
|
23
25
|
}
|
|
24
26
|
| {
|
|
@@ -30,8 +32,8 @@ type LoginSignupOptions = {
|
|
|
30
32
|
prefferedLogin: string;
|
|
31
33
|
login: undefined | {
|
|
32
34
|
withProvider?: WithProviderLogin;
|
|
33
|
-
} & EmailAuth
|
|
34
|
-
register: undefined | EmailAuth
|
|
35
|
+
} & EmailAuth<PasswordLoginData>;
|
|
36
|
+
register: undefined | EmailAuth<PasswordRegisterData>;
|
|
35
37
|
providers: AuthSocketSchema["providers"];
|
|
36
38
|
}
|
|
37
39
|
|
package/package.json
CHANGED
package/tests/package-lock.json
CHANGED