@henosia/app-next 1.0.2
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/LICENSE +183 -0
- package/README.md +173 -0
- package/dist/api/auth.d.mts +6 -0
- package/dist/api/auth.mjs +18 -0
- package/dist/api/platform.d.mts +19 -0
- package/dist/api/platform.mjs +48 -0
- package/dist/auth/client.d.mts +25 -0
- package/dist/auth/client.mjs +19 -0
- package/dist/auth/middleware.d.mts +54 -0
- package/dist/auth/middleware.mjs +152 -0
- package/dist/auth/server.d.mts +108 -0
- package/dist/auth/server.mjs +214 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +4 -0
- package/dist/platform/app-switcher.d.mts +96 -0
- package/dist/platform/app-switcher.mjs +74 -0
- package/dist/shared.d.mts +19 -0
- package/dist/shared.mjs +14 -0
- package/dist/supabase/client.d.mts +8 -0
- package/dist/supabase/client.mjs +12 -0
- package/dist/supabase/server.d.mts +11 -0
- package/dist/supabase/server.mjs +25 -0
- package/package.json +77 -0
package/dist/shared.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*! Copyright (c) 2026 Henosia ApS. Licensed under the Henosia Commercial Source License v1.0. See LICENSE */
|
|
2
|
+
//#region src/shared.ts
|
|
3
|
+
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
|
+
const HENOSIA_AUTH_GET_SESSION_PATH_NAME = "/api/auth/get-session";
|
|
12
|
+
const HENOSIA_ORGANIZATION_CTX_COOKIE = "henosia.org";
|
|
13
|
+
//#endregion
|
|
14
|
+
export { HENOSIA_AUTH_GET_SESSION_PATH_NAME, HENOSIA_AUTH_SIGN_IN_PATH_NAME, HENOSIA_ORGANIZATION_CTX_COOKIE };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*! Copyright (c) 2026 Henosia ApS. Licensed under the Henosia Commercial Source License v1.0. See LICENSE */
|
|
2
|
+
"use client";
|
|
3
|
+
import { createBrowserClient } from "@supabase/ssr";
|
|
4
|
+
//#region src/supabase/client.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates a Supabase browser client.
|
|
7
|
+
*/
|
|
8
|
+
function createClient() {
|
|
9
|
+
return createBrowserClient(process.env.NEXT_PUBLIC_SUPABASE_URL, process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { createClient };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/supabase/server.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Supabase server client wired up with Next.js cookies.
|
|
5
|
+
*
|
|
6
|
+
* If using Fluid compute: Don't put this client in a global variable. Always create a new client within each
|
|
7
|
+
* function when using it.
|
|
8
|
+
*/
|
|
9
|
+
declare function createClient(): Promise<import("@supabase/supabase-js").SupabaseClient<any, "public", "public", any, any>>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { createClient };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*! Copyright (c) 2026 Henosia ApS. Licensed under the Henosia Commercial Source License v1.0. See LICENSE */
|
|
2
|
+
import { cookies } from "next/headers.js";
|
|
3
|
+
import { createServerClient } from "@supabase/ssr";
|
|
4
|
+
//#region src/supabase/server.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates a Supabase server client wired up with Next.js cookies.
|
|
7
|
+
*
|
|
8
|
+
* If using Fluid compute: Don't put this client in a global variable. Always create a new client within each
|
|
9
|
+
* function when using it.
|
|
10
|
+
*/
|
|
11
|
+
async function createClient() {
|
|
12
|
+
const cookieStore = await cookies();
|
|
13
|
+
return createServerClient(process.env.NEXT_PUBLIC_SUPABASE_URL, process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY, { cookies: {
|
|
14
|
+
getAll() {
|
|
15
|
+
return cookieStore.getAll();
|
|
16
|
+
},
|
|
17
|
+
setAll(cookiesToSet) {
|
|
18
|
+
try {
|
|
19
|
+
cookiesToSet.forEach(({ name, value, options }) => cookieStore.set(name, value, options));
|
|
20
|
+
} catch {}
|
|
21
|
+
}
|
|
22
|
+
} });
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { createClient };
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@henosia/app-next",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Henosia integration for Next.js apps: Provides Henosia Auth and Henosia Platform features like app switcher",
|
|
5
|
+
"author": "Henosia",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"homepage": "https://app.henosia.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/henosia/app-nextjs.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://discord.gg/qQdY6VPWfQ"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsdown",
|
|
22
|
+
"dev": "tsdown --watch",
|
|
23
|
+
"test": "vitest",
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"release": "bumpp",
|
|
26
|
+
"prepublishOnly": "pnpm run build",
|
|
27
|
+
"pack": "npm pack"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@supabase/ssr": "^0.10.2",
|
|
31
|
+
"@supabase/supabase-js": "^2.103.0",
|
|
32
|
+
"@tanstack/react-query": "^5.0.0",
|
|
33
|
+
"better-auth": ">=1.6.0 <2",
|
|
34
|
+
"next": "14 || 15 || 16",
|
|
35
|
+
"react": "^18 || ^19",
|
|
36
|
+
"react-dom": "^18 || ^19"
|
|
37
|
+
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"@supabase/ssr": {
|
|
40
|
+
"optional": true
|
|
41
|
+
},
|
|
42
|
+
"@supabase/supabase-js": {
|
|
43
|
+
"optional": true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@supabase/ssr": "^0.10.2",
|
|
48
|
+
"@supabase/supabase-js": "^2.103.0",
|
|
49
|
+
"@tanstack/react-query": "^5.0.0",
|
|
50
|
+
"@types/node": "^25.6.2",
|
|
51
|
+
"@types/react": "^19.0.0",
|
|
52
|
+
"@types/react-dom": "^19.0.0",
|
|
53
|
+
"@typescript/native-preview": "7.0.0-dev.20260509.2",
|
|
54
|
+
"better-auth": "^1.6.0",
|
|
55
|
+
"bumpp": "^11.1.0",
|
|
56
|
+
"next": "^15.0.0",
|
|
57
|
+
"react": "^19.0.0",
|
|
58
|
+
"react-dom": "^19.0.0",
|
|
59
|
+
"tsdown": "^0.22.0",
|
|
60
|
+
"typescript": "^6.0.3",
|
|
61
|
+
"vitest": "^4.1.5"
|
|
62
|
+
},
|
|
63
|
+
"exports": {
|
|
64
|
+
".": "./dist/index.mjs",
|
|
65
|
+
"./api/auth": "./dist/api/auth.mjs",
|
|
66
|
+
"./api/platform": "./dist/api/platform.mjs",
|
|
67
|
+
"./auth/client": "./dist/auth/client.mjs",
|
|
68
|
+
"./auth/middleware": "./dist/auth/middleware.mjs",
|
|
69
|
+
"./auth/server": "./dist/auth/server.mjs",
|
|
70
|
+
"./platform/app-switcher": "./dist/platform/app-switcher.mjs",
|
|
71
|
+
"./shared": "./dist/shared.mjs",
|
|
72
|
+
"./supabase/client": "./dist/supabase/client.mjs",
|
|
73
|
+
"./supabase/server": "./dist/supabase/server.mjs",
|
|
74
|
+
"./package.json": "./package.json"
|
|
75
|
+
},
|
|
76
|
+
"types": "./dist/index.d.ts"
|
|
77
|
+
}
|