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
package/lib/cloudflare/index.js
CHANGED
|
@@ -25,15 +25,6 @@ export const StaticSite = Resource("cloudflare::StaticSite", {
|
|
|
25
25
|
if (!props.dir) {
|
|
26
26
|
throw new Error("Directory is required for StaticSite");
|
|
27
27
|
}
|
|
28
|
-
try {
|
|
29
|
-
const dirStat = await fs.stat(props.dir);
|
|
30
|
-
if (!dirStat.isDirectory()) {
|
|
31
|
-
throw new Error(`"${props.dir}" is not a directory`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
throw new Error(`Directory "${props.dir}" does not exist: ${error.message}`);
|
|
36
|
-
}
|
|
37
28
|
// Run build command if provided
|
|
38
29
|
if (props.build?.command) {
|
|
39
30
|
try {
|
|
@@ -58,6 +49,15 @@ export const StaticSite = Resource("cloudflare::StaticSite", {
|
|
|
58
49
|
throw new Error(`Build command "${props.build.command}" failed with exit code ${error.code}:\n${error.stderr || error.message}`);
|
|
59
50
|
}
|
|
60
51
|
}
|
|
52
|
+
try {
|
|
53
|
+
const dirStat = await fs.stat(props.dir);
|
|
54
|
+
if (!dirStat.isDirectory()) {
|
|
55
|
+
throw new Error(`"${props.dir}" is not a directory`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
throw new Error(`Directory "${props.dir}" does not exist: ${error.message}`);
|
|
60
|
+
}
|
|
61
61
|
// Use the provided name
|
|
62
62
|
const siteName = props.name;
|
|
63
63
|
const indexPage = props.indexPage || "index.html";
|
package/lib/cloudflare/worker.js
CHANGED
|
@@ -272,7 +272,7 @@ async function assertWorkerDoesNotExist(ctx, api, workerName) {
|
|
|
272
272
|
throw new Error(`Worker with name '${workerName}' already exists. Please use a unique name.`);
|
|
273
273
|
}
|
|
274
274
|
else {
|
|
275
|
-
throw new Error(`Error checking if worker exists: ${response.status} ${response.statusText}`);
|
|
275
|
+
throw new Error(`Error checking if worker exists: ${response.status} ${response.statusText} ${await response.text()}`);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
async function bundleWorkerScript(props) {
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import type { Context } from "../context";
|
|
2
|
+
import { Resource } from "../resource";
|
|
3
|
+
/**
|
|
4
|
+
* Properties for wrangler.json configuration file
|
|
5
|
+
*/
|
|
6
|
+
export interface WranglerJsonProps {
|
|
7
|
+
/**
|
|
8
|
+
* The name of your worker
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* The directory containing your worker entry point
|
|
13
|
+
* @default "src"
|
|
14
|
+
*/
|
|
15
|
+
main?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The entry point for your worker
|
|
18
|
+
* @default "index.ts" or "index.js"
|
|
19
|
+
*/
|
|
20
|
+
entrypoint?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The directory to store build artifacts
|
|
23
|
+
* @default "dist"
|
|
24
|
+
*/
|
|
25
|
+
outdir?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The directory to serve static assets from
|
|
28
|
+
*/
|
|
29
|
+
assets?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Minify the worker script
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
minify?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Node.js compatibility mode
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
node_compat?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* First-party worker service bindings
|
|
42
|
+
*/
|
|
43
|
+
services?: Array<{
|
|
44
|
+
/**
|
|
45
|
+
* Binding name
|
|
46
|
+
*/
|
|
47
|
+
name: string;
|
|
48
|
+
/**
|
|
49
|
+
* Service environment
|
|
50
|
+
*/
|
|
51
|
+
environment?: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Worker environment variables
|
|
55
|
+
*/
|
|
56
|
+
vars?: Record<string, string>;
|
|
57
|
+
/**
|
|
58
|
+
* KV Namespace bindings
|
|
59
|
+
*/
|
|
60
|
+
kv_namespaces?: Array<{
|
|
61
|
+
/**
|
|
62
|
+
* Binding name
|
|
63
|
+
*/
|
|
64
|
+
binding: string;
|
|
65
|
+
/**
|
|
66
|
+
* KV namespace ID
|
|
67
|
+
*/
|
|
68
|
+
id: string;
|
|
69
|
+
/**
|
|
70
|
+
* Preview KV namespace ID
|
|
71
|
+
*/
|
|
72
|
+
preview_id?: string;
|
|
73
|
+
}>;
|
|
74
|
+
/**
|
|
75
|
+
* R2 bucket bindings
|
|
76
|
+
*/
|
|
77
|
+
r2_buckets?: Array<{
|
|
78
|
+
/**
|
|
79
|
+
* Binding name
|
|
80
|
+
*/
|
|
81
|
+
binding: string;
|
|
82
|
+
/**
|
|
83
|
+
* Bucket name
|
|
84
|
+
*/
|
|
85
|
+
bucket_name: string;
|
|
86
|
+
/**
|
|
87
|
+
* Preview bucket name
|
|
88
|
+
*/
|
|
89
|
+
preview_bucket_name?: string;
|
|
90
|
+
}>;
|
|
91
|
+
/**
|
|
92
|
+
* D1 database bindings
|
|
93
|
+
*/
|
|
94
|
+
d1_databases?: Array<{
|
|
95
|
+
/**
|
|
96
|
+
* Binding name
|
|
97
|
+
*/
|
|
98
|
+
binding: string;
|
|
99
|
+
/**
|
|
100
|
+
* Database name
|
|
101
|
+
*/
|
|
102
|
+
database_name: string;
|
|
103
|
+
/**
|
|
104
|
+
* Database ID
|
|
105
|
+
*/
|
|
106
|
+
database_id: string;
|
|
107
|
+
/**
|
|
108
|
+
* Preview database ID
|
|
109
|
+
*/
|
|
110
|
+
preview_database_id?: string;
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* Durable Object bindings
|
|
114
|
+
*/
|
|
115
|
+
durable_objects?: {
|
|
116
|
+
/**
|
|
117
|
+
* Durable Object bindings
|
|
118
|
+
*/
|
|
119
|
+
bindings: Array<{
|
|
120
|
+
/**
|
|
121
|
+
* Binding name
|
|
122
|
+
*/
|
|
123
|
+
name: string;
|
|
124
|
+
/**
|
|
125
|
+
* Class name
|
|
126
|
+
*/
|
|
127
|
+
class_name: string;
|
|
128
|
+
/**
|
|
129
|
+
* Script name
|
|
130
|
+
*/
|
|
131
|
+
script_name?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Environment name
|
|
134
|
+
*/
|
|
135
|
+
environment?: string;
|
|
136
|
+
}>;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Queue bindings
|
|
140
|
+
*/
|
|
141
|
+
queues?: {
|
|
142
|
+
/**
|
|
143
|
+
* Producer bindings
|
|
144
|
+
*/
|
|
145
|
+
producers?: Array<{
|
|
146
|
+
/**
|
|
147
|
+
* Binding name
|
|
148
|
+
*/
|
|
149
|
+
binding: string;
|
|
150
|
+
/**
|
|
151
|
+
* Queue name
|
|
152
|
+
*/
|
|
153
|
+
queue: string;
|
|
154
|
+
}>;
|
|
155
|
+
/**
|
|
156
|
+
* Consumer configuration
|
|
157
|
+
*/
|
|
158
|
+
consumers?: Array<{
|
|
159
|
+
/**
|
|
160
|
+
* Queue name
|
|
161
|
+
*/
|
|
162
|
+
queue: string;
|
|
163
|
+
/**
|
|
164
|
+
* Maximum batch size
|
|
165
|
+
*/
|
|
166
|
+
max_batch_size?: number;
|
|
167
|
+
/**
|
|
168
|
+
* Maximum batch timeout
|
|
169
|
+
*/
|
|
170
|
+
max_batch_timeout?: number;
|
|
171
|
+
/**
|
|
172
|
+
* Maximum retries
|
|
173
|
+
*/
|
|
174
|
+
max_retries?: number;
|
|
175
|
+
/**
|
|
176
|
+
* Dead letter queue
|
|
177
|
+
*/
|
|
178
|
+
dead_letter_queue?: string;
|
|
179
|
+
}>;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Analytics Engine bindings
|
|
183
|
+
*/
|
|
184
|
+
analytics_engine_datasets?: Array<{
|
|
185
|
+
/**
|
|
186
|
+
* Binding name
|
|
187
|
+
*/
|
|
188
|
+
binding: string;
|
|
189
|
+
/**
|
|
190
|
+
* Dataset name
|
|
191
|
+
*/
|
|
192
|
+
dataset?: string;
|
|
193
|
+
}>;
|
|
194
|
+
/**
|
|
195
|
+
* Route configuration
|
|
196
|
+
*/
|
|
197
|
+
routes?: Array<string>;
|
|
198
|
+
/**
|
|
199
|
+
* Triggers configuration
|
|
200
|
+
*/
|
|
201
|
+
triggers?: {
|
|
202
|
+
/**
|
|
203
|
+
* Cron triggers
|
|
204
|
+
*/
|
|
205
|
+
crons: Array<string>;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Worker compatibility date
|
|
209
|
+
*/
|
|
210
|
+
compatibility_date?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Worker compatibility flags
|
|
213
|
+
*/
|
|
214
|
+
compatibility_flags?: Array<string>;
|
|
215
|
+
/**
|
|
216
|
+
* Worker usage model
|
|
217
|
+
* "bundled" - Includes resources like CPU and memory. Better for consistent workloads.
|
|
218
|
+
* "unbound" - Pay only for what you use. Better for sporadic workloads.
|
|
219
|
+
*/
|
|
220
|
+
usage_model?: "bundled" | "unbound";
|
|
221
|
+
/**
|
|
222
|
+
* Path to the wrangler.json file
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
path?: string;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Output returned after WranglerJson creation/update
|
|
229
|
+
*/
|
|
230
|
+
export interface WranglerJson extends Resource<"cloudflare::WranglerJson">, WranglerJsonProps {
|
|
231
|
+
/**
|
|
232
|
+
* Time at which the file was created
|
|
233
|
+
*/
|
|
234
|
+
createdAt: number;
|
|
235
|
+
/**
|
|
236
|
+
* Time at which the file was last updated
|
|
237
|
+
*/
|
|
238
|
+
updatedAt: number;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Resource for managing wrangler.json configuration files
|
|
242
|
+
*/
|
|
243
|
+
export declare const WranglerJson: ((this: Context<WranglerJson>, id: string, props: WranglerJsonProps) => Promise<WranglerJson>) | (((this: any, id: string, props: WranglerJsonProps) => never) & (new (_: never) => never));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as fs from "fs/promises";
|
|
2
|
+
import { Resource } from "../resource";
|
|
3
|
+
/**
|
|
4
|
+
* Resource for managing wrangler.json configuration files
|
|
5
|
+
*/
|
|
6
|
+
export const WranglerJson = Resource("cloudflare::WranglerJson", async function (id, props) {
|
|
7
|
+
// Default path is wrangler.json in current directory
|
|
8
|
+
const filePath = props.path || "wrangler.json";
|
|
9
|
+
if (this.phase === "delete") {
|
|
10
|
+
try {
|
|
11
|
+
await fs.unlink(filePath);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
// Ignore errors if file doesn't exist
|
|
15
|
+
if (error.code !== "ENOENT") {
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return this.destroy();
|
|
20
|
+
}
|
|
21
|
+
// Create or update the file
|
|
22
|
+
const config = {
|
|
23
|
+
...props,
|
|
24
|
+
// Remove internal path property
|
|
25
|
+
path: undefined,
|
|
26
|
+
};
|
|
27
|
+
// Write the file
|
|
28
|
+
await fs.writeFile(filePath, JSON.stringify(config, null, 2));
|
|
29
|
+
// Return the resource
|
|
30
|
+
return this({
|
|
31
|
+
...props,
|
|
32
|
+
createdAt: Date.now(),
|
|
33
|
+
updatedAt: Date.now(),
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,301 @@
|
|
|
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
|
+
* When the setting was last modified
|
|
11
|
+
*/
|
|
12
|
+
modified_on: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the setting can be modified
|
|
15
|
+
*/
|
|
16
|
+
editable: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Value types for each setting
|
|
20
|
+
*/
|
|
21
|
+
export type SSLValue = "off" | "flexible" | "full" | "strict";
|
|
22
|
+
export type MinTLSVersionValue = "1.0" | "1.1" | "1.2" | "1.3";
|
|
23
|
+
export type TLS13Value = "on" | "off" | "zrt";
|
|
24
|
+
export type CacheLevelValue = "aggressive" | "basic" | "simplified";
|
|
25
|
+
export type AlwaysUseHTTPSValue = "on" | "off";
|
|
26
|
+
export type AutomaticHTTPSRewritesValue = "on" | "off";
|
|
27
|
+
export type BrotliValue = "on" | "off";
|
|
28
|
+
export type DevelopmentModeValue = "on" | "off";
|
|
29
|
+
export type EarlyHintsValue = "on" | "off";
|
|
30
|
+
export type EmailObfuscationValue = "on" | "off";
|
|
31
|
+
export type HotlinkProtectionValue = "on" | "off";
|
|
32
|
+
export type HTTP2Value = "on" | "off";
|
|
33
|
+
export type HTTP3Value = "on" | "off";
|
|
34
|
+
export type IPv6Value = "on" | "off";
|
|
35
|
+
export type WebSocketsValue = "on" | "off";
|
|
36
|
+
export type ZeroRTTValue = "on" | "off";
|
|
37
|
+
/**
|
|
38
|
+
* Common response fields for boolean settings that use "on"/"off"
|
|
39
|
+
*/
|
|
40
|
+
export interface CloudflareBooleanSetting extends CloudflareSettingBase {
|
|
41
|
+
/**
|
|
42
|
+
* The value of the setting
|
|
43
|
+
*/
|
|
44
|
+
value: "on" | "off";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Advanced DDoS protection setting
|
|
48
|
+
* @see https://developers.cloudflare.com/api/resources/zones/#advanced-ddos
|
|
49
|
+
*/
|
|
50
|
+
export interface AdvancedDDoSSetting extends CloudflareBooleanSetting {
|
|
51
|
+
id: "advanced_ddos";
|
|
52
|
+
value: "on" | "off";
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Always Online setting
|
|
56
|
+
* When enabled, Cloudflare serves limited copies of web pages from the Internet Archive if your server is offline
|
|
57
|
+
*/
|
|
58
|
+
export interface AlwaysOnlineSetting extends CloudflareBooleanSetting {
|
|
59
|
+
id: "always_online";
|
|
60
|
+
value: "on" | "off";
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Always Use HTTPS setting
|
|
64
|
+
* Redirects all HTTP traffic to HTTPS
|
|
65
|
+
*/
|
|
66
|
+
export interface AlwaysUseHTTPSSetting extends CloudflareSettingBase {
|
|
67
|
+
id: "always_use_https";
|
|
68
|
+
value: AlwaysUseHTTPSValue;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Automatic HTTPS Rewrites setting
|
|
72
|
+
* Automatically rewrites HTTP URLs to HTTPS
|
|
73
|
+
*/
|
|
74
|
+
export interface AutomaticHTTPSRewritesSetting extends CloudflareSettingBase {
|
|
75
|
+
id: "automatic_https_rewrites";
|
|
76
|
+
value: AutomaticHTTPSRewritesValue;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Automatic Platform Optimization setting
|
|
80
|
+
*/
|
|
81
|
+
export interface AutomaticPlatformOptimizationSetting extends CloudflareSettingBase {
|
|
82
|
+
id: "automatic_platform_optimization";
|
|
83
|
+
value: {
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
cf: boolean;
|
|
86
|
+
wordpress: boolean;
|
|
87
|
+
wordpress_plugin: boolean;
|
|
88
|
+
cache_by_device_type: boolean;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Brotli compression setting
|
|
93
|
+
*/
|
|
94
|
+
export interface BrotliSetting extends CloudflareSettingBase {
|
|
95
|
+
id: "brotli";
|
|
96
|
+
value: BrotliValue;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Browser Cache TTL setting
|
|
100
|
+
*/
|
|
101
|
+
export interface BrowserCacheTTLSetting extends CloudflareSettingBase {
|
|
102
|
+
id: "browser_cache_ttl";
|
|
103
|
+
value: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Browser Check setting
|
|
107
|
+
*/
|
|
108
|
+
export interface BrowserCheckSetting extends CloudflareSettingBase {
|
|
109
|
+
id: "browser_check";
|
|
110
|
+
value: "on" | "off";
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Cache Level setting
|
|
114
|
+
*/
|
|
115
|
+
export interface CacheLevelSetting extends CloudflareSettingBase {
|
|
116
|
+
id: "cache_level";
|
|
117
|
+
value: CacheLevelValue;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Challenge TTL setting
|
|
121
|
+
*/
|
|
122
|
+
export interface ChallengeTTLSetting extends CloudflareSettingBase {
|
|
123
|
+
id: "challenge_ttl";
|
|
124
|
+
value: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Ciphers setting
|
|
128
|
+
*/
|
|
129
|
+
export interface CiphersSetting extends CloudflareSettingBase {
|
|
130
|
+
id: "ciphers";
|
|
131
|
+
value: string[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Development Mode setting
|
|
135
|
+
*/
|
|
136
|
+
export interface DevelopmentModeSetting extends CloudflareSettingBase {
|
|
137
|
+
id: "development_mode";
|
|
138
|
+
value: DevelopmentModeValue;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Early Hints setting
|
|
142
|
+
*/
|
|
143
|
+
export interface EarlyHintsSetting extends CloudflareSettingBase {
|
|
144
|
+
id: "early_hints";
|
|
145
|
+
value: EarlyHintsValue;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Email Obfuscation setting
|
|
149
|
+
*/
|
|
150
|
+
export interface EmailObfuscationSetting extends CloudflareSettingBase {
|
|
151
|
+
id: "email_obfuscation";
|
|
152
|
+
value: EmailObfuscationValue;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Hotlink Protection setting
|
|
156
|
+
*/
|
|
157
|
+
export interface HotlinkProtectionSetting extends CloudflareSettingBase {
|
|
158
|
+
id: "hotlink_protection";
|
|
159
|
+
value: HotlinkProtectionValue;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* HTTP/2 setting
|
|
163
|
+
*/
|
|
164
|
+
export interface HTTP2Setting extends CloudflareSettingBase {
|
|
165
|
+
id: "http2";
|
|
166
|
+
value: HTTP2Value;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* HTTP/3 setting
|
|
170
|
+
*/
|
|
171
|
+
export interface HTTP3Setting extends CloudflareSettingBase {
|
|
172
|
+
id: "http3";
|
|
173
|
+
value: HTTP3Value;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* IP Geolocation setting
|
|
177
|
+
*/
|
|
178
|
+
export interface IPGeolocationSetting extends CloudflareSettingBase {
|
|
179
|
+
id: "ip_geolocation";
|
|
180
|
+
value: "on" | "off";
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* IPv6 setting
|
|
184
|
+
*/
|
|
185
|
+
export interface IPv6Setting extends CloudflareSettingBase {
|
|
186
|
+
id: "ipv6";
|
|
187
|
+
value: IPv6Value;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Minimum TLS Version setting
|
|
191
|
+
*/
|
|
192
|
+
export interface MinTLSVersionSetting extends CloudflareSettingBase {
|
|
193
|
+
id: "min_tls_version";
|
|
194
|
+
value: MinTLSVersionValue;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Opportunistic Encryption setting
|
|
198
|
+
*/
|
|
199
|
+
export interface OpportunisticEncryptionSetting extends CloudflareSettingBase {
|
|
200
|
+
id: "opportunistic_encryption";
|
|
201
|
+
value: "on" | "off";
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* SSL setting
|
|
205
|
+
*/
|
|
206
|
+
export interface SSLSetting extends CloudflareSettingBase {
|
|
207
|
+
id: "ssl";
|
|
208
|
+
value: SSLValue;
|
|
209
|
+
certificate_status?: string;
|
|
210
|
+
validation_errors?: Array<{
|
|
211
|
+
message: string;
|
|
212
|
+
}>;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* TLS 1.3 setting
|
|
216
|
+
*/
|
|
217
|
+
export interface TLS13Setting extends CloudflareSettingBase {
|
|
218
|
+
id: "tls_1_3";
|
|
219
|
+
value: TLS13Value;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* WebSockets setting
|
|
223
|
+
*/
|
|
224
|
+
export interface WebSocketsSetting extends CloudflareSettingBase {
|
|
225
|
+
id: "websockets";
|
|
226
|
+
value: WebSocketsValue;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Zero-RTT setting
|
|
230
|
+
*/
|
|
231
|
+
export interface ZeroRTTSetting extends CloudflareSettingBase {
|
|
232
|
+
id: "0rtt";
|
|
233
|
+
value: ZeroRTTValue;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* All possible zone settings
|
|
237
|
+
*/
|
|
238
|
+
export type CloudflareZoneSetting = AdvancedDDoSSetting | AlwaysOnlineSetting | AlwaysUseHTTPSSetting | AutomaticHTTPSRewritesSetting | AutomaticPlatformOptimizationSetting | BrotliSetting | BrowserCacheTTLSetting | BrowserCheckSetting | CacheLevelSetting | ChallengeTTLSetting | CiphersSetting | DevelopmentModeSetting | EarlyHintsSetting | EmailObfuscationSetting | HotlinkProtectionSetting | HTTP2Setting | HTTP3Setting | IPGeolocationSetting | IPv6Setting | MinTLSVersionSetting | OpportunisticEncryptionSetting | SSLSetting | TLS13Setting | WebSocketsSetting | ZeroRTTSetting;
|
|
239
|
+
/**
|
|
240
|
+
* Input for updating a zone setting
|
|
241
|
+
*/
|
|
242
|
+
export interface UpdateZoneSettingParams {
|
|
243
|
+
/**
|
|
244
|
+
* The value to set
|
|
245
|
+
*/
|
|
246
|
+
value: CloudflareZoneSetting["value"];
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Response for zone settings operations
|
|
250
|
+
*/
|
|
251
|
+
export interface CloudflareZoneSettingResponse {
|
|
252
|
+
/**
|
|
253
|
+
* Whether the API call was successful
|
|
254
|
+
*/
|
|
255
|
+
success: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Any error messages
|
|
258
|
+
*/
|
|
259
|
+
errors: Array<{
|
|
260
|
+
code: number;
|
|
261
|
+
message: string;
|
|
262
|
+
}>;
|
|
263
|
+
/**
|
|
264
|
+
* Any informational messages
|
|
265
|
+
*/
|
|
266
|
+
messages: Array<{
|
|
267
|
+
code: number;
|
|
268
|
+
message: string;
|
|
269
|
+
}>;
|
|
270
|
+
/**
|
|
271
|
+
* The settings that were operated on
|
|
272
|
+
*/
|
|
273
|
+
result: CloudflareZoneSetting[];
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Response for a single zone setting operation
|
|
277
|
+
*/
|
|
278
|
+
export interface CloudflareZoneSettingSingleResponse {
|
|
279
|
+
/**
|
|
280
|
+
* Whether the API call was successful
|
|
281
|
+
*/
|
|
282
|
+
success: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Any error messages
|
|
285
|
+
*/
|
|
286
|
+
errors: Array<{
|
|
287
|
+
code: number;
|
|
288
|
+
message: string;
|
|
289
|
+
}>;
|
|
290
|
+
/**
|
|
291
|
+
* Any informational messages
|
|
292
|
+
*/
|
|
293
|
+
messages: Array<{
|
|
294
|
+
code: number;
|
|
295
|
+
message: string;
|
|
296
|
+
}>;
|
|
297
|
+
/**
|
|
298
|
+
* The setting that was operated on
|
|
299
|
+
*/
|
|
300
|
+
result: CloudflareZoneSetting;
|
|
301
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|