-
Notifications
You must be signed in to change notification settings - Fork 393
/
Copy pathtypes.ts
228 lines (209 loc) · 5.5 KB
/
types.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
import type { Buffer } from 'buffer'
import type { IncomingMessage } from 'http'
import type { PollingStrategy } from '@netlify/build-info'
import type { Match } from 'netlify-redirector'
export type { GlobalConfigStore } from './get-global-config-store.js'
export { default as CLIState } from './cli-state.js'
export type FrameworkNames = '#static' | '#auto' | '#custom' | string
export type FrameworkInfo = {
build: {
directory: string
}
dev: {
commands: string[]
port: number
pollingStrategies: PollingStrategy[]
}
name: FrameworkNames
staticAssetsDirectory: string
env: NodeJS.ProcessEnv
plugins?: string[]
}
export type BaseServerSettings = {
baseDirectory?: string
dist: string
/** The command that was provided for the dev config */
command?: string
/** If it should be served like static files */
useStaticServer?: boolean
/** A port where a proxy can listen to it */
frameworkPort?: number
/** The host where a proxy can listen to it */
frameworkHost?: '127.0.0.1' | '::1'
/** Try both v4 and v6 IPs */
detectFrameworkHost?: boolean
functions?: string
/** The framework name ('Create React App') */
framework?: string
env?: NodeJS.ProcessEnv
pollingStrategies?: string[]
plugins?: string[]
clearPublishDirectory?: boolean
}
export type ServerSettings = BaseServerSettings & {
/** default 'secret' */
jwtSecret: string
/** default 'app_metadata.authorization.roles' */
jwtRolePath: string
/** The port where the dev server is running on */
port: number
/** The port where the functions are running on */
functionsPort: number
https?: { key: string; cert: string; keyFilePath: string; certFilePath: string }
clearPublishDirectory?: boolean
skipWaitPort?: boolean
}
export interface Request extends IncomingMessage {
originalBody?: Buffer | null
protocol?: string
hostname?: string
}
export type Rewriter = (req: Request) => Promise<Match | null>
// FIXME(serhalp): Much of this appears to be wrong? Most of these should be optional, or at
// the very least `siteInfo` should be optional on `CachedConfig` when no site is linked...
// Delete all of this and replace with generated Netlify API type.
export interface SiteInfo {
account_id?: string | undefined
account_name: string
account_slug: string
admin_url: string
// TODO(serhalp): Investigate this. It seems like this should be required but there appear to
// be cases where it is missing.
build_settings?:
| {
allowed_branches: string[]
cmd: string
deploy_key_id: string
dir: string
env?: Record<string, unknown>
id: number
private_logs: boolean
provider: string
public_repo: boolean
repo_branch: string
repo_path: string
repo_url: string
}
| undefined
capabilities: Record<string, unknown>
created_at: string
custom_domain: string
deploy_hook: string
deploy_url: string
dev_server_settings?:
| {
cmd: string
target_port: number
}
| undefined
domain_aliases: string[]
feature_flags?: Record<string, string | boolean>
force_ssl: boolean
git_provider: string
id: string
managed_dns: boolean
name: string
notification_email: string
password: string
plan: string
processing_settings: {
css: {
bundle: boolean
minify: boolean
}
html: Record<string, unknown>
images: Record<string, unknown>
js: {
bundle: boolean
minify: boolean
}
skip: boolean
}
published_deploy:
| {
admin_url: string
branch: string
build_id: string
commit_ref: string
commit_url: string
context: string
created_at: string
deploy_ssl_url: string
deploy_url: string
draft: boolean
error_message: string
id: string
locked: boolean
name: string
published_at: string
required: string[]
required_functions: string[]
review_id: number
review_url: string
screenshot_url: string
site_id: string
skipped: boolean
ssl_url: string
state: string
title: string
updated_at: string
url: string
user_id: string
}
| undefined
screenshot_url: string
session_id: string
ssl: boolean
ssl_url: string
state: string
updated_at: string
url: string
user_id: string
}
export type TokenLocation = 'env' | 'flag' | 'config' | 'not found'
export type EnvVar = {
key: string
scopes: string[]
values: EnvVarValue[]
updated_at: string
is_secret: boolean
}
type EnvVarValue = {
id: string
context: string
}
export type MinimalAccount = {
id: string
name: string
slug: string
default: boolean
team_logo_url: string | null
on_pro_trial: boolean
organization_id: string | null
type_name: string
type_slug: string
members_count: number
}
export interface GitHubRepo {
name: string
html_url: string
full_name: string
archived: boolean
disabled: boolean
}
export interface Template {
name: string
sourceCodeUrl: string
slug: string
}
type EnvironmentVariableScope = 'builds' | 'functions' | 'runtime' | 'post_processing'
type EnvironmentVariableSource = 'account' | 'addons' | 'configFile' | 'general' | 'internal' | 'ui'
export type EnvironmentVariables = Record<
string,
{ sources: EnvironmentVariableSource[]; value: string; scopes?: EnvironmentVariableScope[] }
>
export interface Plugin {
origin?: string
package: string
pinned_version?: string | undefined
}