@henosia/app-next 1.0.4 → 1.0.6
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/.agents/skills/henosia-app-next/SKILL.md +9 -8
- package/README.md +9 -4
- package/dist/api/auth.d.mts +3 -1
- package/dist/api/auth.mjs +32 -2
- package/dist/api/platform.mjs +42 -6
- package/dist/auth/middleware.d.mts +6 -21
- package/dist/auth/middleware.mjs +43 -128
- package/dist/auth/server-guards.d.mts +1 -1
- package/dist/auth/server-guards.mjs +2 -2
- package/dist/auth/server.d.mts +1 -106
- package/dist/auth/server.mjs +40 -79
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -3
- package/dist/middleware-shared-CZbIZuBw.mjs +140 -0
- package/dist/platform/app-switcher.d.mts +7 -10
- package/dist/platform/app-switcher.mjs +4 -4
- package/dist/server-DfD6Dc91.d.mts +112 -0
- package/dist/session-sync-Cva_oreV.mjs +114 -0
- package/dist/shared-BWPBaubT.d.mts +30 -0
- package/dist/shared.d.mts +2 -2
- package/dist/shared.mjs +11 -2
- package/package.json +1 -1
- package/dist/shared-BWt7Sysv.d.mts +0 -19
package/dist/shared.mjs
CHANGED
|
@@ -6,9 +6,18 @@ const HENOSIA_AUTH_SIGN_IN_PATH_NAME = "/sign-in";
|
|
|
6
6
|
*
|
|
7
7
|
* `useSession` automatically refetches this endpoint on browser tab focus (and optionally on a polling
|
|
8
8
|
* interval), which we leverage as a built-in keep-alive for the OIDC access/refresh tokens — see
|
|
9
|
-
* `isPageOrRefreshTokenRequest` and the middleware
|
|
9
|
+
* `isPageOrRefreshTokenRequest` and the middleware-backed session sync route.
|
|
10
10
|
*/
|
|
11
11
|
const HENOSIA_AUTH_GET_SESSION_PATH_NAME = "/api/auth/get-session";
|
|
12
|
+
/**
|
|
13
|
+
* Internal route used by the Edge middleware to delegate server-only token refresh and downstream session sync
|
|
14
|
+
* without importing the Better Auth server graph into the middleware bundle.
|
|
15
|
+
*/
|
|
16
|
+
const HENOSIA_AUTH_SESSION_SYNC_PATH_NAME = "/api/auth/henosia-session-sync";
|
|
17
|
+
const HENOSIA_AUTH_SESSION_SYNC_ORIGINAL_URL_HEADER = "x-henosia-auth-original-url";
|
|
18
|
+
const HENOSIA_AUTH_SESSION_SYNC_ORIGINAL_METHOD_HEADER = "x-henosia-auth-original-method";
|
|
19
|
+
const HENOSIA_AUTH_SESSION_SYNC_ORIGINAL_FETCH_DEST_HEADER = "x-henosia-auth-original-fetch-dest";
|
|
12
20
|
const HENOSIA_ORGANIZATION_CTX_COOKIE = "henosia.org";
|
|
21
|
+
const HENOSIA_AUTH_INVALID_SESSION_BODY = { error: "Your session is invalid or expired. Please reload the page to sign in again." };
|
|
13
22
|
//#endregion
|
|
14
|
-
export { HENOSIA_AUTH_GET_SESSION_PATH_NAME, HENOSIA_AUTH_SIGN_IN_PATH_NAME, HENOSIA_ORGANIZATION_CTX_COOKIE };
|
|
23
|
+
export { HENOSIA_AUTH_GET_SESSION_PATH_NAME, HENOSIA_AUTH_INVALID_SESSION_BODY, HENOSIA_AUTH_SESSION_SYNC_ORIGINAL_FETCH_DEST_HEADER, HENOSIA_AUTH_SESSION_SYNC_ORIGINAL_METHOD_HEADER, HENOSIA_AUTH_SESSION_SYNC_ORIGINAL_URL_HEADER, HENOSIA_AUTH_SESSION_SYNC_PATH_NAME, HENOSIA_AUTH_SIGN_IN_PATH_NAME, HENOSIA_ORGANIZATION_CTX_COOKIE };
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/shared.d.ts
|
|
3
|
-
declare const HENOSIA_AUTH_SIGN_IN_PATH_NAME = "/sign-in";
|
|
4
|
-
/**
|
|
5
|
-
* The pathname for better-auth's `/get-session` endpoint, used by the React `useSession` hook.
|
|
6
|
-
*
|
|
7
|
-
* `useSession` automatically refetches this endpoint on browser tab focus (and optionally on a polling
|
|
8
|
-
* interval), which we leverage as a built-in keep-alive for the OIDC access/refresh tokens — see
|
|
9
|
-
* `isPageOrRefreshTokenRequest` and the middleware special-case for this path.
|
|
10
|
-
*/
|
|
11
|
-
declare const HENOSIA_AUTH_GET_SESSION_PATH_NAME = "/api/auth/get-session";
|
|
12
|
-
type HenosiaOrganizationContext = {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
logoUrl: string | null;
|
|
16
|
-
} | null;
|
|
17
|
-
declare const HENOSIA_ORGANIZATION_CTX_COOKIE = "henosia.org";
|
|
18
|
-
//#endregion
|
|
19
|
-
export { HenosiaOrganizationContext as i, HENOSIA_AUTH_SIGN_IN_PATH_NAME as n, HENOSIA_ORGANIZATION_CTX_COOKIE as r, HENOSIA_AUTH_GET_SESSION_PATH_NAME as t };
|