@turbofy-ai/app-runtime 0.0.11 → 0.0.13
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/src/api/actions.d.ts +7 -0
- package/dist/src/api/hooks.d.ts +8 -1
- package/dist/src/api/index.d.ts +3 -2
- package/dist/src/api/types.d.ts +24 -1
- package/dist/src/dsl.d.ts +37 -6
- package/dist/src/dsl.js +463 -1197
- package/dist/src/lib/auth-actions.d.ts +33 -0
- package/dist/src/lib/auth.d.ts +36 -3
- package/dist/src/lib/auth.test.d.ts +1 -0
- package/dist/src/lib/preview-auth.d.ts +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface IAuthUser {
|
|
2
|
+
sub: string;
|
|
3
|
+
email?: string;
|
|
4
|
+
groups?: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface IAuthActionResult {
|
|
7
|
+
ok: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
code?: string;
|
|
10
|
+
needsConfirmation?: boolean;
|
|
11
|
+
signedIn?: boolean;
|
|
12
|
+
signInError?: string;
|
|
13
|
+
user?: IAuthUser | null;
|
|
14
|
+
}
|
|
15
|
+
export type IInvokeAuthAction = (actionId: string, body: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
16
|
+
/** Each client belongs to one app and one session transport. */
|
|
17
|
+
export declare const createAuthActions: (invoke: IInvokeAuthAction) => {
|
|
18
|
+
login: (email: string, password: string) => Promise<IAuthActionResult>;
|
|
19
|
+
logout: () => Promise<IAuthActionResult>;
|
|
20
|
+
currentUser: () => Promise<IAuthActionResult>;
|
|
21
|
+
refreshAccessToken: () => Promise<IAuthActionResult>;
|
|
22
|
+
forgotPassword: (email: string) => Promise<IAuthActionResult>;
|
|
23
|
+
resetPassword: (email: string, code: string, newPassword: string) => Promise<IAuthActionResult>;
|
|
24
|
+
changePassword: (currentPassword: string, newPassword: string) => Promise<IAuthActionResult>;
|
|
25
|
+
signup: (params: {
|
|
26
|
+
email: string;
|
|
27
|
+
password: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
}) => Promise<IAuthActionResult>;
|
|
30
|
+
confirmSignup: (email: string, code: string, password?: string) => Promise<IAuthActionResult>;
|
|
31
|
+
getSocialAuthorizeUrl: (provider: string, redirectUri: string) => Promise<string>;
|
|
32
|
+
socialSignIn: (callbackUrl: string) => Promise<IAuthActionResult>;
|
|
33
|
+
};
|
package/dist/src/lib/auth.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export interface IAuthResult {
|
|
|
3
3
|
error?: string;
|
|
4
4
|
/** Signup only: the account was created but needs email confirmation. */
|
|
5
5
|
needsConfirmation?: boolean;
|
|
6
|
+
/** A successful account mutation can still require a separate sign-in. */
|
|
7
|
+
signedIn?: boolean;
|
|
8
|
+
signInError?: string;
|
|
6
9
|
}
|
|
7
10
|
export interface ICurrentUser {
|
|
8
11
|
sub: string;
|
|
@@ -19,11 +22,35 @@ export declare const signup: (params: {
|
|
|
19
22
|
password: string;
|
|
20
23
|
name?: string;
|
|
21
24
|
}) => Promise<IAuthResult>;
|
|
22
|
-
export declare const confirmSignup: (email: string, code: string) => Promise<IAuthResult>;
|
|
25
|
+
export declare const confirmSignup: (email: string, code: string, password?: string) => Promise<IAuthResult>;
|
|
26
|
+
export declare const refreshAccessToken: () => Promise<IAuthResult>;
|
|
27
|
+
export declare const forgotPassword: (email: string) => Promise<IAuthResult>;
|
|
28
|
+
export declare const resetPassword: (email: string, code: string, newPassword: string) => Promise<IAuthResult>;
|
|
29
|
+
export declare const changePassword: (currentPassword: string, newPassword: string) => Promise<IAuthResult>;
|
|
30
|
+
export type ISocialAuthorizeResult = {
|
|
31
|
+
ok: true;
|
|
32
|
+
url: string;
|
|
33
|
+
state: string;
|
|
34
|
+
} | {
|
|
35
|
+
ok: false;
|
|
36
|
+
error: string;
|
|
37
|
+
};
|
|
38
|
+
/** The caller owns the PKCE verifier, pending state, and provider navigation. */
|
|
39
|
+
export declare const getSocialAuthorizeUrl: (params: {
|
|
40
|
+
provider: string;
|
|
41
|
+
redirectUri: string;
|
|
42
|
+
codeChallenge: string;
|
|
43
|
+
}) => Promise<ISocialAuthorizeResult>;
|
|
44
|
+
/** Validate callback state against the pending login before exchanging its code. */
|
|
45
|
+
export declare const socialSignIn: (params: {
|
|
46
|
+
code: string;
|
|
47
|
+
state: string;
|
|
48
|
+
codeVerifier: string;
|
|
49
|
+
}) => Promise<IAuthResult>;
|
|
23
50
|
export declare const logout: () => Promise<IAuthResult>;
|
|
24
|
-
/**
|
|
51
|
+
/** The signed-in end user, or null without a valid session. */
|
|
25
52
|
export declare const currentUser: () => Promise<ICurrentUserResult>;
|
|
26
|
-
/**
|
|
53
|
+
/** Load the signed-in user and follow successful session changes in this frame. */
|
|
27
54
|
export declare const useCurrentUser: () => {
|
|
28
55
|
refetch: () => Promise<void>;
|
|
29
56
|
user: ICurrentUser | null;
|
|
@@ -37,3 +64,9 @@ export declare const useCurrentUser: () => {
|
|
|
37
64
|
* the current locale, then the locale home, then the site root.
|
|
38
65
|
*/
|
|
39
66
|
export declare function safeNextPath(next: string | undefined): string;
|
|
67
|
+
/**
|
|
68
|
+
* The published app reloads so the route middleware sees the new session
|
|
69
|
+
* cookie; the console preview has no cookie and stays inside its host-driven
|
|
70
|
+
* router.
|
|
71
|
+
*/
|
|
72
|
+
export declare function redirectAfterAuth(next: string | undefined): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface IPreviewAuthContext {
|
|
2
|
+
locale: string;
|
|
3
|
+
defaultRedirectPath?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const setPreviewAuthContext: (context: IPreviewAuthContext | null) => void;
|
|
6
|
+
export declare const getPreviewAuthContext: () => IPreviewAuthContext | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turbofy-ai/app-runtime",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"sonner": "^2.0.7",
|
|
83
83
|
"tailwind-merge": "^3.4.0",
|
|
84
84
|
"vaul": "^1.1.2",
|
|
85
|
-
"zod": "
|
|
85
|
+
"zod": "~4.3.6"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@graphapi-io/declarations": "*",
|