@rolder/kit 3.0.0-alpha.97 → 3.0.0-alpha.99

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.
@@ -0,0 +1,46 @@
1
+ import { admin, jwt, username } from "better-auth/plugins";
2
+ import { tanstackStartCookies } from "better-auth/tanstack-start";
3
+ import { surrealDbAdapter } from "./surrealDbAdapter/index.js";
4
+ const baseUrl = "/";
5
+ const defaultAuthServerConfig = {
6
+ baseURL: baseUrl,
7
+ secret: process.env.BETTER_AUTH_SECRET,
8
+ database: surrealDbAdapter(),
9
+ experimental: {
10
+ joins: true
11
+ },
12
+ emailAndPassword: {
13
+ enabled: true
14
+ },
15
+ plugins: [
16
+ admin({
17
+ bannedUserMessage: 'Доступ к приложению заблокирован. Обратитесь к администратору.'
18
+ }),
19
+ username(),
20
+ jwt({
21
+ jwks: {
22
+ keyPairConfig: {
23
+ alg: 'EdDSA',
24
+ crv: 'Ed25519'
25
+ }
26
+ },
27
+ jwt: {
28
+ issuer: baseUrl,
29
+ audience: baseUrl,
30
+ expirationTime: '15m',
31
+ definePayload: ({ user, session })=>({
32
+ id: user.id,
33
+ ns: process.env.SURREALDB_NAMESPACE || 'dev',
34
+ db: process.env.SURREALDB_DATABASE || 'data',
35
+ ac: 'better_auth_jwt',
36
+ email: user.email,
37
+ name: user.name,
38
+ role: user.role,
39
+ sessionId: session.id
40
+ })
41
+ }
42
+ }),
43
+ tanstackStartCookies()
44
+ ]
45
+ };
46
+ export { defaultAuthServerConfig };
@@ -4,6 +4,6 @@ export * from 'better-auth/plugins';
4
4
  export * from 'better-auth/plugins/admin/access';
5
5
  export * from 'better-auth/react';
6
6
  export { tanstackStartCookies } from 'better-auth/tanstack-start';
7
- export * from './getAuthServerConfig';
7
+ export * from './defaultAuthServerConfig';
8
8
  export * from './getDBSession';
9
9
  export * from './getSessionUser';
@@ -4,7 +4,7 @@ export * from "better-auth/client/plugins";
4
4
  export * from "better-auth/plugins";
5
5
  export * from "better-auth/plugins/admin/access";
6
6
  export * from "better-auth/react";
7
- export * from "./getAuthServerConfig.js";
7
+ export * from "./defaultAuthServerConfig.js";
8
8
  export * from "./getDBSession.js";
9
9
  export * from "./getSessionUser.js";
10
10
  export { betterAuth as betterAuthServer, tanstackStartCookies };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolder/kit",
3
- "version": "3.0.0-alpha.97",
3
+ "version": "3.0.0-alpha.99",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./ai": {
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "peerDependencies": {
58
58
  "better-auth": "^1.4.18",
59
- "@ai-sdk/react": "^3.0.87",
59
+ "@ai-sdk/react": "^3.0.88",
60
60
  "@better-upload/client": "^3.0.14",
61
61
  "@better-upload/server": "^3.0.14",
62
62
  "@codemirror/lang-json": "^6.0.2",
@@ -66,11 +66,11 @@
66
66
  "@mantine/notifications": "^8.3.14",
67
67
  "@mantine/tiptap": "^8.3.14",
68
68
  "@nanostores/react": "^1.0.0",
69
- "@tanstack/react-form": "^1.28.1",
69
+ "@tanstack/react-form": "^1.28.2",
70
70
  "@tanstack/react-query": "^5.90.21",
71
- "@tanstack/react-router": "^1.159.5",
72
- "@tanstack/react-router-ssr-query": "^1.159.5",
73
- "@tanstack/react-start": "^1.159.5",
71
+ "@tanstack/react-router": "^1.159.10",
72
+ "@tanstack/react-router-ssr-query": "^1.159.10",
73
+ "@tanstack/react-start": "^1.159.11",
74
74
  "@tiptap/extension-highlight": "^3.19.0",
75
75
  "@tiptap/extension-placeholder": "^3.19.0",
76
76
  "@tiptap/extension-table": "^3.19.0",
@@ -83,7 +83,7 @@
83
83
  "@uiw/react-codemirror": "^4.25.4",
84
84
  "@codemirror/commands": "^6.10.2",
85
85
  "@codemirror/view": "^6.39.14",
86
- "ai": "^6.0.85",
86
+ "ai": "^6.0.86",
87
87
  "clsx": "^2.1.1",
88
88
  "js-cookie": "^3.0.5",
89
89
  "mammoth": "^1.11.0",
@@ -1,7 +0,0 @@
1
- import type { BetterAuthOptions } from 'better-auth/minimal';
2
- import { type Role } from 'better-auth/plugins';
3
- export interface AuthServerConfig {
4
- betterAuthOptions?: Partial<BetterAuthOptions>;
5
- roles?: Record<string, Role>;
6
- }
7
- export declare const getAuthServerConfig: (config?: AuthServerConfig) => BetterAuthOptions;
@@ -1,54 +0,0 @@
1
- import { admin, jwt, username } from "better-auth/plugins";
2
- import { defaultRoles } from "better-auth/plugins/admin/access";
3
- import { tanstackStartCookies } from "better-auth/tanstack-start";
4
- import { surrealDbAdapter } from "./surrealDbAdapter/index.js";
5
- const baseUrl = "/";
6
- const getAuthServerConfig = (config)=>{
7
- const roles = config?.roles || defaultRoles;
8
- const betterAuthOptions = config?.betterAuthOptions;
9
- return {
10
- baseURL: baseUrl,
11
- secret: process.env.BETTER_AUTH_SECRET,
12
- database: surrealDbAdapter(),
13
- experimental: {
14
- joins: true
15
- },
16
- emailAndPassword: {
17
- enabled: true
18
- },
19
- ...betterAuthOptions,
20
- plugins: [
21
- admin({
22
- roles,
23
- bannedUserMessage: 'Доступ к приложению заблокирован. Обратитесь к администратору.'
24
- }),
25
- username(),
26
- ...betterAuthOptions?.plugins || [],
27
- jwt({
28
- jwks: {
29
- keyPairConfig: {
30
- alg: 'EdDSA',
31
- crv: 'Ed25519'
32
- }
33
- },
34
- jwt: {
35
- issuer: baseUrl,
36
- audience: baseUrl,
37
- expirationTime: '15m',
38
- definePayload: ({ user, session })=>({
39
- id: user.id,
40
- ns: process.env.SURREALDB_NAMESPACE || 'dev',
41
- db: process.env.SURREALDB_DATABASE || 'data',
42
- ac: 'better_auth_jwt',
43
- email: user.email,
44
- name: user.name,
45
- role: user.role,
46
- sessionId: session.id
47
- })
48
- }
49
- }),
50
- tanstackStartCookies()
51
- ]
52
- };
53
- };
54
- export { getAuthServerConfig };