-
Notifications
You must be signed in to change notification settings - Fork 0
/
env.d.ts
74 lines (66 loc) · 1.72 KB
/
env.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/// <reference types="@remix-run/node" />
/// <reference types="vite/client" />
import type { User } from "payload/generated-types";
import type { Response, Request, NextFunction } from "express";
import type { Payload } from "payload";
import type { ServerBuild } from "@remix-run/node";
export interface RemixRequestContext {
payload: Payload;
user?: User;
token?: string;
exp?: number;
res: Response;
}
declare module "@remix-run/node" {
interface AppLoadContext extends RemixRequestContext {}
}
//overload the request handler to include the payload and user objects
interface PayloadRequest extends Express.Request {
payload: Payload;
user?: User;
}
type GetLoadContextFunction = (
req: PayloadRequest,
res: Response
) => Promise<AppLoadContext> | AppLoadContext;
type RequestHandler = (
req: Request,
res: Response,
next: NextFunction
) => Promise<void>;
declare module "@remix-run/express" {
export function createRequestHandler({
build,
getLoadContext,
mode,
}: {
build: ServerBuild | (() => Promise<ServerBuild>);
getLoadContext?: GetLoadContextFunction;
mode?: string;
}): RequestHandler;
}
declare global {
interface AppEnvironment {
NODE_ENV: string;
PAYLOAD_PUBLIC_SERVER_URL: string;
HCAPTCHA_SITE_KEY: string;
HCAPTCHA_SECRET_KEY: string;
S3_ENABLED: string;
S3_REGION: string;
S3_ENDPOINT: string;
S3_BUCKET: string;
S3_BUCKET_ENDPOINT: string;
S3_ACCESS_KEY: string;
S3_SECRET_KEY: string;
MEDIA_URL: string;
CDN_CGI_IMAGE_URL: string;
USE_CLOUDFLARE_IMAGE_TRANSFORMATIONS: string;
}
interface Window {
ENV: AppEnvironment;
}
namespace NodeJS {
interface ProcessEnv extends AppEnvironment {}
}
}
export {};