wcz-test 6.5.1 → 6.5.3
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/client-utils.d.ts +30 -31
- package/dist/server-utils.d.ts +35 -1
- package/dist/server-utils.js +77 -0
- package/dist/server-utils.js.map +1 -1
- package/package.json +1 -1
package/dist/client-utils.d.ts
CHANGED
|
@@ -3,8 +3,7 @@ export { default as i18n, t } from 'i18next';
|
|
|
3
3
|
export { initReactI18next, useTranslation } from 'react-i18next';
|
|
4
4
|
export { default as LanguageDetector } from 'i18next-browser-languagedetector';
|
|
5
5
|
import * as nanostores from 'nanostores';
|
|
6
|
-
import * as
|
|
7
|
-
import * as node_modules_better_auth_dist_shared_better_auth_DNnBkMGu from 'node_modules/better-auth/dist/shared/better-auth.DNnBkMGu';
|
|
6
|
+
import * as better_auth from 'better-auth';
|
|
8
7
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
9
8
|
import 'axios';
|
|
10
9
|
import 'uuidv7';
|
|
@@ -84,7 +83,7 @@ declare const authClient: {
|
|
|
84
83
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
85
84
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
86
85
|
disableValidation?: boolean | undefined;
|
|
87
|
-
}>(data_0:
|
|
86
|
+
}>(data_0: better_auth.Prettify<{
|
|
88
87
|
provider: unknown;
|
|
89
88
|
callbackURL?: string | undefined;
|
|
90
89
|
newUserCallbackURL?: string | undefined;
|
|
@@ -177,7 +176,7 @@ declare const authClient: {
|
|
|
177
176
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
178
177
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
179
178
|
disableValidation?: boolean | undefined;
|
|
180
|
-
}>(data_0?:
|
|
179
|
+
}>(data_0?: better_auth.Prettify<{
|
|
181
180
|
query?: Record<string, any> | undefined;
|
|
182
181
|
fetchOptions?: FetchOptions | undefined;
|
|
183
182
|
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
@@ -248,7 +247,7 @@ declare const authClient: {
|
|
|
248
247
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
249
248
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
250
249
|
disableValidation?: boolean | undefined;
|
|
251
|
-
}>(data_0:
|
|
250
|
+
}>(data_0: better_auth.Prettify<{
|
|
252
251
|
email: string;
|
|
253
252
|
name: string;
|
|
254
253
|
password: string;
|
|
@@ -342,7 +341,7 @@ declare const authClient: {
|
|
|
342
341
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
343
342
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
344
343
|
disableValidation?: boolean | undefined;
|
|
345
|
-
}>(data_0:
|
|
344
|
+
}>(data_0: better_auth.Prettify<{
|
|
346
345
|
email: string;
|
|
347
346
|
password: string;
|
|
348
347
|
callbackURL?: string | undefined;
|
|
@@ -424,7 +423,7 @@ declare const authClient: {
|
|
|
424
423
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
425
424
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
426
425
|
disableValidation?: boolean | undefined;
|
|
427
|
-
}>(data_0:
|
|
426
|
+
}>(data_0: better_auth.Prettify<{
|
|
428
427
|
email: string;
|
|
429
428
|
redirectTo?: string | undefined;
|
|
430
429
|
} & {
|
|
@@ -494,7 +493,7 @@ declare const authClient: {
|
|
|
494
493
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
495
494
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
496
495
|
disableValidation?: boolean | undefined;
|
|
497
|
-
}>(data_0:
|
|
496
|
+
}>(data_0: better_auth.Prettify<{
|
|
498
497
|
newPassword: string;
|
|
499
498
|
token?: string | undefined;
|
|
500
499
|
} & {
|
|
@@ -562,7 +561,7 @@ declare const authClient: {
|
|
|
562
561
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
563
562
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
564
563
|
disableValidation?: boolean | undefined;
|
|
565
|
-
}>(data_0:
|
|
564
|
+
}>(data_0: better_auth.Prettify<{
|
|
566
565
|
query: {
|
|
567
566
|
token: string;
|
|
568
567
|
callbackURL?: string | undefined;
|
|
@@ -643,7 +642,7 @@ declare const authClient: {
|
|
|
643
642
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
644
643
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
645
644
|
disableValidation?: boolean | undefined;
|
|
646
|
-
}>(data_0:
|
|
645
|
+
}>(data_0: better_auth.Prettify<{
|
|
647
646
|
email: string;
|
|
648
647
|
callbackURL?: string | undefined;
|
|
649
648
|
} & {
|
|
@@ -711,7 +710,7 @@ declare const authClient: {
|
|
|
711
710
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
712
711
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
713
712
|
disableValidation?: boolean | undefined;
|
|
714
|
-
}>(data_0:
|
|
713
|
+
}>(data_0: better_auth.Prettify<{
|
|
715
714
|
newEmail: string;
|
|
716
715
|
callbackURL?: string | undefined;
|
|
717
716
|
} & {
|
|
@@ -780,7 +779,7 @@ declare const authClient: {
|
|
|
780
779
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
781
780
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
782
781
|
disableValidation?: boolean | undefined;
|
|
783
|
-
}>(data_0:
|
|
782
|
+
}>(data_0: better_auth.Prettify<{
|
|
784
783
|
newPassword: string;
|
|
785
784
|
currentPassword: string;
|
|
786
785
|
revokeOtherSessions?: boolean | undefined;
|
|
@@ -858,7 +857,7 @@ declare const authClient: {
|
|
|
858
857
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
859
858
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
860
859
|
disableValidation?: boolean | undefined;
|
|
861
|
-
}>(data_0?:
|
|
860
|
+
}>(data_0?: better_auth.Prettify<{
|
|
862
861
|
image?: string | null;
|
|
863
862
|
name?: string;
|
|
864
863
|
fetchOptions?: FetchOptions | undefined;
|
|
@@ -926,7 +925,7 @@ declare const authClient: {
|
|
|
926
925
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
927
926
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
928
927
|
disableValidation?: boolean | undefined;
|
|
929
|
-
}>(data_0?:
|
|
928
|
+
}>(data_0?: better_auth.Prettify<{
|
|
930
929
|
callbackURL?: string | undefined;
|
|
931
930
|
password?: string | undefined;
|
|
932
931
|
token?: string | undefined;
|
|
@@ -998,7 +997,7 @@ declare const authClient: {
|
|
|
998
997
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
999
998
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1000
999
|
disableValidation?: boolean | undefined;
|
|
1001
|
-
}>(data_0:
|
|
1000
|
+
}>(data_0: better_auth.Prettify<{
|
|
1002
1001
|
query: {
|
|
1003
1002
|
callbackURL: string;
|
|
1004
1003
|
};
|
|
@@ -1065,7 +1064,7 @@ declare const authClient: {
|
|
|
1065
1064
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1066
1065
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1067
1066
|
disableValidation?: boolean | undefined;
|
|
1068
|
-
}>(data_0:
|
|
1067
|
+
}>(data_0: better_auth.Prettify<{
|
|
1069
1068
|
email: string;
|
|
1070
1069
|
redirectTo?: string | undefined;
|
|
1071
1070
|
} & {
|
|
@@ -1136,7 +1135,7 @@ declare const authClient: {
|
|
|
1136
1135
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1137
1136
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1138
1137
|
disableValidation?: boolean | undefined;
|
|
1139
|
-
}>(data_0:
|
|
1138
|
+
}>(data_0: better_auth.Prettify<{
|
|
1140
1139
|
query: {
|
|
1141
1140
|
callbackURL: string;
|
|
1142
1141
|
};
|
|
@@ -1200,10 +1199,10 @@ declare const authClient: {
|
|
|
1200
1199
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1201
1200
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1202
1201
|
disableValidation?: boolean | undefined;
|
|
1203
|
-
}>(data_0?:
|
|
1202
|
+
}>(data_0?: better_auth.Prettify<{
|
|
1204
1203
|
query?: Record<string, any> | undefined;
|
|
1205
1204
|
fetchOptions?: FetchOptions | undefined;
|
|
1206
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<
|
|
1205
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<better_auth.Prettify<{
|
|
1207
1206
|
id: string;
|
|
1208
1207
|
createdAt: Date;
|
|
1209
1208
|
updatedAt: Date;
|
|
@@ -1272,7 +1271,7 @@ declare const authClient: {
|
|
|
1272
1271
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1273
1272
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1274
1273
|
disableValidation?: boolean | undefined;
|
|
1275
|
-
}>(data_0:
|
|
1274
|
+
}>(data_0: better_auth.Prettify<{
|
|
1276
1275
|
token: string;
|
|
1277
1276
|
} & {
|
|
1278
1277
|
fetchOptions?: FetchOptions | undefined;
|
|
@@ -1336,7 +1335,7 @@ declare const authClient: {
|
|
|
1336
1335
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1337
1336
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1338
1337
|
disableValidation?: boolean | undefined;
|
|
1339
|
-
}>(data_0?:
|
|
1338
|
+
}>(data_0?: better_auth.Prettify<{
|
|
1340
1339
|
query?: Record<string, any> | undefined;
|
|
1341
1340
|
fetchOptions?: FetchOptions | undefined;
|
|
1342
1341
|
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
@@ -1399,7 +1398,7 @@ declare const authClient: {
|
|
|
1399
1398
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1400
1399
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1401
1400
|
disableValidation?: boolean | undefined;
|
|
1402
|
-
}>(data_0?:
|
|
1401
|
+
}>(data_0?: better_auth.Prettify<{
|
|
1403
1402
|
query?: Record<string, any> | undefined;
|
|
1404
1403
|
fetchOptions?: FetchOptions | undefined;
|
|
1405
1404
|
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
@@ -1476,7 +1475,7 @@ declare const authClient: {
|
|
|
1476
1475
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1477
1476
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1478
1477
|
disableValidation?: boolean | undefined;
|
|
1479
|
-
}>(data_0:
|
|
1478
|
+
}>(data_0: better_auth.Prettify<{
|
|
1480
1479
|
provider: unknown;
|
|
1481
1480
|
callbackURL?: string | undefined;
|
|
1482
1481
|
idToken?: {
|
|
@@ -1553,7 +1552,7 @@ declare const authClient: {
|
|
|
1553
1552
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1554
1553
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1555
1554
|
disableValidation?: boolean | undefined;
|
|
1556
|
-
}>(data_0?:
|
|
1555
|
+
}>(data_0?: better_auth.Prettify<{
|
|
1557
1556
|
query?: Record<string, any> | undefined;
|
|
1558
1557
|
fetchOptions?: FetchOptions | undefined;
|
|
1559
1558
|
}> | undefined, data_1?: FetchOptions | undefined) => Promise<_better_fetch_fetch.BetterFetchResponse<{
|
|
@@ -1625,7 +1624,7 @@ declare const authClient: {
|
|
|
1625
1624
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1626
1625
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1627
1626
|
disableValidation?: boolean | undefined;
|
|
1628
|
-
}>(data_0:
|
|
1627
|
+
}>(data_0: better_auth.Prettify<{
|
|
1629
1628
|
query: {
|
|
1630
1629
|
token: string;
|
|
1631
1630
|
callbackURL?: string | undefined;
|
|
@@ -1696,7 +1695,7 @@ declare const authClient: {
|
|
|
1696
1695
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1697
1696
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1698
1697
|
disableValidation?: boolean | undefined;
|
|
1699
|
-
}>(data_0:
|
|
1698
|
+
}>(data_0: better_auth.Prettify<{
|
|
1700
1699
|
providerId: string;
|
|
1701
1700
|
accountId?: string | undefined;
|
|
1702
1701
|
} & {
|
|
@@ -1765,7 +1764,7 @@ declare const authClient: {
|
|
|
1765
1764
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1766
1765
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1767
1766
|
disableValidation?: boolean | undefined;
|
|
1768
|
-
}>(data_0:
|
|
1767
|
+
}>(data_0: better_auth.Prettify<{
|
|
1769
1768
|
providerId: string;
|
|
1770
1769
|
accountId?: string | undefined;
|
|
1771
1770
|
userId?: string | undefined;
|
|
@@ -1833,7 +1832,7 @@ declare const authClient: {
|
|
|
1833
1832
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1834
1833
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1835
1834
|
disableValidation?: boolean | undefined;
|
|
1836
|
-
}>(data_0:
|
|
1835
|
+
}>(data_0: better_auth.Prettify<{
|
|
1837
1836
|
providerId: string;
|
|
1838
1837
|
accountId?: string | undefined;
|
|
1839
1838
|
userId?: string | undefined;
|
|
@@ -1904,7 +1903,7 @@ declare const authClient: {
|
|
|
1904
1903
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1905
1904
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1906
1905
|
disableValidation?: boolean | undefined;
|
|
1907
|
-
}>(data_0:
|
|
1906
|
+
}>(data_0: better_auth.Prettify<{
|
|
1908
1907
|
accountId: string;
|
|
1909
1908
|
} & {
|
|
1910
1909
|
fetchOptions?: FetchOptions | undefined;
|
|
@@ -1972,7 +1971,7 @@ declare const authClient: {
|
|
|
1972
1971
|
output?: (_better_fetch_fetch.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1973
1972
|
errorSchema?: _better_fetch_fetch.StandardSchemaV1 | undefined;
|
|
1974
1973
|
disableValidation?: boolean | undefined;
|
|
1975
|
-
}>(data_0?:
|
|
1974
|
+
}>(data_0?: better_auth.Prettify<{
|
|
1976
1975
|
query?: {
|
|
1977
1976
|
disableCookieCache?: unknown;
|
|
1978
1977
|
disableRefresh?: unknown;
|
|
@@ -2029,7 +2028,7 @@ declare const authClient: {
|
|
|
2029
2028
|
isRefetching: boolean;
|
|
2030
2029
|
error: _better_fetch_fetch.BetterFetchError | null;
|
|
2031
2030
|
refetch: (queryParams?: {
|
|
2032
|
-
query?:
|
|
2031
|
+
query?: better_auth.SessionQueryParams;
|
|
2033
2032
|
}) => void;
|
|
2034
2033
|
};
|
|
2035
2034
|
$Infer: {
|
package/dist/server-utils.d.ts
CHANGED
|
@@ -1,9 +1,43 @@
|
|
|
1
1
|
import { Pool } from 'pg';
|
|
2
2
|
export { Pool } from 'pg';
|
|
3
3
|
import * as drizzle_orm_node_postgres from 'drizzle-orm/node-postgres';
|
|
4
|
+
import * as better_call from 'better-call';
|
|
5
|
+
import * as better_auth_adapters from 'better-auth/adapters';
|
|
6
|
+
import * as better_auth from 'better-auth';
|
|
4
7
|
|
|
5
8
|
declare const db: drizzle_orm_node_postgres.NodePgDatabase<Record<string, never>> & {
|
|
6
9
|
$client: Pool;
|
|
7
10
|
};
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
declare const auth: better_auth.Auth<{
|
|
13
|
+
database: (options: better_auth.BetterAuthOptions) => better_auth_adapters.DBAdapter<better_auth.BetterAuthOptions>;
|
|
14
|
+
session: {
|
|
15
|
+
cookieCache: {
|
|
16
|
+
enabled: true;
|
|
17
|
+
maxAge: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
socialProviders: {
|
|
21
|
+
microsoft: {
|
|
22
|
+
clientId: string;
|
|
23
|
+
clientSecret: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
plugins: [{
|
|
27
|
+
id: "react-start-cookies";
|
|
28
|
+
hooks: {
|
|
29
|
+
after: {
|
|
30
|
+
matcher(ctx: better_call.EndpointContext<string, any> & Omit<better_call.InputContext<string, any>, "method"> & {
|
|
31
|
+
context: better_auth.AuthContext & {
|
|
32
|
+
returned?: unknown;
|
|
33
|
+
responseHeaders?: Headers;
|
|
34
|
+
};
|
|
35
|
+
headers?: Headers;
|
|
36
|
+
}): true;
|
|
37
|
+
handler: (inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<void>;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
}];
|
|
41
|
+
}>;
|
|
42
|
+
|
|
43
|
+
export { auth, db };
|
package/dist/server-utils.js
CHANGED
|
@@ -13,8 +13,85 @@ var pool = new Pool({
|
|
|
13
13
|
connectionString: serverEnv.DATABASE_URL
|
|
14
14
|
});
|
|
15
15
|
var db = drizzle(pool);
|
|
16
|
+
|
|
17
|
+
// src/lib/auth/auth.ts
|
|
18
|
+
import { betterAuth } from "better-auth";
|
|
19
|
+
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
20
|
+
import { reactStartCookies } from "better-auth/react-start";
|
|
21
|
+
|
|
22
|
+
// src/lib/db/schema/auth.ts
|
|
23
|
+
import { boolean, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
24
|
+
var user = pgTable("user", {
|
|
25
|
+
id: text("id").primaryKey(),
|
|
26
|
+
name: text("name").notNull(),
|
|
27
|
+
email: text("email").notNull().unique(),
|
|
28
|
+
emailVerified: boolean("email_verified").default(false).notNull(),
|
|
29
|
+
image: text("image"),
|
|
30
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
31
|
+
updatedAt: timestamp("updated_at").defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
|
|
32
|
+
});
|
|
33
|
+
var session = pgTable("session", {
|
|
34
|
+
id: text("id").primaryKey(),
|
|
35
|
+
expiresAt: timestamp("expires_at").notNull(),
|
|
36
|
+
token: text("token").notNull().unique(),
|
|
37
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
38
|
+
updatedAt: timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull(),
|
|
39
|
+
ipAddress: text("ip_address"),
|
|
40
|
+
userAgent: text("user_agent"),
|
|
41
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" })
|
|
42
|
+
});
|
|
43
|
+
var account = pgTable("account", {
|
|
44
|
+
id: text("id").primaryKey(),
|
|
45
|
+
accountId: text("account_id").notNull(),
|
|
46
|
+
providerId: text("provider_id").notNull(),
|
|
47
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
48
|
+
accessToken: text("access_token"),
|
|
49
|
+
refreshToken: text("refresh_token"),
|
|
50
|
+
idToken: text("id_token"),
|
|
51
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
|
52
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
|
53
|
+
scope: text("scope"),
|
|
54
|
+
password: text("password"),
|
|
55
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
56
|
+
updatedAt: timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
|
|
57
|
+
});
|
|
58
|
+
var verification = pgTable("verification", {
|
|
59
|
+
id: text("id").primaryKey(),
|
|
60
|
+
identifier: text("identifier").notNull(),
|
|
61
|
+
value: text("value").notNull(),
|
|
62
|
+
expiresAt: timestamp("expires_at").notNull(),
|
|
63
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
64
|
+
updatedAt: timestamp("updated_at").defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// src/lib/auth/auth.ts
|
|
68
|
+
var auth = betterAuth({
|
|
69
|
+
database: drizzleAdapter(db, {
|
|
70
|
+
provider: "pg",
|
|
71
|
+
schema: {
|
|
72
|
+
user,
|
|
73
|
+
session,
|
|
74
|
+
account,
|
|
75
|
+
verification
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
session: {
|
|
79
|
+
cookieCache: {
|
|
80
|
+
enabled: true,
|
|
81
|
+
maxAge: 5 * 60
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
socialProviders: {
|
|
85
|
+
microsoft: {
|
|
86
|
+
clientId: serverEnv.MICROSOFT_CLIENT_ID,
|
|
87
|
+
clientSecret: serverEnv.MICROSOFT_CLIENT_SECRET
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
plugins: [reactStartCookies()]
|
|
91
|
+
});
|
|
16
92
|
export {
|
|
17
93
|
Pool2 as Pool,
|
|
94
|
+
auth,
|
|
18
95
|
db
|
|
19
96
|
};
|
|
20
97
|
//# sourceMappingURL=server-utils.js.map
|
package/dist/server-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server-utils.ts","../src/lib/db/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/server-utils.ts","../src/lib/db/index.ts","../src/lib/auth/auth.ts","../src/lib/db/schema/auth.ts"],"sourcesContent":["export { Pool } from \"pg\";\r\nexport { db } from \"./lib/db/index\";\r\nexport { auth } from \"./lib/auth/auth\";\r\n","import { drizzle } from \"drizzle-orm/node-postgres\";\r\nimport { Pool } from \"pg\";\r\nimport { serverEnv } from \"~/env\";\r\n\r\nconst pool: Pool = new Pool({\r\n connectionString: serverEnv.DATABASE_URL,\r\n});\r\n\r\nexport const db = drizzle(pool);","import { betterAuth } from \"better-auth\";\r\nimport { drizzleAdapter } from \"better-auth/adapters/drizzle\";\r\nimport { reactStartCookies } from \"better-auth/react-start\";\r\nimport { db } from \"../db\";\r\nimport { account, session, user, verification } from \"../db/schema/auth\";\r\nimport { serverEnv } from \"~/env\";\r\n\r\nexport const auth = betterAuth({\r\n database: drizzleAdapter(db, {\r\n provider: \"pg\",\r\n schema: {\r\n user,\r\n session,\r\n account,\r\n verification\r\n }\r\n }),\r\n session: {\r\n cookieCache: {\r\n enabled: true,\r\n maxAge: 5 * 60,\r\n },\r\n },\r\n socialProviders: {\r\n microsoft: {\r\n clientId: serverEnv.MICROSOFT_CLIENT_ID,\r\n clientSecret: serverEnv.MICROSOFT_CLIENT_SECRET\r\n }\r\n },\r\n plugins: [reactStartCookies()]\r\n});\r\n","import { boolean, pgTable, text, timestamp } from \"drizzle-orm/pg-core\";\n\nexport const user = pgTable(\"user\", {\n id: text(\"id\").primaryKey(),\n name: text(\"name\").notNull(),\n email: text(\"email\").notNull().unique(),\n emailVerified: boolean(\"email_verified\").default(false).notNull(),\n image: text(\"image\"),\n createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n updatedAt: timestamp(\"updated_at\")\n .defaultNow()\n .$onUpdate(() => /* @__PURE__ */ new Date())\n .notNull(),\n});\n\nexport const session = pgTable(\"session\", {\n id: text(\"id\").primaryKey(),\n expiresAt: timestamp(\"expires_at\").notNull(),\n token: text(\"token\").notNull().unique(),\n createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n updatedAt: timestamp(\"updated_at\")\n .$onUpdate(() => /* @__PURE__ */ new Date())\n .notNull(),\n ipAddress: text(\"ip_address\"),\n userAgent: text(\"user_agent\"),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n});\n\nexport const account = pgTable(\"account\", {\n id: text(\"id\").primaryKey(),\n accountId: text(\"account_id\").notNull(),\n providerId: text(\"provider_id\").notNull(),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n accessToken: text(\"access_token\"),\n refreshToken: text(\"refresh_token\"),\n idToken: text(\"id_token\"),\n accessTokenExpiresAt: timestamp(\"access_token_expires_at\"),\n refreshTokenExpiresAt: timestamp(\"refresh_token_expires_at\"),\n scope: text(\"scope\"),\n password: text(\"password\"),\n createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n updatedAt: timestamp(\"updated_at\")\n .$onUpdate(() => /* @__PURE__ */ new Date())\n .notNull(),\n});\n\nexport const verification = pgTable(\"verification\", {\n id: text(\"id\").primaryKey(),\n identifier: text(\"identifier\").notNull(),\n value: text(\"value\").notNull(),\n expiresAt: timestamp(\"expires_at\").notNull(),\n createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n updatedAt: timestamp(\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