alchemy 0.1.18 → 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.
Files changed (330) hide show
  1. package/README.md +506 -0
  2. package/lib/alchemy.d.ts +67 -0
  3. package/lib/alchemy.js +48 -0
  4. package/lib/apply.d.ts +3 -20
  5. package/lib/apply.js +95 -82
  6. package/lib/aws/account-id.d.ts +0 -1
  7. package/lib/aws/account-id.js +0 -1
  8. package/lib/aws/bucket.d.ts +4 -7
  9. package/lib/aws/bucket.js +8 -12
  10. package/lib/aws/function.d.ts +4 -7
  11. package/lib/aws/function.js +9 -30
  12. package/lib/aws/index.d.ts +1 -1
  13. package/lib/aws/index.js +1 -1
  14. package/lib/aws/oidc/github-oidc-provider.d.ts +2 -6
  15. package/lib/aws/oidc/github-oidc-provider.js +10 -15
  16. package/lib/aws/oidc/index.d.ts +0 -1
  17. package/lib/aws/oidc/index.js +0 -1
  18. package/lib/aws/oidc/oidc-provider.d.ts +4 -6
  19. package/lib/aws/oidc/oidc-provider.js +9 -11
  20. package/lib/aws/policy-attachment.d.ts +9 -0
  21. package/lib/aws/policy-attachment.js +20 -0
  22. package/lib/aws/policy.d.ts +4 -16
  23. package/lib/aws/policy.js +9 -40
  24. package/lib/aws/queue.d.ts +4 -34
  25. package/lib/aws/queue.js +10 -20
  26. package/lib/aws/role.d.ts +4 -7
  27. package/lib/aws/role.js +17 -26
  28. package/lib/aws/ses.d.ts +4 -10
  29. package/lib/aws/ses.js +118 -131
  30. package/lib/aws/table.d.ts +4 -7
  31. package/lib/aws/table.js +8 -11
  32. package/lib/cloudflare/api.d.ts +0 -1
  33. package/lib/cloudflare/api.js +0 -1
  34. package/lib/cloudflare/asset-manifest.d.ts +0 -1
  35. package/lib/cloudflare/asset-manifest.js +0 -1
  36. package/lib/cloudflare/auth.d.ts +0 -1
  37. package/lib/cloudflare/auth.js +0 -1
  38. package/lib/cloudflare/bindings.d.ts +1 -1
  39. package/lib/cloudflare/bindings.js +3 -2
  40. package/lib/cloudflare/bound.d.ts +0 -1
  41. package/lib/cloudflare/bound.js +0 -1
  42. package/lib/cloudflare/bucket.d.ts +7 -15
  43. package/lib/cloudflare/bucket.js +12 -19
  44. package/lib/cloudflare/durable-object-namespace.d.ts +0 -3
  45. package/lib/cloudflare/durable-object-namespace.js +0 -4
  46. package/lib/cloudflare/generate-asset-manifest.d.ts +0 -1
  47. package/lib/cloudflare/generate-asset-manifest.js +1 -2
  48. package/lib/cloudflare/index.d.ts +2 -1
  49. package/lib/cloudflare/index.js +2 -1
  50. package/lib/cloudflare/kv-namespace.d.ts +6 -9
  51. package/lib/cloudflare/kv-namespace.js +16 -20
  52. package/lib/cloudflare/state.d.ts +0 -1
  53. package/lib/cloudflare/state.js +0 -1
  54. package/lib/cloudflare/static-site-router.d.ts +0 -1
  55. package/lib/cloudflare/static-site-router.js +0 -4
  56. package/lib/cloudflare/static-site.d.ts +5 -11
  57. package/lib/cloudflare/static-site.js +25 -37
  58. package/lib/cloudflare/types.d.ts +0 -1
  59. package/lib/cloudflare/types.js +0 -1
  60. package/lib/cloudflare/upload-asset-manifest.d.ts +0 -1
  61. package/lib/cloudflare/upload-asset-manifest.js +0 -1
  62. package/lib/cloudflare/worker-metadata.d.ts +0 -1
  63. package/lib/cloudflare/worker-metadata.js +0 -1
  64. package/lib/cloudflare/worker-migration.d.ts +0 -1
  65. package/lib/cloudflare/worker-migration.js +0 -1
  66. package/lib/cloudflare/worker.d.ts +8 -14
  67. package/lib/cloudflare/worker.js +38 -50
  68. package/lib/cloudflare/wrangler.json.d.ts +243 -0
  69. package/lib/cloudflare/wrangler.json.js +35 -0
  70. package/lib/cloudflare/zone-settings.d.ts +301 -0
  71. package/lib/cloudflare/zone-settings.js +1 -0
  72. package/lib/cloudflare/zone.d.ts +196 -0
  73. package/lib/cloudflare/zone.js +175 -0
  74. package/lib/context.d.ts +58 -0
  75. package/lib/context.js +36 -0
  76. package/lib/destroy.d.ts +10 -13
  77. package/lib/destroy.js +104 -43
  78. package/lib/{esbuild.d.ts → esbuild/bundle.d.ts} +4 -18
  79. package/lib/{esbuild.js → esbuild/bundle.js} +10 -24
  80. package/lib/esbuild/index.d.ts +1 -0
  81. package/lib/esbuild/index.js +1 -0
  82. package/lib/fs/file.d.ts +13 -0
  83. package/lib/fs/file.js +20 -0
  84. package/lib/fs/folder.d.ts +10 -0
  85. package/lib/fs/folder.js +16 -0
  86. package/lib/fs/index.d.ts +2 -0
  87. package/lib/fs/index.js +2 -0
  88. package/lib/github/client.d.ts +0 -1
  89. package/lib/github/client.js +0 -1
  90. package/lib/github/index.d.ts +0 -1
  91. package/lib/github/index.js +0 -1
  92. package/lib/github/secret.d.ts +4 -6
  93. package/lib/github/secret.js +10 -12
  94. package/lib/index.d.ts +6 -10
  95. package/lib/index.js +5 -9
  96. package/lib/project/index.d.ts +1 -0
  97. package/lib/project/index.js +1 -0
  98. package/lib/project/vite.d.ts +39 -0
  99. package/lib/project/vite.js +68 -0
  100. package/lib/resource.d.ts +34 -62
  101. package/lib/resource.js +29 -270
  102. package/lib/scope.d.ts +37 -14
  103. package/lib/scope.js +97 -23
  104. package/lib/secret.d.ts +2 -7
  105. package/lib/secret.js +7 -20
  106. package/lib/state.d.ts +14 -10
  107. package/lib/state.js +20 -14
  108. package/lib/stripe/index.d.ts +0 -1
  109. package/lib/stripe/index.js +0 -1
  110. package/lib/stripe/price.d.ts +4 -5
  111. package/lib/stripe/price.js +10 -20
  112. package/lib/stripe/product.d.ts +4 -5
  113. package/lib/stripe/product.js +10 -20
  114. package/lib/stripe/webhook.d.ts +4 -6
  115. package/lib/stripe/webhook.js +12 -25
  116. package/lib/test/bun.d.ts +19 -0
  117. package/lib/test/bun.js +55 -0
  118. package/lib/{utils → util}/content-type.d.ts +0 -1
  119. package/lib/{utils → util}/content-type.js +0 -1
  120. package/lib/{encrypt.d.ts → util/encrypt.d.ts} +0 -1
  121. package/lib/{encrypt.js → util/encrypt.js} +0 -1
  122. package/lib/{error.d.ts → util/ignore.d.ts} +0 -1
  123. package/lib/{error.js → util/ignore.js} +0 -1
  124. package/lib/{utils → util}/retry.d.ts +0 -1
  125. package/lib/{utils → util}/retry.js +0 -1
  126. package/lib/util/rm.d.ts +1 -0
  127. package/lib/util/rm.js +11 -0
  128. package/lib/util/serde.d.ts +3 -0
  129. package/lib/{serde.js → util/serde.js} +19 -10
  130. package/lib/util/slugify.d.ts +1 -0
  131. package/lib/util/slugify.js +3 -0
  132. package/package.json +7 -5
  133. package/src/alchemy.ts +127 -0
  134. package/src/apply.ts +116 -115
  135. package/src/aws/bucket.ts +11 -14
  136. package/src/aws/function.ts +13 -33
  137. package/src/aws/index.ts +1 -0
  138. package/src/aws/oidc/github-oidc-provider.ts +14 -19
  139. package/src/aws/oidc/oidc-provider.ts +19 -12
  140. package/src/aws/policy-attachment.ts +51 -0
  141. package/src/aws/policy.ts +15 -60
  142. package/src/aws/queue.ts +17 -21
  143. package/src/aws/role.ts +25 -28
  144. package/src/aws/ses.ts +150 -164
  145. package/src/aws/table.ts +15 -15
  146. package/src/cloudflare/bindings.ts +8 -0
  147. package/src/cloudflare/bucket.ts +39 -47
  148. package/src/cloudflare/durable-object-namespace.ts +0 -10
  149. package/src/cloudflare/generate-asset-manifest.ts +1 -1
  150. package/src/cloudflare/index.ts +2 -0
  151. package/src/cloudflare/kv-namespace.ts +35 -33
  152. package/src/cloudflare/static-site-router.ts +0 -3
  153. package/src/cloudflare/static-site.ts +55 -71
  154. package/src/cloudflare/worker.ts +106 -112
  155. package/src/cloudflare/wrangler.json.ts +309 -0
  156. package/src/cloudflare/zone-settings.ts +368 -0
  157. package/src/cloudflare/zone.ts +491 -0
  158. package/src/context.ts +122 -0
  159. package/src/destroy.ts +124 -73
  160. package/src/{esbuild.ts → esbuild/bundle.ts} +16 -28
  161. package/src/esbuild/index.ts +1 -0
  162. package/src/fs/file.ts +39 -0
  163. package/src/fs/folder.ts +32 -0
  164. package/src/fs/index.ts +2 -0
  165. package/src/github/secret.ts +19 -16
  166. package/src/index.ts +7 -15
  167. package/src/project/index.ts +1 -0
  168. package/src/project/vite.ts +152 -0
  169. package/src/resource.ts +101 -462
  170. package/src/scope.ts +125 -36
  171. package/src/secret.ts +9 -32
  172. package/src/state.ts +38 -21
  173. package/src/stripe/price.ts +17 -22
  174. package/src/stripe/product.ts +17 -22
  175. package/src/stripe/webhook.ts +21 -27
  176. package/src/test/bun.ts +105 -0
  177. package/src/util/rm.ts +11 -0
  178. package/src/util/serde.ts +53 -0
  179. package/src/util/slugify.ts +3 -0
  180. package/lib/$.d.ts +0 -12
  181. package/lib/$.d.ts.map +0 -1
  182. package/lib/$.js +0 -42
  183. package/lib/$.js.map +0 -1
  184. package/lib/alchemize.d.ts +0 -47
  185. package/lib/alchemize.d.ts.map +0 -1
  186. package/lib/alchemize.js +0 -116
  187. package/lib/alchemize.js.map +0 -1
  188. package/lib/apply.d.ts.map +0 -1
  189. package/lib/apply.js.map +0 -1
  190. package/lib/aws/account-id.d.ts.map +0 -1
  191. package/lib/aws/account-id.js.map +0 -1
  192. package/lib/aws/bucket.d.ts.map +0 -1
  193. package/lib/aws/bucket.js.map +0 -1
  194. package/lib/aws/function.d.ts.map +0 -1
  195. package/lib/aws/function.js.map +0 -1
  196. package/lib/aws/index.d.ts.map +0 -1
  197. package/lib/aws/index.js.map +0 -1
  198. package/lib/aws/oidc/github-oidc-provider.d.ts.map +0 -1
  199. package/lib/aws/oidc/github-oidc-provider.js.map +0 -1
  200. package/lib/aws/oidc/index.d.ts.map +0 -1
  201. package/lib/aws/oidc/index.js.map +0 -1
  202. package/lib/aws/oidc/oidc-provider.d.ts.map +0 -1
  203. package/lib/aws/oidc/oidc-provider.js.map +0 -1
  204. package/lib/aws/policy.d.ts.map +0 -1
  205. package/lib/aws/policy.js.map +0 -1
  206. package/lib/aws/queue.d.ts.map +0 -1
  207. package/lib/aws/queue.js.map +0 -1
  208. package/lib/aws/role.d.ts.map +0 -1
  209. package/lib/aws/role.js.map +0 -1
  210. package/lib/aws/ses.d.ts.map +0 -1
  211. package/lib/aws/ses.js.map +0 -1
  212. package/lib/aws/table.d.ts.map +0 -1
  213. package/lib/aws/table.js.map +0 -1
  214. package/lib/cloudflare/api.d.ts.map +0 -1
  215. package/lib/cloudflare/api.js.map +0 -1
  216. package/lib/cloudflare/asset-manifest.d.ts.map +0 -1
  217. package/lib/cloudflare/asset-manifest.js.map +0 -1
  218. package/lib/cloudflare/auth.d.ts.map +0 -1
  219. package/lib/cloudflare/auth.js.map +0 -1
  220. package/lib/cloudflare/bindings.d.ts.map +0 -1
  221. package/lib/cloudflare/bindings.js.map +0 -1
  222. package/lib/cloudflare/bound.d.ts.map +0 -1
  223. package/lib/cloudflare/bound.js.map +0 -1
  224. package/lib/cloudflare/bucket.d.ts.map +0 -1
  225. package/lib/cloudflare/bucket.js.map +0 -1
  226. package/lib/cloudflare/durable-object-namespace.d.ts.map +0 -1
  227. package/lib/cloudflare/durable-object-namespace.js.map +0 -1
  228. package/lib/cloudflare/generate-asset-manifest.d.ts.map +0 -1
  229. package/lib/cloudflare/generate-asset-manifest.js.map +0 -1
  230. package/lib/cloudflare/index.d.ts.map +0 -1
  231. package/lib/cloudflare/index.js.map +0 -1
  232. package/lib/cloudflare/kv-namespace.d.ts.map +0 -1
  233. package/lib/cloudflare/kv-namespace.js.map +0 -1
  234. package/lib/cloudflare/state.d.ts.map +0 -1
  235. package/lib/cloudflare/state.js.map +0 -1
  236. package/lib/cloudflare/static-site-router.d.ts.map +0 -1
  237. package/lib/cloudflare/static-site-router.js.map +0 -1
  238. package/lib/cloudflare/static-site.d.ts.map +0 -1
  239. package/lib/cloudflare/static-site.js.map +0 -1
  240. package/lib/cloudflare/types.d.ts.map +0 -1
  241. package/lib/cloudflare/types.js.map +0 -1
  242. package/lib/cloudflare/upload-asset-manifest.d.ts.map +0 -1
  243. package/lib/cloudflare/upload-asset-manifest.js.map +0 -1
  244. package/lib/cloudflare/worker-metadata.d.ts.map +0 -1
  245. package/lib/cloudflare/worker-metadata.js.map +0 -1
  246. package/lib/cloudflare/worker-migration.d.ts.map +0 -1
  247. package/lib/cloudflare/worker-migration.js.map +0 -1
  248. package/lib/cloudflare/worker.d.ts.map +0 -1
  249. package/lib/cloudflare/worker.js.map +0 -1
  250. package/lib/destroy.d.ts.map +0 -1
  251. package/lib/destroy.js.map +0 -1
  252. package/lib/encrypt.d.ts.map +0 -1
  253. package/lib/encrypt.js.map +0 -1
  254. package/lib/error.d.ts.map +0 -1
  255. package/lib/error.js.map +0 -1
  256. package/lib/esbuild.d.ts.map +0 -1
  257. package/lib/esbuild.js.map +0 -1
  258. package/lib/fs.d.ts +0 -12
  259. package/lib/fs.d.ts.map +0 -1
  260. package/lib/fs.js +0 -41
  261. package/lib/fs.js.map +0 -1
  262. package/lib/github/client.d.ts.map +0 -1
  263. package/lib/github/client.js.map +0 -1
  264. package/lib/github/index.d.ts.map +0 -1
  265. package/lib/github/index.js.map +0 -1
  266. package/lib/github/secret.d.ts.map +0 -1
  267. package/lib/github/secret.js.map +0 -1
  268. package/lib/global.d.ts +0 -16
  269. package/lib/global.d.ts.map +0 -1
  270. package/lib/global.js +0 -42
  271. package/lib/global.js.map +0 -1
  272. package/lib/index.d.ts.map +0 -1
  273. package/lib/index.js.map +0 -1
  274. package/lib/input.d.ts +0 -7
  275. package/lib/input.d.ts.map +0 -1
  276. package/lib/input.js +0 -2
  277. package/lib/input.js.map +0 -1
  278. package/lib/main.d.ts +0 -3
  279. package/lib/main.d.ts.map +0 -1
  280. package/lib/main.js +0 -32
  281. package/lib/main.js.map +0 -1
  282. package/lib/output.d.ts +0 -25
  283. package/lib/output.d.ts.map +0 -1
  284. package/lib/output.js +0 -23
  285. package/lib/output.js.map +0 -1
  286. package/lib/print.d.ts +0 -7
  287. package/lib/print.d.ts.map +0 -1
  288. package/lib/print.js +0 -10
  289. package/lib/print.js.map +0 -1
  290. package/lib/resource.d.ts.map +0 -1
  291. package/lib/resource.js.map +0 -1
  292. package/lib/scope.d.ts.map +0 -1
  293. package/lib/scope.js.map +0 -1
  294. package/lib/secret.d.ts.map +0 -1
  295. package/lib/secret.js.map +0 -1
  296. package/lib/serde.d.ts +0 -3
  297. package/lib/serde.d.ts.map +0 -1
  298. package/lib/serde.js.map +0 -1
  299. package/lib/slug.d.ts +0 -2
  300. package/lib/slug.d.ts.map +0 -1
  301. package/lib/slug.js +0 -4
  302. package/lib/slug.js.map +0 -1
  303. package/lib/state.d.ts.map +0 -1
  304. package/lib/state.js.map +0 -1
  305. package/lib/stripe/index.d.ts.map +0 -1
  306. package/lib/stripe/index.js.map +0 -1
  307. package/lib/stripe/price.d.ts.map +0 -1
  308. package/lib/stripe/price.js.map +0 -1
  309. package/lib/stripe/product.d.ts.map +0 -1
  310. package/lib/stripe/product.js.map +0 -1
  311. package/lib/stripe/webhook.d.ts.map +0 -1
  312. package/lib/stripe/webhook.js.map +0 -1
  313. package/lib/utils/content-type.d.ts.map +0 -1
  314. package/lib/utils/content-type.js.map +0 -1
  315. package/lib/utils/retry.d.ts.map +0 -1
  316. package/lib/utils/retry.js.map +0 -1
  317. package/src/$.ts +0 -69
  318. package/src/alchemize.ts +0 -195
  319. package/src/fs.ts +0 -47
  320. package/src/global.ts +0 -63
  321. package/src/input.ts +0 -19
  322. package/src/main.ts +0 -34
  323. package/src/output.ts +0 -75
  324. package/src/print.ts +0 -18
  325. package/src/serde.ts +0 -46
  326. package/src/slug.ts +0 -3
  327. /package/src/{utils → util}/content-type.ts +0 -0
  328. /package/src/{encrypt.ts → util/encrypt.ts} +0 -0
  329. /package/src/{error.ts → util/ignore.ts} +0 -0
  330. /package/src/{utils → util}/retry.ts +0 -0
@@ -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 {};