deesse 0.1.7 → 0.1.9

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,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createAuthClient = void 0;
4
+ const react_1 = require("better-auth/react");
5
+ const createAuthClient = () => (0, react_1.createAuthClient)();
6
+ exports.createAuthClient = createAuthClient;
@@ -0,0 +1,337 @@
1
+ import { Pool } from "pg";
2
+ import { Config } from "../config/types";
3
+ export declare const createAuth: (config: Config) => import("better-auth").Auth<{
4
+ secret: string | undefined;
5
+ appName?: string | undefined;
6
+ baseURL?: string | undefined;
7
+ basePath?: string | undefined;
8
+ secondaryStorage?: import("better-auth").SecondaryStorage | undefined;
9
+ emailVerification?: {
10
+ sendVerificationEmail?: (data: {
11
+ user: import("better-auth").User;
12
+ url: string;
13
+ token: string;
14
+ }, request?: Request) => Promise<void>;
15
+ sendOnSignUp?: boolean;
16
+ sendOnSignIn?: boolean;
17
+ autoSignInAfterVerification?: boolean;
18
+ expiresIn?: number;
19
+ onEmailVerification?: (user: import("better-auth").User, request?: Request) => Promise<void>;
20
+ afterEmailVerification?: (user: import("better-auth").User, request?: Request) => Promise<void>;
21
+ } | undefined;
22
+ emailAndPassword?: {
23
+ enabled: boolean;
24
+ disableSignUp?: boolean;
25
+ requireEmailVerification?: boolean;
26
+ maxPasswordLength?: number;
27
+ minPasswordLength?: number;
28
+ sendResetPassword?: (data: {
29
+ user: import("better-auth").User;
30
+ url: string;
31
+ token: string;
32
+ }, request?: Request) => Promise<void>;
33
+ resetPasswordTokenExpiresIn?: number;
34
+ onPasswordReset?: (data: {
35
+ user: import("better-auth").User;
36
+ }, request?: Request) => Promise<void>;
37
+ password?: {
38
+ hash?: (password: string) => Promise<string>;
39
+ verify?: (data: {
40
+ hash: string;
41
+ password: string;
42
+ }) => Promise<boolean>;
43
+ };
44
+ autoSignIn?: boolean;
45
+ revokeSessionsOnPasswordReset?: boolean;
46
+ } | undefined;
47
+ socialProviders?: import("@better-auth/core/dist/index-CVLGS-cz.mjs").w | undefined;
48
+ plugins?: ([] | import("better-auth").BetterAuthPlugin[]) | undefined;
49
+ user?: {
50
+ modelName?: string;
51
+ fields?: Partial<Record<"email" | "createdAt" | "updatedAt" | "emailVerified" | "name" | "image", string>>;
52
+ additionalFields?: {
53
+ [key: string]: import("better-auth").DBFieldAttribute;
54
+ };
55
+ changeEmail?: {
56
+ enabled: boolean;
57
+ sendChangeEmailVerification?: (data: {
58
+ user: import("better-auth").User;
59
+ newEmail: string;
60
+ url: string;
61
+ token: string;
62
+ }, request?: Request) => Promise<void>;
63
+ sendChangeEmailConfirmation?: (data: {
64
+ user: import("better-auth").User;
65
+ newEmail: string;
66
+ url: string;
67
+ token: string;
68
+ }, request?: Request) => Promise<void>;
69
+ updateEmailWithoutVerification?: boolean;
70
+ };
71
+ deleteUser?: {
72
+ enabled?: boolean;
73
+ sendDeleteAccountVerification?: (data: {
74
+ user: import("better-auth").User;
75
+ url: string;
76
+ token: string;
77
+ }, request?: Request) => Promise<void>;
78
+ beforeDelete?: (user: import("better-auth").User, request?: Request) => Promise<void>;
79
+ afterDelete?: (user: import("better-auth").User, request?: Request) => Promise<void>;
80
+ deleteTokenExpiresIn?: number;
81
+ };
82
+ } | undefined;
83
+ session?: {
84
+ modelName?: string;
85
+ fields?: Partial<Record<"createdAt" | "updatedAt" | "userId" | "expiresAt" | "token" | "ipAddress" | "userAgent", string>>;
86
+ expiresIn?: number;
87
+ updateAge?: number;
88
+ disableSessionRefresh?: boolean;
89
+ additionalFields?: {
90
+ [key: string]: import("better-auth").DBFieldAttribute;
91
+ };
92
+ storeSessionInDatabase?: boolean;
93
+ preserveSessionInDatabase?: boolean;
94
+ cookieCache?: {
95
+ maxAge?: number;
96
+ enabled?: boolean;
97
+ strategy?: "compact" | "jwt" | "jwe";
98
+ refreshCache?: boolean | {
99
+ updateAge?: number;
100
+ };
101
+ version?: string | ((session: import("better-auth").Session & Record<string, any>, user: import("better-auth").User & Record<string, any>) => string) | ((session: import("better-auth").Session & Record<string, any>, user: import("better-auth").User & Record<string, any>) => Promise<string>);
102
+ };
103
+ freshAge?: number;
104
+ } | undefined;
105
+ account?: {
106
+ modelName?: string;
107
+ fields?: Partial<Record<"createdAt" | "updatedAt" | "userId" | "refreshToken" | "idToken" | "accessToken" | "password" | "providerId" | "accountId" | "accessTokenExpiresAt" | "refreshTokenExpiresAt" | "scope", string>>;
108
+ additionalFields?: {
109
+ [key: string]: import("better-auth").DBFieldAttribute;
110
+ };
111
+ updateAccountOnSignIn?: boolean;
112
+ accountLinking?: {
113
+ enabled?: boolean;
114
+ trustedProviders?: Array<import("better-auth").LiteralUnion<import("@better-auth/core/dist/index-CVLGS-cz.mjs").S[number] | "email-password", string>>;
115
+ allowDifferentEmails?: boolean;
116
+ allowUnlinkingAll?: boolean;
117
+ updateUserInfoOnLink?: boolean;
118
+ };
119
+ encryptOAuthTokens?: boolean;
120
+ skipStateCookieCheck?: boolean;
121
+ storeStateStrategy?: "database" | "cookie";
122
+ storeAccountCookie?: boolean;
123
+ } | undefined;
124
+ verification?: {
125
+ modelName?: string;
126
+ fields?: Partial<Record<"createdAt" | "updatedAt" | "expiresAt" | "value" | "identifier", string>>;
127
+ disableCleanup?: boolean;
128
+ } | undefined;
129
+ trustedOrigins?: (string[] | ((request: Request) => string[] | Promise<string[]>)) | undefined;
130
+ rateLimit?: import("better-auth").BetterAuthRateLimitOptions | undefined;
131
+ advanced?: import("better-auth").BetterAuthAdvancedOptions | undefined;
132
+ logger?: import("better-auth").Logger | undefined;
133
+ databaseHooks?: {
134
+ user?: {
135
+ create?: {
136
+ before?: (user: import("better-auth").User & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void | {
137
+ data: {
138
+ id?: string | undefined;
139
+ createdAt?: Date | undefined;
140
+ updatedAt?: Date | undefined;
141
+ email?: string | undefined;
142
+ emailVerified?: boolean | undefined;
143
+ name?: string | undefined;
144
+ image?: string | null | undefined;
145
+ } & Record<string, any>;
146
+ }>;
147
+ after?: (user: import("better-auth").User & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
148
+ };
149
+ update?: {
150
+ before?: (user: Partial<import("better-auth").User> & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void | {
151
+ data: {
152
+ [x: string]: any;
153
+ id?: string | undefined;
154
+ createdAt?: Date | undefined;
155
+ updatedAt?: Date | undefined;
156
+ email?: string | undefined;
157
+ emailVerified?: boolean | undefined;
158
+ name?: string | undefined;
159
+ image?: string | null | undefined;
160
+ };
161
+ }>;
162
+ after?: (user: import("better-auth").User & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
163
+ };
164
+ delete?: {
165
+ before?: (user: import("better-auth").User & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void>;
166
+ after?: (user: import("better-auth").User & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
167
+ };
168
+ };
169
+ session?: {
170
+ create?: {
171
+ before?: (session: import("better-auth").Session & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void | {
172
+ data: {
173
+ id?: string | undefined;
174
+ createdAt?: Date | undefined;
175
+ updatedAt?: Date | undefined;
176
+ userId?: string | undefined;
177
+ expiresAt?: Date | undefined;
178
+ token?: string | undefined;
179
+ ipAddress?: string | null | undefined;
180
+ userAgent?: string | null | undefined;
181
+ } & Record<string, any>;
182
+ }>;
183
+ after?: (session: import("better-auth").Session & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
184
+ };
185
+ update?: {
186
+ before?: (session: Partial<import("better-auth").Session> & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void | {
187
+ data: {
188
+ [x: string]: any;
189
+ id?: string | undefined;
190
+ createdAt?: Date | undefined;
191
+ updatedAt?: Date | undefined;
192
+ userId?: string | undefined;
193
+ expiresAt?: Date | undefined;
194
+ token?: string | undefined;
195
+ ipAddress?: string | null | undefined;
196
+ userAgent?: string | null | undefined;
197
+ };
198
+ }>;
199
+ after?: (session: import("better-auth").Session & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
200
+ };
201
+ delete?: {
202
+ before?: (session: import("better-auth").Session & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void>;
203
+ after?: (session: import("better-auth").Session & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
204
+ };
205
+ };
206
+ account?: {
207
+ create?: {
208
+ before?: (account: import("better-auth").Account, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void | {
209
+ data: {
210
+ id?: string | undefined;
211
+ createdAt?: Date | undefined;
212
+ updatedAt?: Date | undefined;
213
+ providerId?: string | undefined;
214
+ accountId?: string | undefined;
215
+ userId?: string | undefined;
216
+ accessToken?: string | null | undefined;
217
+ refreshToken?: string | null | undefined;
218
+ idToken?: string | null | undefined;
219
+ accessTokenExpiresAt?: Date | null | undefined;
220
+ refreshTokenExpiresAt?: Date | null | undefined;
221
+ scope?: string | null | undefined;
222
+ password?: string | null | undefined;
223
+ } & Record<string, any>;
224
+ }>;
225
+ after?: (account: import("better-auth").Account, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
226
+ };
227
+ update?: {
228
+ before?: (account: Partial<import("better-auth").Account> & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void | {
229
+ data: {
230
+ [x: string]: any;
231
+ id?: string | undefined;
232
+ createdAt?: Date | undefined;
233
+ updatedAt?: Date | undefined;
234
+ providerId?: string | undefined;
235
+ accountId?: string | undefined;
236
+ userId?: string | undefined;
237
+ accessToken?: string | null | undefined;
238
+ refreshToken?: string | null | undefined;
239
+ idToken?: string | null | undefined;
240
+ accessTokenExpiresAt?: Date | null | undefined;
241
+ refreshTokenExpiresAt?: Date | null | undefined;
242
+ scope?: string | null | undefined;
243
+ password?: string | null | undefined;
244
+ };
245
+ }>;
246
+ after?: (account: import("better-auth").Account & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
247
+ };
248
+ delete?: {
249
+ before?: (account: import("better-auth").Account & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void>;
250
+ after?: (account: import("better-auth").Account & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
251
+ };
252
+ };
253
+ verification?: {
254
+ create?: {
255
+ before?: (verification: import("better-auth").Verification & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void | {
256
+ data: {
257
+ id?: string | undefined;
258
+ createdAt?: Date | undefined;
259
+ updatedAt?: Date | undefined;
260
+ value?: string | undefined;
261
+ expiresAt?: Date | undefined;
262
+ identifier?: string | undefined;
263
+ } & Record<string, any>;
264
+ }>;
265
+ after?: (verification: import("better-auth").Verification & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
266
+ };
267
+ update?: {
268
+ before?: (verification: Partial<import("better-auth").Verification> & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void | {
269
+ data: {
270
+ [x: string]: any;
271
+ id?: string | undefined;
272
+ createdAt?: Date | undefined;
273
+ updatedAt?: Date | undefined;
274
+ value?: string | undefined;
275
+ expiresAt?: Date | undefined;
276
+ identifier?: string | undefined;
277
+ };
278
+ }>;
279
+ after?: (verification: import("better-auth").Verification & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
280
+ };
281
+ delete?: {
282
+ before?: (verification: import("better-auth").Verification & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<boolean | void>;
283
+ after?: (verification: import("better-auth").Verification & Record<string, unknown>, context?: import("better-auth").GenericEndpointContext) => Promise<void>;
284
+ };
285
+ };
286
+ } | undefined;
287
+ onAPIError?: {
288
+ throw?: boolean;
289
+ onError?: (error: unknown, ctx: import("better-auth").AuthContext) => void | Promise<void>;
290
+ errorURL?: string;
291
+ customizeDefaultErrorPage?: {
292
+ colors?: {
293
+ background?: string;
294
+ foreground?: string;
295
+ primary?: string;
296
+ primaryForeground?: string;
297
+ mutedForeground?: string;
298
+ border?: string;
299
+ destructive?: string;
300
+ titleBorder?: string;
301
+ titleColor?: string;
302
+ gridColor?: string;
303
+ cardBackground?: string;
304
+ cornerBorder?: string;
305
+ };
306
+ size?: {
307
+ radiusSm?: string;
308
+ radiusMd?: string;
309
+ radiusLg?: string;
310
+ textSm?: string;
311
+ text2xl?: string;
312
+ text4xl?: string;
313
+ text6xl?: string;
314
+ };
315
+ font?: {
316
+ defaultFamily?: string;
317
+ monoFamily?: string;
318
+ };
319
+ disableTitleBorder?: boolean;
320
+ disableCornerDecorations?: boolean;
321
+ disableBackgroundGrid?: boolean;
322
+ };
323
+ } | undefined;
324
+ hooks?: {
325
+ before?: import("@better-auth/core/api").AuthMiddleware;
326
+ after?: import("@better-auth/core/api").AuthMiddleware;
327
+ } | undefined;
328
+ disabledPaths?: string[] | undefined;
329
+ telemetry?: {
330
+ enabled?: boolean;
331
+ debug?: boolean;
332
+ } | undefined;
333
+ experimental?: {
334
+ joins?: boolean;
335
+ };
336
+ database: Pool;
337
+ }>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createAuth = void 0;
4
+ const better_auth_1 = require("better-auth");
5
+ const pg_1 = require("pg");
6
+ const createAuth = (config) => (0, better_auth_1.betterAuth)({
7
+ database: new pg_1.Pool({
8
+ connectionString: config.databaseUrl,
9
+ }),
10
+ ...config.auth,
11
+ secret: process.env.DEESSE_SECRET,
12
+ });
13
+ exports.createAuth = createAuth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deesse",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "The fullstack web framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,6 +10,13 @@
10
10
  "README.md",
11
11
  "LICENSE"
12
12
  ],
13
+ "exports": {
14
+ "./auth/react": {
15
+ "import": "./dist/auth/react/index.esm.js",
16
+ "require": "./dist/auth/react/index.js",
17
+ "types": "./dist/auth/react/index.d.ts"
18
+ }
19
+ },
13
20
  "scripts": {
14
21
  "build": "tsc",
15
22
  "build:watch": "tsc --watch",