create-launchrail 0.0.0-stage → 0.3.1
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/README.md +39 -2
- package/THIRD_PARTY_LICENSES +43 -0
- package/bin/create-launchrail.mjs +75 -0
- package/bin/project-directory.mjs +7 -0
- package/bin/scaffold.mjs +217 -0
- package/bin/tools.mjs +62 -0
- package/bin/versions.mjs +118 -0
- package/package.json +23 -4
- package/presets/headless/web/ui/button.tsx +16 -0
- package/presets/headless/web/ui/card.tsx +25 -0
- package/template/AGENTS.md +3 -0
- package/template/README.md +3 -0
- package/template/THIRD_PARTY_LICENSES +43 -0
- package/template/apps/mobile/AGENTS.md +11 -0
- package/template/apps/mobile/App.tsx +511 -0
- package/template/apps/mobile/app.json +14 -0
- package/template/apps/mobile/components.json +22 -0
- package/template/apps/mobile/global.css +54 -0
- package/template/apps/mobile/index.ts +4 -0
- package/template/apps/mobile/metro.config.js +7 -0
- package/template/apps/mobile/package.json +47 -0
- package/template/apps/mobile/src/auth.ts +19 -0
- package/template/apps/mobile/src/components/native-controls.tsx +12 -0
- package/template/apps/mobile/src/components/ui/button.tsx +108 -0
- package/template/apps/mobile/src/components/ui/card.tsx +66 -0
- package/template/apps/mobile/src/components/ui/input.tsx +33 -0
- package/template/apps/mobile/src/components/ui/text.tsx +89 -0
- package/template/apps/mobile/src/css.d.ts +1 -0
- package/template/apps/mobile/src/lib/utils.ts +6 -0
- package/template/apps/mobile/src/query.tsx +16 -0
- package/template/apps/mobile/src/server-url.ts +20 -0
- package/template/apps/mobile/src/trpc.tsx +47 -0
- package/template/apps/mobile/src/uniwind-types.d.ts +7 -0
- package/template/apps/mobile/tsconfig.json +21 -0
- package/template/apps/web/components.json +15 -0
- package/template/apps/web/drizzle/0000_auth.sql +53 -0
- package/template/apps/web/drizzle/meta/0000_snapshot.json +374 -0
- package/template/apps/web/drizzle/meta/_journal.json +13 -0
- package/template/apps/web/drizzle.config.ts +11 -0
- package/template/apps/web/next.config.ts +11 -0
- package/template/apps/web/package.json +48 -0
- package/template/apps/web/postcss.config.mjs +3 -0
- package/template/apps/web/src/app/api/auth/[...all]/route.ts +7 -0
- package/template/apps/web/src/app/api/trpc/[trpc]/route.ts +53 -0
- package/template/apps/web/src/app/globals.css +250 -0
- package/template/apps/web/src/app/layout.tsx +31 -0
- package/template/apps/web/src/app/page.tsx +35 -0
- package/template/apps/web/src/app/starter-demo.tsx +258 -0
- package/template/apps/web/src/components/ui/button.tsx +57 -0
- package/template/apps/web/src/components/ui/card.tsx +102 -0
- package/template/apps/web/src/lib/auth-client.ts +5 -0
- package/template/apps/web/src/lib/query.tsx +23 -0
- package/template/apps/web/src/lib/trpc.tsx +29 -0
- package/template/apps/web/src/lib/utils.ts +6 -0
- package/template/apps/web/src/server/auth.ts +44 -0
- package/template/apps/web/src/server/db.ts +38 -0
- package/template/apps/web/src/server/schema.ts +87 -0
- package/template/apps/web/tsconfig.json +31 -0
- package/template/compose.yaml +18 -0
- package/template/gitignore.template +32 -0
- package/template/package.json +22 -0
- package/template/packages/api/package.json +21 -0
- package/template/packages/api/src/hello.ts +5 -0
- package/template/packages/api/src/index.ts +45 -0
- package/template/packages/api/tsconfig.json +4 -0
- package/template/pnpm-workspace.yaml +5 -0
- package/template/theme/tokens.css +40 -0
- package/template/tsconfig.base.json +14 -0
- package/template/turbo.json +12 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "1d995fa5-66dc-4c4e-8117-a49f932a223a",
|
|
3
|
+
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.account": {
|
|
8
|
+
"name": "account",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"id": {
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "text",
|
|
14
|
+
"primaryKey": true,
|
|
15
|
+
"notNull": true
|
|
16
|
+
},
|
|
17
|
+
"account_id": {
|
|
18
|
+
"name": "account_id",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true
|
|
22
|
+
},
|
|
23
|
+
"provider_id": {
|
|
24
|
+
"name": "provider_id",
|
|
25
|
+
"type": "text",
|
|
26
|
+
"primaryKey": false,
|
|
27
|
+
"notNull": true
|
|
28
|
+
},
|
|
29
|
+
"user_id": {
|
|
30
|
+
"name": "user_id",
|
|
31
|
+
"type": "text",
|
|
32
|
+
"primaryKey": false,
|
|
33
|
+
"notNull": true
|
|
34
|
+
},
|
|
35
|
+
"access_token": {
|
|
36
|
+
"name": "access_token",
|
|
37
|
+
"type": "text",
|
|
38
|
+
"primaryKey": false,
|
|
39
|
+
"notNull": false
|
|
40
|
+
},
|
|
41
|
+
"refresh_token": {
|
|
42
|
+
"name": "refresh_token",
|
|
43
|
+
"type": "text",
|
|
44
|
+
"primaryKey": false,
|
|
45
|
+
"notNull": false
|
|
46
|
+
},
|
|
47
|
+
"id_token": {
|
|
48
|
+
"name": "id_token",
|
|
49
|
+
"type": "text",
|
|
50
|
+
"primaryKey": false,
|
|
51
|
+
"notNull": false
|
|
52
|
+
},
|
|
53
|
+
"access_token_expires_at": {
|
|
54
|
+
"name": "access_token_expires_at",
|
|
55
|
+
"type": "timestamp",
|
|
56
|
+
"primaryKey": false,
|
|
57
|
+
"notNull": false
|
|
58
|
+
},
|
|
59
|
+
"refresh_token_expires_at": {
|
|
60
|
+
"name": "refresh_token_expires_at",
|
|
61
|
+
"type": "timestamp",
|
|
62
|
+
"primaryKey": false,
|
|
63
|
+
"notNull": false
|
|
64
|
+
},
|
|
65
|
+
"scope": {
|
|
66
|
+
"name": "scope",
|
|
67
|
+
"type": "text",
|
|
68
|
+
"primaryKey": false,
|
|
69
|
+
"notNull": false
|
|
70
|
+
},
|
|
71
|
+
"password": {
|
|
72
|
+
"name": "password",
|
|
73
|
+
"type": "text",
|
|
74
|
+
"primaryKey": false,
|
|
75
|
+
"notNull": false
|
|
76
|
+
},
|
|
77
|
+
"created_at": {
|
|
78
|
+
"name": "created_at",
|
|
79
|
+
"type": "timestamp",
|
|
80
|
+
"primaryKey": false,
|
|
81
|
+
"notNull": true,
|
|
82
|
+
"default": "now()"
|
|
83
|
+
},
|
|
84
|
+
"updated_at": {
|
|
85
|
+
"name": "updated_at",
|
|
86
|
+
"type": "timestamp",
|
|
87
|
+
"primaryKey": false,
|
|
88
|
+
"notNull": true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"indexes": {
|
|
92
|
+
"account_user_id_idx": {
|
|
93
|
+
"name": "account_user_id_idx",
|
|
94
|
+
"columns": [
|
|
95
|
+
{
|
|
96
|
+
"expression": "user_id",
|
|
97
|
+
"isExpression": false,
|
|
98
|
+
"asc": true,
|
|
99
|
+
"nulls": "last"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"isUnique": false,
|
|
103
|
+
"concurrently": false,
|
|
104
|
+
"method": "btree",
|
|
105
|
+
"with": {}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"foreignKeys": {
|
|
109
|
+
"account_user_id_user_id_fk": {
|
|
110
|
+
"name": "account_user_id_user_id_fk",
|
|
111
|
+
"tableFrom": "account",
|
|
112
|
+
"tableTo": "user",
|
|
113
|
+
"columnsFrom": [
|
|
114
|
+
"user_id"
|
|
115
|
+
],
|
|
116
|
+
"columnsTo": [
|
|
117
|
+
"id"
|
|
118
|
+
],
|
|
119
|
+
"onDelete": "cascade",
|
|
120
|
+
"onUpdate": "no action"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"compositePrimaryKeys": {},
|
|
124
|
+
"uniqueConstraints": {},
|
|
125
|
+
"policies": {},
|
|
126
|
+
"checkConstraints": {},
|
|
127
|
+
"isRLSEnabled": false
|
|
128
|
+
},
|
|
129
|
+
"public.session": {
|
|
130
|
+
"name": "session",
|
|
131
|
+
"schema": "",
|
|
132
|
+
"columns": {
|
|
133
|
+
"id": {
|
|
134
|
+
"name": "id",
|
|
135
|
+
"type": "text",
|
|
136
|
+
"primaryKey": true,
|
|
137
|
+
"notNull": true
|
|
138
|
+
},
|
|
139
|
+
"expires_at": {
|
|
140
|
+
"name": "expires_at",
|
|
141
|
+
"type": "timestamp",
|
|
142
|
+
"primaryKey": false,
|
|
143
|
+
"notNull": true
|
|
144
|
+
},
|
|
145
|
+
"token": {
|
|
146
|
+
"name": "token",
|
|
147
|
+
"type": "text",
|
|
148
|
+
"primaryKey": false,
|
|
149
|
+
"notNull": true
|
|
150
|
+
},
|
|
151
|
+
"created_at": {
|
|
152
|
+
"name": "created_at",
|
|
153
|
+
"type": "timestamp",
|
|
154
|
+
"primaryKey": false,
|
|
155
|
+
"notNull": true,
|
|
156
|
+
"default": "now()"
|
|
157
|
+
},
|
|
158
|
+
"updated_at": {
|
|
159
|
+
"name": "updated_at",
|
|
160
|
+
"type": "timestamp",
|
|
161
|
+
"primaryKey": false,
|
|
162
|
+
"notNull": true
|
|
163
|
+
},
|
|
164
|
+
"ip_address": {
|
|
165
|
+
"name": "ip_address",
|
|
166
|
+
"type": "text",
|
|
167
|
+
"primaryKey": false,
|
|
168
|
+
"notNull": false
|
|
169
|
+
},
|
|
170
|
+
"user_agent": {
|
|
171
|
+
"name": "user_agent",
|
|
172
|
+
"type": "text",
|
|
173
|
+
"primaryKey": false,
|
|
174
|
+
"notNull": false
|
|
175
|
+
},
|
|
176
|
+
"user_id": {
|
|
177
|
+
"name": "user_id",
|
|
178
|
+
"type": "text",
|
|
179
|
+
"primaryKey": false,
|
|
180
|
+
"notNull": true
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"indexes": {
|
|
184
|
+
"session_user_id_idx": {
|
|
185
|
+
"name": "session_user_id_idx",
|
|
186
|
+
"columns": [
|
|
187
|
+
{
|
|
188
|
+
"expression": "user_id",
|
|
189
|
+
"isExpression": false,
|
|
190
|
+
"asc": true,
|
|
191
|
+
"nulls": "last"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"isUnique": false,
|
|
195
|
+
"concurrently": false,
|
|
196
|
+
"method": "btree",
|
|
197
|
+
"with": {}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"foreignKeys": {
|
|
201
|
+
"session_user_id_user_id_fk": {
|
|
202
|
+
"name": "session_user_id_user_id_fk",
|
|
203
|
+
"tableFrom": "session",
|
|
204
|
+
"tableTo": "user",
|
|
205
|
+
"columnsFrom": [
|
|
206
|
+
"user_id"
|
|
207
|
+
],
|
|
208
|
+
"columnsTo": [
|
|
209
|
+
"id"
|
|
210
|
+
],
|
|
211
|
+
"onDelete": "cascade",
|
|
212
|
+
"onUpdate": "no action"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"compositePrimaryKeys": {},
|
|
216
|
+
"uniqueConstraints": {
|
|
217
|
+
"session_token_unique": {
|
|
218
|
+
"name": "session_token_unique",
|
|
219
|
+
"nullsNotDistinct": false,
|
|
220
|
+
"columns": [
|
|
221
|
+
"token"
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"policies": {},
|
|
226
|
+
"checkConstraints": {},
|
|
227
|
+
"isRLSEnabled": false
|
|
228
|
+
},
|
|
229
|
+
"public.user": {
|
|
230
|
+
"name": "user",
|
|
231
|
+
"schema": "",
|
|
232
|
+
"columns": {
|
|
233
|
+
"id": {
|
|
234
|
+
"name": "id",
|
|
235
|
+
"type": "text",
|
|
236
|
+
"primaryKey": true,
|
|
237
|
+
"notNull": true
|
|
238
|
+
},
|
|
239
|
+
"name": {
|
|
240
|
+
"name": "name",
|
|
241
|
+
"type": "text",
|
|
242
|
+
"primaryKey": false,
|
|
243
|
+
"notNull": true
|
|
244
|
+
},
|
|
245
|
+
"email": {
|
|
246
|
+
"name": "email",
|
|
247
|
+
"type": "text",
|
|
248
|
+
"primaryKey": false,
|
|
249
|
+
"notNull": true
|
|
250
|
+
},
|
|
251
|
+
"email_verified": {
|
|
252
|
+
"name": "email_verified",
|
|
253
|
+
"type": "boolean",
|
|
254
|
+
"primaryKey": false,
|
|
255
|
+
"notNull": true,
|
|
256
|
+
"default": false
|
|
257
|
+
},
|
|
258
|
+
"image": {
|
|
259
|
+
"name": "image",
|
|
260
|
+
"type": "text",
|
|
261
|
+
"primaryKey": false,
|
|
262
|
+
"notNull": false
|
|
263
|
+
},
|
|
264
|
+
"created_at": {
|
|
265
|
+
"name": "created_at",
|
|
266
|
+
"type": "timestamp",
|
|
267
|
+
"primaryKey": false,
|
|
268
|
+
"notNull": true,
|
|
269
|
+
"default": "now()"
|
|
270
|
+
},
|
|
271
|
+
"updated_at": {
|
|
272
|
+
"name": "updated_at",
|
|
273
|
+
"type": "timestamp",
|
|
274
|
+
"primaryKey": false,
|
|
275
|
+
"notNull": true,
|
|
276
|
+
"default": "now()"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"indexes": {},
|
|
280
|
+
"foreignKeys": {},
|
|
281
|
+
"compositePrimaryKeys": {},
|
|
282
|
+
"uniqueConstraints": {
|
|
283
|
+
"user_email_unique": {
|
|
284
|
+
"name": "user_email_unique",
|
|
285
|
+
"nullsNotDistinct": false,
|
|
286
|
+
"columns": [
|
|
287
|
+
"email"
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
"policies": {},
|
|
292
|
+
"checkConstraints": {},
|
|
293
|
+
"isRLSEnabled": false
|
|
294
|
+
},
|
|
295
|
+
"public.verification": {
|
|
296
|
+
"name": "verification",
|
|
297
|
+
"schema": "",
|
|
298
|
+
"columns": {
|
|
299
|
+
"id": {
|
|
300
|
+
"name": "id",
|
|
301
|
+
"type": "text",
|
|
302
|
+
"primaryKey": true,
|
|
303
|
+
"notNull": true
|
|
304
|
+
},
|
|
305
|
+
"identifier": {
|
|
306
|
+
"name": "identifier",
|
|
307
|
+
"type": "text",
|
|
308
|
+
"primaryKey": false,
|
|
309
|
+
"notNull": true
|
|
310
|
+
},
|
|
311
|
+
"value": {
|
|
312
|
+
"name": "value",
|
|
313
|
+
"type": "text",
|
|
314
|
+
"primaryKey": false,
|
|
315
|
+
"notNull": true
|
|
316
|
+
},
|
|
317
|
+
"expires_at": {
|
|
318
|
+
"name": "expires_at",
|
|
319
|
+
"type": "timestamp",
|
|
320
|
+
"primaryKey": false,
|
|
321
|
+
"notNull": true
|
|
322
|
+
},
|
|
323
|
+
"created_at": {
|
|
324
|
+
"name": "created_at",
|
|
325
|
+
"type": "timestamp",
|
|
326
|
+
"primaryKey": false,
|
|
327
|
+
"notNull": true,
|
|
328
|
+
"default": "now()"
|
|
329
|
+
},
|
|
330
|
+
"updated_at": {
|
|
331
|
+
"name": "updated_at",
|
|
332
|
+
"type": "timestamp",
|
|
333
|
+
"primaryKey": false,
|
|
334
|
+
"notNull": true,
|
|
335
|
+
"default": "now()"
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"indexes": {
|
|
339
|
+
"verification_identifier_idx": {
|
|
340
|
+
"name": "verification_identifier_idx",
|
|
341
|
+
"columns": [
|
|
342
|
+
{
|
|
343
|
+
"expression": "identifier",
|
|
344
|
+
"isExpression": false,
|
|
345
|
+
"asc": true,
|
|
346
|
+
"nulls": "last"
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
"isUnique": false,
|
|
350
|
+
"concurrently": false,
|
|
351
|
+
"method": "btree",
|
|
352
|
+
"with": {}
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"foreignKeys": {},
|
|
356
|
+
"compositePrimaryKeys": {},
|
|
357
|
+
"uniqueConstraints": {},
|
|
358
|
+
"policies": {},
|
|
359
|
+
"checkConstraints": {},
|
|
360
|
+
"isRLSEnabled": false
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"enums": {},
|
|
364
|
+
"schemas": {},
|
|
365
|
+
"sequences": {},
|
|
366
|
+
"roles": {},
|
|
367
|
+
"policies": {},
|
|
368
|
+
"views": {},
|
|
369
|
+
"_meta": {
|
|
370
|
+
"columns": {},
|
|
371
|
+
"schemas": {},
|
|
372
|
+
"tables": {}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { loadEnvConfig } from "@next/env";
|
|
2
|
+
import { defineConfig } from "drizzle-kit";
|
|
3
|
+
|
|
4
|
+
loadEnvConfig(process.cwd());
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
dialect: "postgresql",
|
|
8
|
+
schema: "./src/server/schema.ts",
|
|
9
|
+
out: "./drizzle",
|
|
10
|
+
dbCredentials: { url: process.env.DATABASE_URL ?? "" },
|
|
11
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@launchrail/web",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"dev": "next dev --hostname 0.0.0.0",
|
|
9
|
+
"start": "next start",
|
|
10
|
+
"typecheck": "next typegen && tsc --noEmit",
|
|
11
|
+
"db:generate": "drizzle-kit generate",
|
|
12
|
+
"db:migrate": "drizzle-kit migrate"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@launchrail/api": "workspace:*",
|
|
16
|
+
"@better-auth/expo": "1.7.28",
|
|
17
|
+
"@tanstack/react-query": "5.108.4",
|
|
18
|
+
"@trpc/client": "11.31.6",
|
|
19
|
+
"@trpc/server": "11.31.6",
|
|
20
|
+
"@trpc/tanstack-react-query": "11.31.6",
|
|
21
|
+
"better-auth": "1.7.28",
|
|
22
|
+
"drizzle-orm": "0.45.4",
|
|
23
|
+
"next": "16.4.6",
|
|
24
|
+
"postgres": "4.1.1",
|
|
25
|
+
"react": "19.3.0",
|
|
26
|
+
"react-dom": "19.3.0",
|
|
27
|
+
"server-only": "0.0.1",
|
|
28
|
+
"superjson": "2.2.7",
|
|
29
|
+
"@base-ui/react": "1.9.0",
|
|
30
|
+
"class-variance-authority": "0.7.1",
|
|
31
|
+
"clsx": "2.1.1",
|
|
32
|
+
"lucide-react": "1.81.0",
|
|
33
|
+
"shadcn": "4.23.1",
|
|
34
|
+
"tailwind-merge": "3.7.1",
|
|
35
|
+
"tw-animate-css": "1.4.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@next/env": "16.4.6",
|
|
39
|
+
"@tailwindcss/postcss": "4.3.5",
|
|
40
|
+
"@types/node": "24.19.4",
|
|
41
|
+
"@types/react": "19.3.3",
|
|
42
|
+
"@types/react-dom": "19.3.0",
|
|
43
|
+
"drizzle-kit": "0.31.11",
|
|
44
|
+
"postcss": "8.5.33",
|
|
45
|
+
"tailwindcss": "4.3.5",
|
|
46
|
+
"typescript": "7.0.2"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { appRouter, type RequestContext } from "@launchrail/api";
|
|
2
|
+
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
|
3
|
+
/* @if auth */
|
|
4
|
+
import { eq } from "drizzle-orm";
|
|
5
|
+
|
|
6
|
+
import { getAuth } from "@/server/auth";
|
|
7
|
+
import { getDb } from "@/server/db";
|
|
8
|
+
import { user } from "@/server/schema";
|
|
9
|
+
/* @end */
|
|
10
|
+
|
|
11
|
+
/* @if auth */
|
|
12
|
+
function requestContext(request: Request): RequestContext {
|
|
13
|
+
let account: ReturnType<RequestContext["getAccount"]> | undefined;
|
|
14
|
+
|
|
15
|
+
async function loadAccount() {
|
|
16
|
+
const session = await getAuth().api.getSession({
|
|
17
|
+
headers: request.headers,
|
|
18
|
+
query: { disableRefresh: true },
|
|
19
|
+
});
|
|
20
|
+
if (!session) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const [record] = await getDb()
|
|
25
|
+
.select({ id: user.id, name: user.name, email: user.email })
|
|
26
|
+
.from(user)
|
|
27
|
+
.where(eq(user.id, session.user.id))
|
|
28
|
+
.limit(1);
|
|
29
|
+
return record ?? null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
getAccount: () => {
|
|
34
|
+
account ??= loadAccount();
|
|
35
|
+
return account;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* @else */
|
|
41
|
+
function requestContext(_request: Request): RequestContext { return {}; }
|
|
42
|
+
/* @end */
|
|
43
|
+
|
|
44
|
+
const handler = (request: Request) =>
|
|
45
|
+
fetchRequestHandler({
|
|
46
|
+
endpoint: "/api/trpc",
|
|
47
|
+
req: request,
|
|
48
|
+
router: appRouter,
|
|
49
|
+
createContext: () => requestContext(request),
|
|
50
|
+
responseMeta: () => ({ headers: { "cache-control": "no-store" } }),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export { handler as GET, handler as POST };
|