alchemy 0.2.0 → 0.2.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 +506 -0
- package/lib/alchemy.js +10 -2
- package/lib/apply.js +86 -77
- package/lib/cloudflare/index.d.ts +2 -0
- package/lib/cloudflare/index.js +2 -0
- package/lib/cloudflare/static-site.js +9 -9
- package/lib/cloudflare/worker.js +1 -1
- package/lib/cloudflare/wrangler.json.d.ts +243 -0
- package/lib/cloudflare/wrangler.json.js +35 -0
- package/lib/cloudflare/zone-settings.d.ts +301 -0
- package/lib/cloudflare/zone-settings.js +1 -0
- package/lib/cloudflare/zone.d.ts +196 -0
- package/lib/cloudflare/zone.js +175 -0
- package/lib/destroy.js +1 -1
- package/lib/project/index.d.ts +1 -0
- package/lib/project/index.js +1 -0
- package/lib/project/vite.d.ts +39 -0
- package/lib/project/vite.js +68 -0
- package/lib/scope.d.ts +2 -0
- package/lib/scope.js +20 -1
- package/lib/state.js +6 -1
- package/lib/util/rm.d.ts +1 -0
- package/lib/util/rm.js +11 -0
- package/package.json +3 -2
- package/src/alchemy.ts +9 -2
- package/src/apply.ts +100 -94
- package/src/cloudflare/index.ts +2 -0
- package/src/cloudflare/static-site.ts +11 -11
- package/src/cloudflare/worker.ts +1 -1
- package/src/cloudflare/wrangler.json.ts +309 -0
- package/src/cloudflare/zone-settings.ts +368 -0
- package/src/cloudflare/zone.ts +491 -0
- package/src/destroy.ts +1 -1
- package/src/project/index.ts +1 -0
- package/src/project/vite.ts +152 -0
- package/src/scope.ts +25 -1
- package/src/state.ts +9 -1
- package/src/util/rm.ts +11 -0
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common response fields for all settings
|
|
3
|
+
*/
|
|
4
|
+
export interface CloudflareSettingBase {
|
|
5
|
+
/**
|
|
6
|
+
* The identifier of the setting
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* When the setting was last modified
|
|
12
|
+
*/
|
|
13
|
+
modified_on: string | null;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Whether the setting can be modified
|
|
17
|
+
*/
|
|
18
|
+
editable: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Value types for each setting
|
|
23
|
+
*/
|
|
24
|
+
export type SSLValue = "off" | "flexible" | "full" | "strict";
|
|
25
|
+
export type MinTLSVersionValue = "1.0" | "1.1" | "1.2" | "1.3";
|
|
26
|
+
export type TLS13Value = "on" | "off" | "zrt";
|
|
27
|
+
export type CacheLevelValue = "aggressive" | "basic" | "simplified";
|
|
28
|
+
|
|
29
|
+
// Boolean setting values
|
|
30
|
+
export type AlwaysUseHTTPSValue = "on" | "off";
|
|
31
|
+
export type AutomaticHTTPSRewritesValue = "on" | "off";
|
|
32
|
+
export type BrotliValue = "on" | "off";
|
|
33
|
+
export type DevelopmentModeValue = "on" | "off";
|
|
34
|
+
export type EarlyHintsValue = "on" | "off";
|
|
35
|
+
export type EmailObfuscationValue = "on" | "off";
|
|
36
|
+
export type HotlinkProtectionValue = "on" | "off";
|
|
37
|
+
export type HTTP2Value = "on" | "off";
|
|
38
|
+
export type HTTP3Value = "on" | "off";
|
|
39
|
+
export type IPv6Value = "on" | "off";
|
|
40
|
+
export type WebSocketsValue = "on" | "off";
|
|
41
|
+
export type ZeroRTTValue = "on" | "off";
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Common response fields for boolean settings that use "on"/"off"
|
|
45
|
+
*/
|
|
46
|
+
export interface CloudflareBooleanSetting extends CloudflareSettingBase {
|
|
47
|
+
/**
|
|
48
|
+
* The value of the setting
|
|
49
|
+
*/
|
|
50
|
+
value: "on" | "off";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Advanced DDoS protection setting
|
|
55
|
+
* @see https://developers.cloudflare.com/api/resources/zones/#advanced-ddos
|
|
56
|
+
*/
|
|
57
|
+
export interface AdvancedDDoSSetting extends CloudflareBooleanSetting {
|
|
58
|
+
id: "advanced_ddos";
|
|
59
|
+
value: "on" | "off";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Always Online setting
|
|
64
|
+
* When enabled, Cloudflare serves limited copies of web pages from the Internet Archive if your server is offline
|
|
65
|
+
*/
|
|
66
|
+
export interface AlwaysOnlineSetting extends CloudflareBooleanSetting {
|
|
67
|
+
id: "always_online";
|
|
68
|
+
value: "on" | "off";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Always Use HTTPS setting
|
|
73
|
+
* Redirects all HTTP traffic to HTTPS
|
|
74
|
+
*/
|
|
75
|
+
export interface AlwaysUseHTTPSSetting extends CloudflareSettingBase {
|
|
76
|
+
id: "always_use_https";
|
|
77
|
+
value: AlwaysUseHTTPSValue;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Automatic HTTPS Rewrites setting
|
|
82
|
+
* Automatically rewrites HTTP URLs to HTTPS
|
|
83
|
+
*/
|
|
84
|
+
export interface AutomaticHTTPSRewritesSetting extends CloudflareSettingBase {
|
|
85
|
+
id: "automatic_https_rewrites";
|
|
86
|
+
value: AutomaticHTTPSRewritesValue;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Automatic Platform Optimization setting
|
|
91
|
+
*/
|
|
92
|
+
export interface AutomaticPlatformOptimizationSetting
|
|
93
|
+
extends CloudflareSettingBase {
|
|
94
|
+
id: "automatic_platform_optimization";
|
|
95
|
+
value: {
|
|
96
|
+
enabled: boolean;
|
|
97
|
+
cf: boolean;
|
|
98
|
+
wordpress: boolean;
|
|
99
|
+
wordpress_plugin: boolean;
|
|
100
|
+
cache_by_device_type: boolean;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Brotli compression setting
|
|
106
|
+
*/
|
|
107
|
+
export interface BrotliSetting extends CloudflareSettingBase {
|
|
108
|
+
id: "brotli";
|
|
109
|
+
value: BrotliValue;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Browser Cache TTL setting
|
|
114
|
+
*/
|
|
115
|
+
export interface BrowserCacheTTLSetting extends CloudflareSettingBase {
|
|
116
|
+
id: "browser_cache_ttl";
|
|
117
|
+
value: number;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Browser Check setting
|
|
122
|
+
*/
|
|
123
|
+
export interface BrowserCheckSetting extends CloudflareSettingBase {
|
|
124
|
+
id: "browser_check";
|
|
125
|
+
value: "on" | "off";
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Cache Level setting
|
|
130
|
+
*/
|
|
131
|
+
export interface CacheLevelSetting extends CloudflareSettingBase {
|
|
132
|
+
id: "cache_level";
|
|
133
|
+
value: CacheLevelValue;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Challenge TTL setting
|
|
138
|
+
*/
|
|
139
|
+
export interface ChallengeTTLSetting extends CloudflareSettingBase {
|
|
140
|
+
id: "challenge_ttl";
|
|
141
|
+
value: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Ciphers setting
|
|
146
|
+
*/
|
|
147
|
+
export interface CiphersSetting extends CloudflareSettingBase {
|
|
148
|
+
id: "ciphers";
|
|
149
|
+
value: string[];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Development Mode setting
|
|
154
|
+
*/
|
|
155
|
+
export interface DevelopmentModeSetting extends CloudflareSettingBase {
|
|
156
|
+
id: "development_mode";
|
|
157
|
+
value: DevelopmentModeValue;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Early Hints setting
|
|
162
|
+
*/
|
|
163
|
+
export interface EarlyHintsSetting extends CloudflareSettingBase {
|
|
164
|
+
id: "early_hints";
|
|
165
|
+
value: EarlyHintsValue;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Email Obfuscation setting
|
|
170
|
+
*/
|
|
171
|
+
export interface EmailObfuscationSetting extends CloudflareSettingBase {
|
|
172
|
+
id: "email_obfuscation";
|
|
173
|
+
value: EmailObfuscationValue;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Hotlink Protection setting
|
|
178
|
+
*/
|
|
179
|
+
export interface HotlinkProtectionSetting extends CloudflareSettingBase {
|
|
180
|
+
id: "hotlink_protection";
|
|
181
|
+
value: HotlinkProtectionValue;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* HTTP/2 setting
|
|
186
|
+
*/
|
|
187
|
+
export interface HTTP2Setting extends CloudflareSettingBase {
|
|
188
|
+
id: "http2";
|
|
189
|
+
value: HTTP2Value;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* HTTP/3 setting
|
|
194
|
+
*/
|
|
195
|
+
export interface HTTP3Setting extends CloudflareSettingBase {
|
|
196
|
+
id: "http3";
|
|
197
|
+
value: HTTP3Value;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* IP Geolocation setting
|
|
202
|
+
*/
|
|
203
|
+
export interface IPGeolocationSetting extends CloudflareSettingBase {
|
|
204
|
+
id: "ip_geolocation";
|
|
205
|
+
value: "on" | "off";
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* IPv6 setting
|
|
210
|
+
*/
|
|
211
|
+
export interface IPv6Setting extends CloudflareSettingBase {
|
|
212
|
+
id: "ipv6";
|
|
213
|
+
value: IPv6Value;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Minimum TLS Version setting
|
|
218
|
+
*/
|
|
219
|
+
export interface MinTLSVersionSetting extends CloudflareSettingBase {
|
|
220
|
+
id: "min_tls_version";
|
|
221
|
+
value: MinTLSVersionValue;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Opportunistic Encryption setting
|
|
226
|
+
*/
|
|
227
|
+
export interface OpportunisticEncryptionSetting extends CloudflareSettingBase {
|
|
228
|
+
id: "opportunistic_encryption";
|
|
229
|
+
value: "on" | "off";
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* SSL setting
|
|
234
|
+
*/
|
|
235
|
+
export interface SSLSetting extends CloudflareSettingBase {
|
|
236
|
+
id: "ssl";
|
|
237
|
+
value: SSLValue;
|
|
238
|
+
certificate_status?: string;
|
|
239
|
+
validation_errors?: Array<{
|
|
240
|
+
message: string;
|
|
241
|
+
}>;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* TLS 1.3 setting
|
|
246
|
+
*/
|
|
247
|
+
export interface TLS13Setting extends CloudflareSettingBase {
|
|
248
|
+
id: "tls_1_3";
|
|
249
|
+
value: TLS13Value;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* WebSockets setting
|
|
254
|
+
*/
|
|
255
|
+
export interface WebSocketsSetting extends CloudflareSettingBase {
|
|
256
|
+
id: "websockets";
|
|
257
|
+
value: WebSocketsValue;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Zero-RTT setting
|
|
262
|
+
*/
|
|
263
|
+
export interface ZeroRTTSetting extends CloudflareSettingBase {
|
|
264
|
+
id: "0rtt";
|
|
265
|
+
value: ZeroRTTValue;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* All possible zone settings
|
|
270
|
+
*/
|
|
271
|
+
export type CloudflareZoneSetting =
|
|
272
|
+
| AdvancedDDoSSetting
|
|
273
|
+
| AlwaysOnlineSetting
|
|
274
|
+
| AlwaysUseHTTPSSetting
|
|
275
|
+
| AutomaticHTTPSRewritesSetting
|
|
276
|
+
| AutomaticPlatformOptimizationSetting
|
|
277
|
+
| BrotliSetting
|
|
278
|
+
| BrowserCacheTTLSetting
|
|
279
|
+
| BrowserCheckSetting
|
|
280
|
+
| CacheLevelSetting
|
|
281
|
+
| ChallengeTTLSetting
|
|
282
|
+
| CiphersSetting
|
|
283
|
+
| DevelopmentModeSetting
|
|
284
|
+
| EarlyHintsSetting
|
|
285
|
+
| EmailObfuscationSetting
|
|
286
|
+
| HotlinkProtectionSetting
|
|
287
|
+
| HTTP2Setting
|
|
288
|
+
| HTTP3Setting
|
|
289
|
+
| IPGeolocationSetting
|
|
290
|
+
| IPv6Setting
|
|
291
|
+
| MinTLSVersionSetting
|
|
292
|
+
| OpportunisticEncryptionSetting
|
|
293
|
+
| SSLSetting
|
|
294
|
+
| TLS13Setting
|
|
295
|
+
| WebSocketsSetting
|
|
296
|
+
| ZeroRTTSetting;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Input for updating a zone setting
|
|
300
|
+
*/
|
|
301
|
+
export interface UpdateZoneSettingParams {
|
|
302
|
+
/**
|
|
303
|
+
* The value to set
|
|
304
|
+
*/
|
|
305
|
+
value: CloudflareZoneSetting["value"];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Response for zone settings operations
|
|
310
|
+
*/
|
|
311
|
+
export interface CloudflareZoneSettingResponse {
|
|
312
|
+
/**
|
|
313
|
+
* Whether the API call was successful
|
|
314
|
+
*/
|
|
315
|
+
success: boolean;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Any error messages
|
|
319
|
+
*/
|
|
320
|
+
errors: Array<{
|
|
321
|
+
code: number;
|
|
322
|
+
message: string;
|
|
323
|
+
}>;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Any informational messages
|
|
327
|
+
*/
|
|
328
|
+
messages: Array<{
|
|
329
|
+
code: number;
|
|
330
|
+
message: string;
|
|
331
|
+
}>;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* The settings that were operated on
|
|
335
|
+
*/
|
|
336
|
+
result: CloudflareZoneSetting[];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Response for a single zone setting operation
|
|
341
|
+
*/
|
|
342
|
+
export interface CloudflareZoneSettingSingleResponse {
|
|
343
|
+
/**
|
|
344
|
+
* Whether the API call was successful
|
|
345
|
+
*/
|
|
346
|
+
success: boolean;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Any error messages
|
|
350
|
+
*/
|
|
351
|
+
errors: Array<{
|
|
352
|
+
code: number;
|
|
353
|
+
message: string;
|
|
354
|
+
}>;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Any informational messages
|
|
358
|
+
*/
|
|
359
|
+
messages: Array<{
|
|
360
|
+
code: number;
|
|
361
|
+
message: string;
|
|
362
|
+
}>;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* The setting that was operated on
|
|
366
|
+
*/
|
|
367
|
+
result: CloudflareZoneSetting;
|
|
368
|
+
}
|