@sst-community/sst 4.20.0 → 5.0.0-alpha.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 (832) hide show
  1. package/README.md +92 -52
  2. package/package.json +35 -11
  3. package/platform/js/chunks/chunk-HIZZCEDS.js +328 -0
  4. package/platform/js/chunks/chunk-HIZZCEDS.js.map +6 -0
  5. package/platform/js/chunks/chunk-KOKHGKJ2.js +639 -0
  6. package/platform/js/chunks/chunk-KOKHGKJ2.js.map +6 -0
  7. package/platform/js/chunks/chunk-ONNI4XNK.js +367 -0
  8. package/platform/js/chunks/chunk-ONNI4XNK.js.map +6 -0
  9. package/platform/js/chunks/chunk-VIFHC73J.js +108 -0
  10. package/platform/js/chunks/chunk-VIFHC73J.js.map +6 -0
  11. package/platform/js/chunks/chunk-WJ6BVA46.js +10 -0
  12. package/platform/js/chunks/chunk-WJ6BVA46.js.map +6 -0
  13. package/platform/js/chunks/chunk-ZOXXXME5.js +472 -0
  14. package/platform/js/chunks/chunk-ZOXXXME5.js.map +6 -0
  15. package/platform/js/chunks/component-32FCLIRK.js +26 -0
  16. package/platform/js/chunks/component-32FCLIRK.js.map +6 -0
  17. package/platform/js/chunks/config-DMGMTLNB.js +10 -0
  18. package/platform/js/chunks/config-DMGMTLNB.js.map +6 -0
  19. package/platform/js/chunks/link-OJ3RNGQ3.js +9 -0
  20. package/platform/js/chunks/link-OJ3RNGQ3.js.map +6 -0
  21. package/platform/js/components/aws/index.js +35362 -0
  22. package/platform/js/components/aws/index.js.map +6 -0
  23. package/platform/js/components/cloudflare/index.js +3246 -0
  24. package/platform/js/components/cloudflare/index.js.map +6 -0
  25. package/platform/js/components/core.js +114 -0
  26. package/platform/js/components/core.js.map +6 -0
  27. package/platform/js/components/vercel/index.js +120 -0
  28. package/platform/js/components/vercel/index.js.map +6 -0
  29. package/platform/js/testing/index.js +569 -0
  30. package/platform/js/testing/index.js.map +6 -0
  31. package/platform/package.json +25 -0
  32. package/platform/src/ast/add.mjs +190 -0
  33. package/platform/src/auto/run.ts +109 -0
  34. package/platform/src/components/README.md +652 -0
  35. package/platform/src/components/args.ts +133 -0
  36. package/platform/src/components/aws/alb.ts +577 -0
  37. package/platform/src/components/aws/analog.ts +462 -0
  38. package/platform/src/components/aws/apigateway-websocket-route.ts +206 -0
  39. package/platform/src/components/aws/apigateway-websocket.ts +894 -0
  40. package/platform/src/components/aws/apigatewayv1-api-key.ts +90 -0
  41. package/platform/src/components/aws/apigatewayv1-authorizer.ts +178 -0
  42. package/platform/src/components/aws/apigatewayv1-base-route.ts +78 -0
  43. package/platform/src/components/aws/apigatewayv1-integration-route.ts +92 -0
  44. package/platform/src/components/aws/apigatewayv1-lambda-route.ts +152 -0
  45. package/platform/src/components/aws/apigatewayv1-usage-plan.ts +109 -0
  46. package/platform/src/components/aws/apigatewayv1.ts +1691 -0
  47. package/platform/src/components/aws/apigatewayv2-authorizer.ts +199 -0
  48. package/platform/src/components/aws/apigatewayv2-base-route.ts +69 -0
  49. package/platform/src/components/aws/apigatewayv2-lambda-route.ts +141 -0
  50. package/platform/src/components/aws/apigatewayv2-private-route.ts +101 -0
  51. package/platform/src/components/aws/apigatewayv2-url-route.ts +90 -0
  52. package/platform/src/components/aws/apigatewayv2.ts +1439 -0
  53. package/platform/src/components/aws/app-sync-data-source.ts +264 -0
  54. package/platform/src/components/aws/app-sync-function.ts +79 -0
  55. package/platform/src/components/aws/app-sync-resolver.ts +110 -0
  56. package/platform/src/components/aws/app-sync.ts +849 -0
  57. package/platform/src/components/aws/astro.ts +580 -0
  58. package/platform/src/components/aws/aurora.ts +1356 -0
  59. package/platform/src/components/aws/auth-v1.ts +69 -0
  60. package/platform/src/components/aws/auth.ts +417 -0
  61. package/platform/src/components/aws/bucket-lambda-subscriber.ts +162 -0
  62. package/platform/src/components/aws/bucket-notification.ts +254 -0
  63. package/platform/src/components/aws/bucket-queue-subscriber.ts +122 -0
  64. package/platform/src/components/aws/bucket-topic-subscriber.ts +144 -0
  65. package/platform/src/components/aws/bucket.ts +2046 -0
  66. package/platform/src/components/aws/bus-base-subscriber.ts +52 -0
  67. package/platform/src/components/aws/bus-lambda-subscriber.ts +125 -0
  68. package/platform/src/components/aws/bus-queue-subscriber.ts +88 -0
  69. package/platform/src/components/aws/bus.ts +630 -0
  70. package/platform/src/components/aws/cdn.ts +561 -0
  71. package/platform/src/components/aws/cluster-v1.ts +932 -0
  72. package/platform/src/components/aws/cluster.ts +584 -0
  73. package/platform/src/components/aws/cognito-identity-pool.ts +433 -0
  74. package/platform/src/components/aws/cognito-identity-provider.ts +96 -0
  75. package/platform/src/components/aws/cognito-user-pool-client.ts +114 -0
  76. package/platform/src/components/aws/cognito-user-pool.ts +1089 -0
  77. package/platform/src/components/aws/cron-v2.ts +555 -0
  78. package/platform/src/components/aws/cron.ts +435 -0
  79. package/platform/src/components/aws/dns-validated-certificate.ts +108 -0
  80. package/platform/src/components/aws/dns.ts +221 -0
  81. package/platform/src/components/aws/dsql.ts +741 -0
  82. package/platform/src/components/aws/dynamo-lambda-subscriber.ts +124 -0
  83. package/platform/src/components/aws/dynamo.ts +929 -0
  84. package/platform/src/components/aws/efs.ts +410 -0
  85. package/platform/src/components/aws/email.ts +673 -0
  86. package/platform/src/components/aws/fargate.ts +1279 -0
  87. package/platform/src/components/aws/function.ts +3227 -0
  88. package/platform/src/components/aws/helpers/apigateway-account.ts +78 -0
  89. package/platform/src/components/aws/helpers/apigatewayv2-domain.ts +144 -0
  90. package/platform/src/components/aws/helpers/arn.ts +182 -0
  91. package/platform/src/components/aws/helpers/bootstrap.ts +16 -0
  92. package/platform/src/components/aws/helpers/client.ts +76 -0
  93. package/platform/src/components/aws/helpers/container-builder.ts +33 -0
  94. package/platform/src/components/aws/helpers/custom-domain.ts +128 -0
  95. package/platform/src/components/aws/helpers/event-source.ts +41 -0
  96. package/platform/src/components/aws/helpers/fargate.ts +727 -0
  97. package/platform/src/components/aws/helpers/function-builder.ts +133 -0
  98. package/platform/src/components/aws/helpers/function-code.ts +224 -0
  99. package/platform/src/components/aws/helpers/function-part.ts +202 -0
  100. package/platform/src/components/aws/helpers/function-permission.ts +29 -0
  101. package/platform/src/components/aws/helpers/load-balancer-args.ts +88 -0
  102. package/platform/src/components/aws/helpers/load-balancer.ts +17 -0
  103. package/platform/src/components/aws/helpers/provider.ts +36 -0
  104. package/platform/src/components/aws/helpers/queue-policy.ts +33 -0
  105. package/platform/src/components/aws/helpers/rds.ts +212 -0
  106. package/platform/src/components/aws/helpers/site-builder.ts +41 -0
  107. package/platform/src/components/aws/helpers/subscriber.ts +23 -0
  108. package/platform/src/components/aws/helpers/vpc.ts +27 -0
  109. package/platform/src/components/aws/https-redirect.ts +216 -0
  110. package/platform/src/components/aws/iam-edit.ts +50 -0
  111. package/platform/src/components/aws/index.ts +61 -0
  112. package/platform/src/components/aws/kinesis-stream-lambda-subscriber.ts +122 -0
  113. package/platform/src/components/aws/kinesis-stream.ts +416 -0
  114. package/platform/src/components/aws/linkable.ts +32 -0
  115. package/platform/src/components/aws/logging.ts +25 -0
  116. package/platform/src/components/aws/microvm.ts +988 -0
  117. package/platform/src/components/aws/mysql.ts +1047 -0
  118. package/platform/src/components/aws/nextjs.ts +1052 -0
  119. package/platform/src/components/aws/nuxt.ts +527 -0
  120. package/platform/src/components/aws/open-search.ts +603 -0
  121. package/platform/src/components/aws/opencontrol.ts +235 -0
  122. package/platform/src/components/aws/permission.ts +80 -0
  123. package/platform/src/components/aws/postgres-v1.ts +537 -0
  124. package/platform/src/components/aws/postgres.ts +1074 -0
  125. package/platform/src/components/aws/providers/bucket-files.ts +32 -0
  126. package/platform/src/components/aws/providers/distribution-deployment-waiter.ts +27 -0
  127. package/platform/src/components/aws/providers/distribution-invalidation.ts +24 -0
  128. package/platform/src/components/aws/providers/function-environment-update.ts +46 -0
  129. package/platform/src/components/aws/providers/hosted-zone-lookup.ts +25 -0
  130. package/platform/src/components/aws/providers/kv-keys.ts +15 -0
  131. package/platform/src/components/aws/providers/kv-routes-update.ts +24 -0
  132. package/platform/src/components/aws/providers/microvm-image-prune.ts +48 -0
  133. package/platform/src/components/aws/providers/origin-access-control.ts +21 -0
  134. package/platform/src/components/aws/providers/rds-role-lookup.ts +21 -0
  135. package/platform/src/components/aws/providers/vector-table.ts +25 -0
  136. package/platform/src/components/aws/queue-lambda-subscriber.ts +135 -0
  137. package/platform/src/components/aws/queue.ts +712 -0
  138. package/platform/src/components/aws/react.ts +510 -0
  139. package/platform/src/components/aws/realtime-lambda-subscriber.ts +129 -0
  140. package/platform/src/components/aws/realtime.ts +345 -0
  141. package/platform/src/components/aws/redis-v1.ts +595 -0
  142. package/platform/src/components/aws/redis.ts +1078 -0
  143. package/platform/src/components/aws/remix.ts +576 -0
  144. package/platform/src/components/aws/router-base-route.ts +83 -0
  145. package/platform/src/components/aws/router-bucket-route.ts +63 -0
  146. package/platform/src/components/aws/router-url-route.ts +75 -0
  147. package/platform/src/components/aws/router.ts +3281 -0
  148. package/platform/src/components/aws/service-v1.ts +876 -0
  149. package/platform/src/components/aws/service.ts +2994 -0
  150. package/platform/src/components/aws/sns-topic-lambda-subscriber.ts +127 -0
  151. package/platform/src/components/aws/sns-topic-queue-subscriber.ts +105 -0
  152. package/platform/src/components/aws/sns-topic.ts +700 -0
  153. package/platform/src/components/aws/solid-start.ts +467 -0
  154. package/platform/src/components/aws/ssr-site.ts +2204 -0
  155. package/platform/src/components/aws/static-site.ts +1389 -0
  156. package/platform/src/components/aws/step-functions/choice.ts +123 -0
  157. package/platform/src/components/aws/step-functions/fail.ts +69 -0
  158. package/platform/src/components/aws/step-functions/map.ts +264 -0
  159. package/platform/src/components/aws/step-functions/parallel.ts +170 -0
  160. package/platform/src/components/aws/step-functions/pass.ts +48 -0
  161. package/platform/src/components/aws/step-functions/state.ts +376 -0
  162. package/platform/src/components/aws/step-functions/succeed.ts +31 -0
  163. package/platform/src/components/aws/step-functions/task.ts +538 -0
  164. package/platform/src/components/aws/step-functions/wait.ts +105 -0
  165. package/platform/src/components/aws/step-functions.ts +804 -0
  166. package/platform/src/components/aws/svelte-kit.ts +563 -0
  167. package/platform/src/components/aws/takeover/alb.ts +9 -0
  168. package/platform/src/components/aws/takeover/apigatewayv2.ts +43 -0
  169. package/platform/src/components/aws/takeover/app-sync.ts +45 -0
  170. package/platform/src/components/aws/takeover/aurora.ts +19 -0
  171. package/platform/src/components/aws/takeover/bucket.ts +94 -0
  172. package/platform/src/components/aws/takeover/bus.ts +43 -0
  173. package/platform/src/components/aws/takeover/cognito-user-pool.ts +21 -0
  174. package/platform/src/components/aws/takeover/cron-v2.ts +9 -0
  175. package/platform/src/components/aws/takeover/dsql.ts +12 -0
  176. package/platform/src/components/aws/takeover/dynamo.ts +31 -0
  177. package/platform/src/components/aws/takeover/efs.ts +9 -0
  178. package/platform/src/components/aws/takeover/function.ts +21 -0
  179. package/platform/src/components/aws/takeover/helpers.ts +26 -0
  180. package/platform/src/components/aws/takeover/index.ts +27 -0
  181. package/platform/src/components/aws/takeover/mysql.ts +17 -0
  182. package/platform/src/components/aws/takeover/postgres.ts +17 -0
  183. package/platform/src/components/aws/takeover/queue.ts +21 -0
  184. package/platform/src/components/aws/takeover/redis.ts +10 -0
  185. package/platform/src/components/aws/takeover/service.ts +22 -0
  186. package/platform/src/components/aws/takeover/sns-topic.ts +27 -0
  187. package/platform/src/components/aws/takeover/task.ts +13 -0
  188. package/platform/src/components/aws/tan-stack-start.ts +479 -0
  189. package/platform/src/components/aws/task.ts +571 -0
  190. package/platform/src/components/aws/v5/alb.ts +310 -0
  191. package/platform/src/components/aws/v5/apigatewayv2.ts +845 -0
  192. package/platform/src/components/aws/v5/app-sync.ts +673 -0
  193. package/platform/src/components/aws/v5/aurora.ts +855 -0
  194. package/platform/src/components/aws/v5/bucket.ts +1001 -0
  195. package/platform/src/components/aws/v5/bus.ts +321 -0
  196. package/platform/src/components/aws/v5/cluster.ts +230 -0
  197. package/platform/src/components/aws/v5/cognito-user-pool-client.ts +100 -0
  198. package/platform/src/components/aws/v5/cognito-user-pool.ts +693 -0
  199. package/platform/src/components/aws/v5/cron-v2.ts +316 -0
  200. package/platform/src/components/aws/v5/dsql.ts +665 -0
  201. package/platform/src/components/aws/v5/dynamo.ts +477 -0
  202. package/platform/src/components/aws/v5/efs.ts +311 -0
  203. package/platform/src/components/aws/v5/function.ts +1527 -0
  204. package/platform/src/components/aws/v5/index.ts +26 -0
  205. package/platform/src/components/aws/v5/mysql.ts +604 -0
  206. package/platform/src/components/aws/v5/postgres.ts +612 -0
  207. package/platform/src/components/aws/v5/queue.ts +271 -0
  208. package/platform/src/components/aws/v5/redis.ts +550 -0
  209. package/platform/src/components/aws/v5/service.ts +2209 -0
  210. package/platform/src/components/aws/v5/sns-topic.ts +284 -0
  211. package/platform/src/components/aws/v5/task.ts +549 -0
  212. package/platform/src/components/aws/vector.ts +316 -0
  213. package/platform/src/components/aws/vpc-v1.ts +580 -0
  214. package/platform/src/components/aws/vpc.ts +1641 -0
  215. package/platform/src/components/aws/workflow.ts +421 -0
  216. package/platform/src/components/base/base-site.ts +101 -0
  217. package/platform/src/components/base/base-ssr-site.ts +120 -0
  218. package/platform/src/components/base/base-static-site.ts +314 -0
  219. package/platform/src/components/cloudflare/account-id.ts +1 -0
  220. package/platform/src/components/cloudflare/ai.ts +77 -0
  221. package/platform/src/components/cloudflare/astro.ts +355 -0
  222. package/platform/src/components/cloudflare/auth.ts +69 -0
  223. package/platform/src/components/cloudflare/binding.ts +132 -0
  224. package/platform/src/components/cloudflare/bucket.ts +142 -0
  225. package/platform/src/components/cloudflare/cron.ts +207 -0
  226. package/platform/src/components/cloudflare/d1.ts +230 -0
  227. package/platform/src/components/cloudflare/dns.ts +253 -0
  228. package/platform/src/components/cloudflare/durable-object.ts +144 -0
  229. package/platform/src/components/cloudflare/experimental/index.ts +3 -0
  230. package/platform/src/components/cloudflare/experimental/solid-start.ts +288 -0
  231. package/platform/src/components/cloudflare/experimental/static-site.ts +4 -0
  232. package/platform/src/components/cloudflare/helpers/compatibility.ts +44 -0
  233. package/platform/src/components/cloudflare/helpers/fetch.ts +81 -0
  234. package/platform/src/components/cloudflare/helpers/validation.ts +74 -0
  235. package/platform/src/components/cloudflare/helpers/worker-builder.ts +57 -0
  236. package/platform/src/components/cloudflare/helpers/wrangler.ts +222 -0
  237. package/platform/src/components/cloudflare/hyperdrive.ts +402 -0
  238. package/platform/src/components/cloudflare/index.ts +25 -0
  239. package/platform/src/components/cloudflare/kv.ts +218 -0
  240. package/platform/src/components/cloudflare/providers/dns-record.ts +43 -0
  241. package/platform/src/components/cloudflare/providers/kv-data.ts +107 -0
  242. package/platform/src/components/cloudflare/providers/worker-assets.ts +41 -0
  243. package/platform/src/components/cloudflare/providers/worker-placement.ts +93 -0
  244. package/platform/src/components/cloudflare/providers/worker-script.ts +47 -0
  245. package/platform/src/components/cloudflare/providers/worker-url.ts +109 -0
  246. package/platform/src/components/cloudflare/providers/zone-lookup.ts +85 -0
  247. package/platform/src/components/cloudflare/queue-worker-subscriber.ts +192 -0
  248. package/platform/src/components/cloudflare/queue.ts +310 -0
  249. package/platform/src/components/cloudflare/rate-limit.ts +178 -0
  250. package/platform/src/components/cloudflare/react-router.ts +322 -0
  251. package/platform/src/components/cloudflare/ssr-site.ts +293 -0
  252. package/platform/src/components/cloudflare/static-site-v2.ts +428 -0
  253. package/platform/src/components/cloudflare/static-site.ts +470 -0
  254. package/platform/src/components/cloudflare/tan-stack-start.ts +408 -0
  255. package/platform/src/components/cloudflare/worker.ts +1080 -0
  256. package/platform/src/components/cloudflare/workflow.ts +319 -0
  257. package/platform/src/components/component.ts +242 -0
  258. package/platform/src/components/core.ts +43 -0
  259. package/platform/src/components/cpu.ts +10 -0
  260. package/platform/src/components/dns.ts +82 -0
  261. package/platform/src/components/duration.ts +67 -0
  262. package/platform/src/components/error.ts +5 -0
  263. package/platform/src/components/esbuild.ts +15 -0
  264. package/platform/src/components/experimental/dev-command.ts +127 -0
  265. package/platform/src/components/experimental/index.ts +1 -0
  266. package/platform/src/components/groups.ts +9 -0
  267. package/platform/src/components/index.ts +9 -0
  268. package/platform/src/components/input.ts +2 -0
  269. package/platform/src/components/link.ts +201 -0
  270. package/platform/src/components/linkable.ts +360 -0
  271. package/platform/src/components/naming-rules.ts +299 -0
  272. package/platform/src/components/naming.ts +189 -0
  273. package/platform/src/components/parts-component.ts +662 -0
  274. package/platform/src/components/parts.ts +299 -0
  275. package/platform/src/components/path.ts +5 -0
  276. package/platform/src/components/rpc/rpc.ts +110 -0
  277. package/platform/src/components/secret.ts +159 -0
  278. package/platform/src/components/size.ts +28 -0
  279. package/platform/src/components/takeover.ts +131 -0
  280. package/platform/src/components/transform.ts +107 -0
  281. package/platform/src/components/vercel/account-id.ts +1 -0
  282. package/platform/src/components/vercel/dns.ts +171 -0
  283. package/platform/src/components/vercel/index.ts +2 -0
  284. package/platform/src/components/vercel/providers/dns-record.ts +34 -0
  285. package/platform/src/config.ts +1460 -0
  286. package/platform/src/global-aliases.d.ts +37 -0
  287. package/platform/src/global.d.ts +374 -0
  288. package/platform/src/internal.d.ts +18 -0
  289. package/platform/src/runtime/worker/unenv.d.ts +14 -0
  290. package/platform/src/runtime/worker/unenv.mjs +26 -0
  291. package/platform/src/shim/run.js +25 -0
  292. package/platform/src/testing/global.ts +83 -0
  293. package/platform/src/testing/index.ts +103 -0
  294. package/platform/src/testing/mock.ts +646 -0
  295. package/platform/src/testing/vitest.ts +36 -0
  296. package/platform/src/util/compare-semver.ts +23 -0
  297. package/platform/src/util/fs.ts +49 -0
  298. package/platform/src/util/lazy.ts +12 -0
  299. package/platform/src/util/minify.ts +10 -0
  300. package/platform/src/util/package.ts +29 -0
  301. package/platform/src/util/semaphore.ts +29 -0
  302. package/platform/src/util/warn.ts +7 -0
  303. package/platform/types/auto/run.d.ts +9 -0
  304. package/platform/types/auto/run.d.ts.map +1 -0
  305. package/platform/types/components/args.d.ts +77 -0
  306. package/platform/types/components/args.d.ts.map +1 -0
  307. package/platform/types/components/aws/alb.d.ts +283 -0
  308. package/platform/types/components/aws/alb.d.ts.map +1 -0
  309. package/platform/types/components/aws/analog.d.ts +408 -0
  310. package/platform/types/components/aws/analog.d.ts.map +1 -0
  311. package/platform/types/components/aws/apigateway-websocket-route.d.ts +74 -0
  312. package/platform/types/components/aws/apigateway-websocket-route.d.ts.map +1 -0
  313. package/platform/types/components/aws/apigateway-websocket.d.ts +560 -0
  314. package/platform/types/components/aws/apigateway-websocket.d.ts.map +1 -0
  315. package/platform/types/components/aws/apigatewayv1-api-key.d.ts +48 -0
  316. package/platform/types/components/aws/apigatewayv1-api-key.d.ts.map +1 -0
  317. package/platform/types/components/aws/apigatewayv1-authorizer.d.ts +55 -0
  318. package/platform/types/components/aws/apigatewayv1-authorizer.d.ts.map +1 -0
  319. package/platform/types/components/aws/apigatewayv1-base-route.d.ts +36 -0
  320. package/platform/types/components/aws/apigatewayv1-base-route.d.ts.map +1 -0
  321. package/platform/types/components/aws/apigatewayv1-integration-route.d.ts +39 -0
  322. package/platform/types/components/aws/apigatewayv1-integration-route.d.ts.map +1 -0
  323. package/platform/types/components/aws/apigatewayv1-lambda-route.d.ts +53 -0
  324. package/platform/types/components/aws/apigatewayv1-lambda-route.d.ts.map +1 -0
  325. package/platform/types/components/aws/apigatewayv1-usage-plan.d.ts +53 -0
  326. package/platform/types/components/aws/apigatewayv1-usage-plan.d.ts.map +1 -0
  327. package/platform/types/components/aws/apigatewayv1.d.ts +1028 -0
  328. package/platform/types/components/aws/apigatewayv1.d.ts.map +1 -0
  329. package/platform/types/components/aws/apigatewayv2-authorizer.d.ts +54 -0
  330. package/platform/types/components/aws/apigatewayv2-authorizer.d.ts.map +1 -0
  331. package/platform/types/components/aws/apigatewayv2-base-route.d.ts +28 -0
  332. package/platform/types/components/aws/apigatewayv2-base-route.d.ts.map +1 -0
  333. package/platform/types/components/aws/apigatewayv2-lambda-route.d.ts +59 -0
  334. package/platform/types/components/aws/apigatewayv2-lambda-route.d.ts.map +1 -0
  335. package/platform/types/components/aws/apigatewayv2-private-route.d.ts +54 -0
  336. package/platform/types/components/aws/apigatewayv2-private-route.d.ts.map +1 -0
  337. package/platform/types/components/aws/apigatewayv2-url-route.d.ts +44 -0
  338. package/platform/types/components/aws/apigatewayv2-url-route.d.ts.map +1 -0
  339. package/platform/types/components/aws/apigatewayv2.d.ts +955 -0
  340. package/platform/types/components/aws/apigatewayv2.d.ts.map +1 -0
  341. package/platform/types/components/aws/app-sync-data-source.d.ts +52 -0
  342. package/platform/types/components/aws/app-sync-data-source.d.ts.map +1 -0
  343. package/platform/types/components/aws/app-sync-function.d.ts +33 -0
  344. package/platform/types/components/aws/app-sync-function.d.ts.map +1 -0
  345. package/platform/types/components/aws/app-sync-resolver.d.ts +41 -0
  346. package/platform/types/components/aws/app-sync-resolver.d.ts.map +1 -0
  347. package/platform/types/components/aws/app-sync.d.ts +638 -0
  348. package/platform/types/components/aws/app-sync.d.ts.map +1 -0
  349. package/platform/types/components/aws/astro.d.ts +409 -0
  350. package/platform/types/components/aws/astro.d.ts.map +1 -0
  351. package/platform/types/components/aws/aurora.d.ts +720 -0
  352. package/platform/types/components/aws/aurora.d.ts.map +1 -0
  353. package/platform/types/components/aws/auth-v1.d.ts +26 -0
  354. package/platform/types/components/aws/auth-v1.d.ts.map +1 -0
  355. package/platform/types/components/aws/auth.d.ts +295 -0
  356. package/platform/types/components/aws/auth.d.ts.map +1 -0
  357. package/platform/types/components/aws/bucket-lambda-subscriber.d.ts +61 -0
  358. package/platform/types/components/aws/bucket-lambda-subscriber.d.ts.map +1 -0
  359. package/platform/types/components/aws/bucket-notification.d.ts +47 -0
  360. package/platform/types/components/aws/bucket-notification.d.ts.map +1 -0
  361. package/platform/types/components/aws/bucket-queue-subscriber.d.ts +55 -0
  362. package/platform/types/components/aws/bucket-queue-subscriber.d.ts.map +1 -0
  363. package/platform/types/components/aws/bucket-topic-subscriber.d.ts +55 -0
  364. package/platform/types/components/aws/bucket-topic-subscriber.d.ts.map +1 -0
  365. package/platform/types/components/aws/bucket.d.ts +1356 -0
  366. package/platform/types/components/aws/bucket.d.ts.map +1 -0
  367. package/platform/types/components/aws/bus-base-subscriber.d.ts +20 -0
  368. package/platform/types/components/aws/bus-base-subscriber.d.ts.map +1 -0
  369. package/platform/types/components/aws/bus-lambda-subscriber.d.ts +50 -0
  370. package/platform/types/components/aws/bus-lambda-subscriber.d.ts.map +1 -0
  371. package/platform/types/components/aws/bus-queue-subscriber.d.ts +44 -0
  372. package/platform/types/components/aws/bus-queue-subscriber.d.ts.map +1 -0
  373. package/platform/types/components/aws/bus.d.ts +447 -0
  374. package/platform/types/components/aws/bus.d.ts.map +1 -0
  375. package/platform/types/components/aws/cdn.d.ts +310 -0
  376. package/platform/types/components/aws/cdn.d.ts.map +1 -0
  377. package/platform/types/components/aws/cluster-v1.d.ts +885 -0
  378. package/platform/types/components/aws/cluster-v1.d.ts.map +1 -0
  379. package/platform/types/components/aws/cluster.d.ts +364 -0
  380. package/platform/types/components/aws/cluster.d.ts.map +1 -0
  381. package/platform/types/components/aws/cognito-identity-pool.d.ts +199 -0
  382. package/platform/types/components/aws/cognito-identity-pool.d.ts.map +1 -0
  383. package/platform/types/components/aws/cognito-identity-provider.d.ts +38 -0
  384. package/platform/types/components/aws/cognito-identity-provider.d.ts.map +1 -0
  385. package/platform/types/components/aws/cognito-user-pool-client.d.ts +50 -0
  386. package/platform/types/components/aws/cognito-user-pool-client.d.ts.map +1 -0
  387. package/platform/types/components/aws/cognito-user-pool.d.ts +703 -0
  388. package/platform/types/components/aws/cognito-user-pool.d.ts.map +1 -0
  389. package/platform/types/components/aws/cron-v2.d.ts +325 -0
  390. package/platform/types/components/aws/cron-v2.d.ts.map +1 -0
  391. package/platform/types/components/aws/cron.d.ts +259 -0
  392. package/platform/types/components/aws/cron.d.ts.map +1 -0
  393. package/platform/types/components/aws/dns-validated-certificate.d.ts +27 -0
  394. package/platform/types/components/aws/dns-validated-certificate.d.ts.map +1 -0
  395. package/platform/types/components/aws/dns.d.ts +94 -0
  396. package/platform/types/components/aws/dns.d.ts.map +1 -0
  397. package/platform/types/components/aws/dsql.d.ts +369 -0
  398. package/platform/types/components/aws/dsql.d.ts.map +1 -0
  399. package/platform/types/components/aws/dynamo-lambda-subscriber.d.ts +55 -0
  400. package/platform/types/components/aws/dynamo-lambda-subscriber.d.ts.map +1 -0
  401. package/platform/types/components/aws/dynamo.d.ts +628 -0
  402. package/platform/types/components/aws/dynamo.d.ts.map +1 -0
  403. package/platform/types/components/aws/efs.d.ts +217 -0
  404. package/platform/types/components/aws/efs.d.ts.map +1 -0
  405. package/platform/types/components/aws/email.d.ts +370 -0
  406. package/platform/types/components/aws/email.d.ts.map +1 -0
  407. package/platform/types/components/aws/fargate.d.ts +894 -0
  408. package/platform/types/components/aws/fargate.d.ts.map +1 -0
  409. package/platform/types/components/aws/function.d.ts +1755 -0
  410. package/platform/types/components/aws/function.d.ts.map +1 -0
  411. package/platform/types/components/aws/helpers/apigateway-account.d.ts +3 -0
  412. package/platform/types/components/aws/helpers/apigateway-account.d.ts.map +1 -0
  413. package/platform/types/components/aws/helpers/apigatewayv2-domain.d.ts +144 -0
  414. package/platform/types/components/aws/helpers/apigatewayv2-domain.d.ts.map +1 -0
  415. package/platform/types/components/aws/helpers/arn.d.ts +51 -0
  416. package/platform/types/components/aws/helpers/arn.d.ts.map +1 -0
  417. package/platform/types/components/aws/helpers/bootstrap.d.ts +13 -0
  418. package/platform/types/components/aws/helpers/bootstrap.d.ts.map +1 -0
  419. package/platform/types/components/aws/helpers/client.d.ts +7 -0
  420. package/platform/types/components/aws/helpers/client.d.ts.map +1 -0
  421. package/platform/types/components/aws/helpers/container-builder.d.ts +4 -0
  422. package/platform/types/components/aws/helpers/container-builder.d.ts.map +1 -0
  423. package/platform/types/components/aws/helpers/custom-domain.d.ts +111 -0
  424. package/platform/types/components/aws/helpers/custom-domain.d.ts.map +1 -0
  425. package/platform/types/components/aws/helpers/event-source.d.ts +26 -0
  426. package/platform/types/components/aws/helpers/event-source.d.ts.map +1 -0
  427. package/platform/types/components/aws/helpers/fargate.d.ts +225 -0
  428. package/platform/types/components/aws/helpers/fargate.d.ts.map +1 -0
  429. package/platform/types/components/aws/helpers/function-builder.d.ts +14 -0
  430. package/platform/types/components/aws/helpers/function-builder.d.ts.map +1 -0
  431. package/platform/types/components/aws/helpers/function-code.d.ts +80 -0
  432. package/platform/types/components/aws/helpers/function-code.d.ts.map +1 -0
  433. package/platform/types/components/aws/helpers/function-part.d.ts +61 -0
  434. package/platform/types/components/aws/helpers/function-part.d.ts.map +1 -0
  435. package/platform/types/components/aws/helpers/function-permission.d.ts +17 -0
  436. package/platform/types/components/aws/helpers/function-permission.d.ts.map +1 -0
  437. package/platform/types/components/aws/helpers/load-balancer-args.d.ts +40 -0
  438. package/platform/types/components/aws/helpers/load-balancer-args.d.ts.map +1 -0
  439. package/platform/types/components/aws/helpers/load-balancer.d.ts +9 -0
  440. package/platform/types/components/aws/helpers/load-balancer.d.ts.map +1 -0
  441. package/platform/types/components/aws/helpers/provider.d.ts +3 -0
  442. package/platform/types/components/aws/helpers/provider.d.ts.map +1 -0
  443. package/platform/types/components/aws/helpers/queue-policy.d.ts +11 -0
  444. package/platform/types/components/aws/helpers/queue-policy.d.ts.map +1 -0
  445. package/platform/types/components/aws/helpers/rds.d.ts +98 -0
  446. package/platform/types/components/aws/helpers/rds.d.ts.map +1 -0
  447. package/platform/types/components/aws/helpers/site-builder.d.ts +4 -0
  448. package/platform/types/components/aws/helpers/site-builder.d.ts.map +1 -0
  449. package/platform/types/components/aws/helpers/subscriber.d.ts +6 -0
  450. package/platform/types/components/aws/helpers/subscriber.d.ts.map +1 -0
  451. package/platform/types/components/aws/helpers/vpc.d.ts +14 -0
  452. package/platform/types/components/aws/helpers/vpc.d.ts.map +1 -0
  453. package/platform/types/components/aws/https-redirect.d.ts +38 -0
  454. package/platform/types/components/aws/https-redirect.d.ts.map +1 -0
  455. package/platform/types/components/aws/iam-edit.d.ts +39 -0
  456. package/platform/types/components/aws/iam-edit.d.ts.map +1 -0
  457. package/platform/types/components/aws/index.d.ts +56 -0
  458. package/platform/types/components/aws/index.d.ts.map +1 -0
  459. package/platform/types/components/aws/kinesis-stream-lambda-subscriber.d.ts +49 -0
  460. package/platform/types/components/aws/kinesis-stream-lambda-subscriber.d.ts.map +1 -0
  461. package/platform/types/components/aws/kinesis-stream.d.ts +254 -0
  462. package/platform/types/components/aws/kinesis-stream.d.ts.map +1 -0
  463. package/platform/types/components/aws/linkable.d.ts +17 -0
  464. package/platform/types/components/aws/linkable.d.ts.map +1 -0
  465. package/platform/types/components/aws/logging.d.ts +26 -0
  466. package/platform/types/components/aws/logging.d.ts.map +1 -0
  467. package/platform/types/components/aws/microvm.d.ts +439 -0
  468. package/platform/types/components/aws/microvm.d.ts.map +1 -0
  469. package/platform/types/components/aws/mysql.d.ts +525 -0
  470. package/platform/types/components/aws/mysql.d.ts.map +1 -0
  471. package/platform/types/components/aws/nextjs.d.ts +534 -0
  472. package/platform/types/components/aws/nextjs.d.ts.map +1 -0
  473. package/platform/types/components/aws/nuxt.d.ts +480 -0
  474. package/platform/types/components/aws/nuxt.d.ts.map +1 -0
  475. package/platform/types/components/aws/open-search.d.ts +306 -0
  476. package/platform/types/components/aws/open-search.d.ts.map +1 -0
  477. package/platform/types/components/aws/opencontrol.d.ts +169 -0
  478. package/platform/types/components/aws/opencontrol.d.ts.map +1 -0
  479. package/platform/types/components/aws/permission.d.ts +80 -0
  480. package/platform/types/components/aws/permission.d.ts.map +1 -0
  481. package/platform/types/components/aws/postgres-v1.d.ts +328 -0
  482. package/platform/types/components/aws/postgres-v1.d.ts.map +1 -0
  483. package/platform/types/components/aws/postgres.d.ts +529 -0
  484. package/platform/types/components/aws/postgres.d.ts.map +1 -0
  485. package/platform/types/components/aws/providers/bucket-files.d.ts +18 -0
  486. package/platform/types/components/aws/providers/bucket-files.d.ts.map +1 -0
  487. package/platform/types/components/aws/providers/distribution-deployment-waiter.d.ts +13 -0
  488. package/platform/types/components/aws/providers/distribution-deployment-waiter.d.ts.map +1 -0
  489. package/platform/types/components/aws/providers/distribution-invalidation.d.ts +11 -0
  490. package/platform/types/components/aws/providers/distribution-invalidation.d.ts.map +1 -0
  491. package/platform/types/components/aws/providers/function-environment-update.d.ts +33 -0
  492. package/platform/types/components/aws/providers/function-environment-update.d.ts.map +1 -0
  493. package/platform/types/components/aws/providers/hosted-zone-lookup.d.ts +11 -0
  494. package/platform/types/components/aws/providers/hosted-zone-lookup.d.ts.map +1 -0
  495. package/platform/types/components/aws/providers/kv-keys.d.ts +11 -0
  496. package/platform/types/components/aws/providers/kv-keys.d.ts.map +1 -0
  497. package/platform/types/components/aws/providers/kv-routes-update.d.ts +11 -0
  498. package/platform/types/components/aws/providers/kv-routes-update.d.ts.map +1 -0
  499. package/platform/types/components/aws/providers/microvm-image-prune.d.ts +35 -0
  500. package/platform/types/components/aws/providers/microvm-image-prune.d.ts.map +1 -0
  501. package/platform/types/components/aws/providers/origin-access-control.d.ts +8 -0
  502. package/platform/types/components/aws/providers/origin-access-control.d.ts.map +1 -0
  503. package/platform/types/components/aws/providers/rds-role-lookup.d.ts +8 -0
  504. package/platform/types/components/aws/providers/rds-role-lookup.d.ts.map +1 -0
  505. package/platform/types/components/aws/providers/vector-table.d.ts +12 -0
  506. package/platform/types/components/aws/providers/vector-table.d.ts.map +1 -0
  507. package/platform/types/components/aws/queue-lambda-subscriber.d.ts +53 -0
  508. package/platform/types/components/aws/queue-lambda-subscriber.d.ts.map +1 -0
  509. package/platform/types/components/aws/queue.d.ts +494 -0
  510. package/platform/types/components/aws/queue.d.ts.map +1 -0
  511. package/platform/types/components/aws/react.d.ts +407 -0
  512. package/platform/types/components/aws/react.d.ts.map +1 -0
  513. package/platform/types/components/aws/realtime-lambda-subscriber.d.ts +53 -0
  514. package/platform/types/components/aws/realtime-lambda-subscriber.d.ts.map +1 -0
  515. package/platform/types/components/aws/realtime.d.ts +237 -0
  516. package/platform/types/components/aws/realtime.d.ts.map +1 -0
  517. package/platform/types/components/aws/redis-v1.d.ts +348 -0
  518. package/platform/types/components/aws/redis-v1.d.ts.map +1 -0
  519. package/platform/types/components/aws/redis.d.ts +545 -0
  520. package/platform/types/components/aws/redis.d.ts.map +1 -0
  521. package/platform/types/components/aws/remix.d.ts +408 -0
  522. package/platform/types/components/aws/remix.d.ts.map +1 -0
  523. package/platform/types/components/aws/router-base-route.d.ts +28 -0
  524. package/platform/types/components/aws/router-base-route.d.ts.map +1 -0
  525. package/platform/types/components/aws/router-bucket-route.d.ts +29 -0
  526. package/platform/types/components/aws/router-bucket-route.d.ts.map +1 -0
  527. package/platform/types/components/aws/router-url-route.d.ts +28 -0
  528. package/platform/types/components/aws/router-url-route.d.ts.map +1 -0
  529. package/platform/types/components/aws/router.d.ts +1754 -0
  530. package/platform/types/components/aws/router.d.ts.map +1 -0
  531. package/platform/types/components/aws/service-v1.d.ts +78 -0
  532. package/platform/types/components/aws/service-v1.d.ts.map +1 -0
  533. package/platform/types/components/aws/service.d.ts +1756 -0
  534. package/platform/types/components/aws/service.d.ts.map +1 -0
  535. package/platform/types/components/aws/sns-topic-lambda-subscriber.d.ts +53 -0
  536. package/platform/types/components/aws/sns-topic-lambda-subscriber.d.ts.map +1 -0
  537. package/platform/types/components/aws/sns-topic-queue-subscriber.d.ts +55 -0
  538. package/platform/types/components/aws/sns-topic-queue-subscriber.d.ts.map +1 -0
  539. package/platform/types/components/aws/sns-topic.d.ts +394 -0
  540. package/platform/types/components/aws/sns-topic.d.ts.map +1 -0
  541. package/platform/types/components/aws/solid-start.d.ts +399 -0
  542. package/platform/types/components/aws/solid-start.d.ts.map +1 -0
  543. package/platform/types/components/aws/ssr-site.d.ts +895 -0
  544. package/platform/types/components/aws/ssr-site.d.ts.map +1 -0
  545. package/platform/types/components/aws/static-site.d.ts +744 -0
  546. package/platform/types/components/aws/static-site.d.ts.map +1 -0
  547. package/platform/types/components/aws/step-functions/choice.d.ts +73 -0
  548. package/platform/types/components/aws/step-functions/choice.d.ts.map +1 -0
  549. package/platform/types/components/aws/step-functions/fail.d.ts +63 -0
  550. package/platform/types/components/aws/step-functions/fail.d.ts.map +1 -0
  551. package/platform/types/components/aws/step-functions/map.d.ts +236 -0
  552. package/platform/types/components/aws/step-functions/map.d.ts.map +1 -0
  553. package/platform/types/components/aws/step-functions/parallel.d.ts +127 -0
  554. package/platform/types/components/aws/step-functions/parallel.d.ts.map +1 -0
  555. package/platform/types/components/aws/step-functions/pass.d.ts +39 -0
  556. package/platform/types/components/aws/step-functions/pass.d.ts.map +1 -0
  557. package/platform/types/components/aws/step-functions/state.d.ts +231 -0
  558. package/platform/types/components/aws/step-functions/state.d.ts.map +1 -0
  559. package/platform/types/components/aws/step-functions/succeed.d.ts +26 -0
  560. package/platform/types/components/aws/step-functions/succeed.d.ts.map +1 -0
  561. package/platform/types/components/aws/step-functions/task.d.ts +485 -0
  562. package/platform/types/components/aws/step-functions/task.d.ts.map +1 -0
  563. package/platform/types/components/aws/step-functions/wait.d.ts +91 -0
  564. package/platform/types/components/aws/step-functions/wait.d.ts.map +1 -0
  565. package/platform/types/components/aws/step-functions.d.ts +478 -0
  566. package/platform/types/components/aws/step-functions.d.ts.map +1 -0
  567. package/platform/types/components/aws/svelte-kit.d.ts +456 -0
  568. package/platform/types/components/aws/svelte-kit.d.ts.map +1 -0
  569. package/platform/types/components/aws/takeover/alb.d.ts +2 -0
  570. package/platform/types/components/aws/takeover/alb.d.ts.map +1 -0
  571. package/platform/types/components/aws/takeover/apigatewayv2.d.ts +2 -0
  572. package/platform/types/components/aws/takeover/apigatewayv2.d.ts.map +1 -0
  573. package/platform/types/components/aws/takeover/app-sync.d.ts +2 -0
  574. package/platform/types/components/aws/takeover/app-sync.d.ts.map +1 -0
  575. package/platform/types/components/aws/takeover/aurora.d.ts +2 -0
  576. package/platform/types/components/aws/takeover/aurora.d.ts.map +1 -0
  577. package/platform/types/components/aws/takeover/bucket.d.ts +2 -0
  578. package/platform/types/components/aws/takeover/bucket.d.ts.map +1 -0
  579. package/platform/types/components/aws/takeover/bus.d.ts +2 -0
  580. package/platform/types/components/aws/takeover/bus.d.ts.map +1 -0
  581. package/platform/types/components/aws/takeover/cognito-user-pool.d.ts +2 -0
  582. package/platform/types/components/aws/takeover/cognito-user-pool.d.ts.map +1 -0
  583. package/platform/types/components/aws/takeover/cron-v2.d.ts +2 -0
  584. package/platform/types/components/aws/takeover/cron-v2.d.ts.map +1 -0
  585. package/platform/types/components/aws/takeover/dsql.d.ts +2 -0
  586. package/platform/types/components/aws/takeover/dsql.d.ts.map +1 -0
  587. package/platform/types/components/aws/takeover/dynamo.d.ts +2 -0
  588. package/platform/types/components/aws/takeover/dynamo.d.ts.map +1 -0
  589. package/platform/types/components/aws/takeover/efs.d.ts +2 -0
  590. package/platform/types/components/aws/takeover/efs.d.ts.map +1 -0
  591. package/platform/types/components/aws/takeover/function.d.ts +2 -0
  592. package/platform/types/components/aws/takeover/function.d.ts.map +1 -0
  593. package/platform/types/components/aws/takeover/helpers.d.ts +16 -0
  594. package/platform/types/components/aws/takeover/helpers.d.ts.map +1 -0
  595. package/platform/types/components/aws/takeover/index.d.ts +28 -0
  596. package/platform/types/components/aws/takeover/index.d.ts.map +1 -0
  597. package/platform/types/components/aws/takeover/mysql.d.ts +2 -0
  598. package/platform/types/components/aws/takeover/mysql.d.ts.map +1 -0
  599. package/platform/types/components/aws/takeover/postgres.d.ts +2 -0
  600. package/platform/types/components/aws/takeover/postgres.d.ts.map +1 -0
  601. package/platform/types/components/aws/takeover/queue.d.ts +2 -0
  602. package/platform/types/components/aws/takeover/queue.d.ts.map +1 -0
  603. package/platform/types/components/aws/takeover/redis.d.ts +2 -0
  604. package/platform/types/components/aws/takeover/redis.d.ts.map +1 -0
  605. package/platform/types/components/aws/takeover/service.d.ts +2 -0
  606. package/platform/types/components/aws/takeover/service.d.ts.map +1 -0
  607. package/platform/types/components/aws/takeover/sns-topic.d.ts +2 -0
  608. package/platform/types/components/aws/takeover/sns-topic.d.ts.map +1 -0
  609. package/platform/types/components/aws/takeover/task.d.ts +2 -0
  610. package/platform/types/components/aws/takeover/task.d.ts.map +1 -0
  611. package/platform/types/components/aws/tan-stack-start.d.ts +359 -0
  612. package/platform/types/components/aws/tan-stack-start.d.ts.map +1 -0
  613. package/platform/types/components/aws/task.d.ts +342 -0
  614. package/platform/types/components/aws/task.d.ts.map +1 -0
  615. package/platform/types/components/aws/v5/alb.d.ts +177 -0
  616. package/platform/types/components/aws/v5/alb.d.ts.map +1 -0
  617. package/platform/types/components/aws/v5/apigatewayv2.d.ts +482 -0
  618. package/platform/types/components/aws/v5/apigatewayv2.d.ts.map +1 -0
  619. package/platform/types/components/aws/v5/app-sync.d.ts +424 -0
  620. package/platform/types/components/aws/v5/app-sync.d.ts.map +1 -0
  621. package/platform/types/components/aws/v5/aurora.d.ts +459 -0
  622. package/platform/types/components/aws/v5/aurora.d.ts.map +1 -0
  623. package/platform/types/components/aws/v5/bucket.d.ts +578 -0
  624. package/platform/types/components/aws/v5/bucket.d.ts.map +1 -0
  625. package/platform/types/components/aws/v5/bus.d.ts +255 -0
  626. package/platform/types/components/aws/v5/bus.d.ts.map +1 -0
  627. package/platform/types/components/aws/v5/cluster.d.ts +167 -0
  628. package/platform/types/components/aws/v5/cluster.d.ts.map +1 -0
  629. package/platform/types/components/aws/v5/cognito-user-pool-client.d.ts +69 -0
  630. package/platform/types/components/aws/v5/cognito-user-pool-client.d.ts.map +1 -0
  631. package/platform/types/components/aws/v5/cognito-user-pool.d.ts +396 -0
  632. package/platform/types/components/aws/v5/cognito-user-pool.d.ts.map +1 -0
  633. package/platform/types/components/aws/v5/cron-v2.d.ts +206 -0
  634. package/platform/types/components/aws/v5/cron-v2.d.ts.map +1 -0
  635. package/platform/types/components/aws/v5/dsql.d.ts +453 -0
  636. package/platform/types/components/aws/v5/dsql.d.ts.map +1 -0
  637. package/platform/types/components/aws/v5/dynamo.d.ts +328 -0
  638. package/platform/types/components/aws/v5/dynamo.d.ts.map +1 -0
  639. package/platform/types/components/aws/v5/efs.d.ts +178 -0
  640. package/platform/types/components/aws/v5/efs.d.ts.map +1 -0
  641. package/platform/types/components/aws/v5/function.d.ts +582 -0
  642. package/platform/types/components/aws/v5/function.d.ts.map +1 -0
  643. package/platform/types/components/aws/v5/index.d.ts +27 -0
  644. package/platform/types/components/aws/v5/index.d.ts.map +1 -0
  645. package/platform/types/components/aws/v5/mysql.d.ts +347 -0
  646. package/platform/types/components/aws/v5/mysql.d.ts.map +1 -0
  647. package/platform/types/components/aws/v5/postgres.d.ts +348 -0
  648. package/platform/types/components/aws/v5/postgres.d.ts.map +1 -0
  649. package/platform/types/components/aws/v5/queue.d.ts +190 -0
  650. package/platform/types/components/aws/v5/queue.d.ts.map +1 -0
  651. package/platform/types/components/aws/v5/redis.d.ts +214 -0
  652. package/platform/types/components/aws/v5/redis.d.ts.map +1 -0
  653. package/platform/types/components/aws/v5/service.d.ts +1347 -0
  654. package/platform/types/components/aws/v5/service.d.ts.map +1 -0
  655. package/platform/types/components/aws/v5/sns-topic.d.ts +226 -0
  656. package/platform/types/components/aws/v5/sns-topic.d.ts.map +1 -0
  657. package/platform/types/components/aws/v5/task.d.ts +346 -0
  658. package/platform/types/components/aws/v5/task.d.ts.map +1 -0
  659. package/platform/types/components/aws/vector.d.ts +163 -0
  660. package/platform/types/components/aws/vector.d.ts.map +1 -0
  661. package/platform/types/components/aws/vpc-v1.d.ts +208 -0
  662. package/platform/types/components/aws/vpc-v1.d.ts.map +1 -0
  663. package/platform/types/components/aws/vpc.d.ts +491 -0
  664. package/platform/types/components/aws/vpc.d.ts.map +1 -0
  665. package/platform/types/components/aws/workflow.d.ts +331 -0
  666. package/platform/types/components/aws/workflow.d.ts.map +1 -0
  667. package/platform/types/components/base/base-site.d.ts +53 -0
  668. package/platform/types/components/base/base-site.d.ts.map +1 -0
  669. package/platform/types/components/base/base-ssr-site.d.ts +13 -0
  670. package/platform/types/components/base/base-ssr-site.d.ts.map +1 -0
  671. package/platform/types/components/base/base-static-site.d.ts +199 -0
  672. package/platform/types/components/base/base-static-site.d.ts.map +1 -0
  673. package/platform/types/components/cloudflare/account-id.d.ts +2 -0
  674. package/platform/types/components/cloudflare/account-id.d.ts.map +1 -0
  675. package/platform/types/components/cloudflare/ai.d.ts +68 -0
  676. package/platform/types/components/cloudflare/ai.d.ts.map +1 -0
  677. package/platform/types/components/cloudflare/astro.d.ts +249 -0
  678. package/platform/types/components/cloudflare/astro.d.ts.map +1 -0
  679. package/platform/types/components/cloudflare/auth.d.ts +22 -0
  680. package/platform/types/components/cloudflare/auth.d.ts.map +1 -0
  681. package/platform/types/components/cloudflare/binding.d.ts +109 -0
  682. package/platform/types/components/cloudflare/binding.d.ts.map +1 -0
  683. package/platform/types/components/cloudflare/bucket.d.ts +98 -0
  684. package/platform/types/components/cloudflare/bucket.d.ts.map +1 -0
  685. package/platform/types/components/cloudflare/cron.d.ts +151 -0
  686. package/platform/types/components/cloudflare/cron.d.ts.map +1 -0
  687. package/platform/types/components/cloudflare/d1.d.ts +142 -0
  688. package/platform/types/components/cloudflare/d1.d.ts.map +1 -0
  689. package/platform/types/components/cloudflare/dns.d.ts +100 -0
  690. package/platform/types/components/cloudflare/dns.d.ts.map +1 -0
  691. package/platform/types/components/cloudflare/durable-object.d.ts +125 -0
  692. package/platform/types/components/cloudflare/durable-object.d.ts.map +1 -0
  693. package/platform/types/components/cloudflare/experimental/index.d.ts +4 -0
  694. package/platform/types/components/cloudflare/experimental/index.d.ts.map +1 -0
  695. package/platform/types/components/cloudflare/experimental/solid-start.d.ts +219 -0
  696. package/platform/types/components/cloudflare/experimental/solid-start.d.ts.map +1 -0
  697. package/platform/types/components/cloudflare/experimental/static-site.d.ts +3 -0
  698. package/platform/types/components/cloudflare/experimental/static-site.d.ts.map +1 -0
  699. package/platform/types/components/cloudflare/helpers/compatibility.d.ts +21 -0
  700. package/platform/types/components/cloudflare/helpers/compatibility.d.ts.map +1 -0
  701. package/platform/types/components/cloudflare/helpers/fetch.d.ts +19 -0
  702. package/platform/types/components/cloudflare/helpers/fetch.d.ts.map +1 -0
  703. package/platform/types/components/cloudflare/helpers/validation.d.ts +15 -0
  704. package/platform/types/components/cloudflare/helpers/validation.d.ts.map +1 -0
  705. package/platform/types/components/cloudflare/helpers/worker-builder.d.ts +10 -0
  706. package/platform/types/components/cloudflare/helpers/worker-builder.d.ts.map +1 -0
  707. package/platform/types/components/cloudflare/helpers/wrangler.d.ts +31 -0
  708. package/platform/types/components/cloudflare/helpers/wrangler.d.ts.map +1 -0
  709. package/platform/types/components/cloudflare/hyperdrive.d.ts +302 -0
  710. package/platform/types/components/cloudflare/hyperdrive.d.ts.map +1 -0
  711. package/platform/types/components/cloudflare/index.d.ts +25 -0
  712. package/platform/types/components/cloudflare/index.d.ts.map +1 -0
  713. package/platform/types/components/cloudflare/kv.d.ts +140 -0
  714. package/platform/types/components/cloudflare/kv.d.ts.map +1 -0
  715. package/platform/types/components/cloudflare/providers/dns-record.d.ts +21 -0
  716. package/platform/types/components/cloudflare/providers/dns-record.d.ts.map +1 -0
  717. package/platform/types/components/cloudflare/providers/kv-data.d.ts +23 -0
  718. package/platform/types/components/cloudflare/providers/kv-data.d.ts.map +1 -0
  719. package/platform/types/components/cloudflare/providers/worker-assets.d.ts +19 -0
  720. package/platform/types/components/cloudflare/providers/worker-assets.d.ts.map +1 -0
  721. package/platform/types/components/cloudflare/providers/worker-placement.d.ts +27 -0
  722. package/platform/types/components/cloudflare/providers/worker-placement.d.ts.map +1 -0
  723. package/platform/types/components/cloudflare/providers/worker-script.d.ts +23 -0
  724. package/platform/types/components/cloudflare/providers/worker-script.d.ts.map +1 -0
  725. package/platform/types/components/cloudflare/providers/worker-url.d.ts +24 -0
  726. package/platform/types/components/cloudflare/providers/worker-url.d.ts.map +1 -0
  727. package/platform/types/components/cloudflare/providers/zone-lookup.d.ts +22 -0
  728. package/platform/types/components/cloudflare/providers/zone-lookup.d.ts.map +1 -0
  729. package/platform/types/components/cloudflare/queue-worker-subscriber.d.ts +122 -0
  730. package/platform/types/components/cloudflare/queue-worker-subscriber.d.ts.map +1 -0
  731. package/platform/types/components/cloudflare/queue.d.ts +235 -0
  732. package/platform/types/components/cloudflare/queue.d.ts.map +1 -0
  733. package/platform/types/components/cloudflare/rate-limit.d.ts +117 -0
  734. package/platform/types/components/cloudflare/rate-limit.d.ts.map +1 -0
  735. package/platform/types/components/cloudflare/react-router.d.ts +262 -0
  736. package/platform/types/components/cloudflare/react-router.d.ts.map +1 -0
  737. package/platform/types/components/cloudflare/ssr-site.d.ts +60 -0
  738. package/platform/types/components/cloudflare/ssr-site.d.ts.map +1 -0
  739. package/platform/types/components/cloudflare/static-site-v2.d.ts +302 -0
  740. package/platform/types/components/cloudflare/static-site-v2.d.ts.map +1 -0
  741. package/platform/types/components/cloudflare/static-site.d.ts +270 -0
  742. package/platform/types/components/cloudflare/static-site.d.ts.map +1 -0
  743. package/platform/types/components/cloudflare/tan-stack-start.d.ts +259 -0
  744. package/platform/types/components/cloudflare/tan-stack-start.d.ts.map +1 -0
  745. package/platform/types/components/cloudflare/worker.d.ts +483 -0
  746. package/platform/types/components/cloudflare/worker.d.ts.map +1 -0
  747. package/platform/types/components/cloudflare/workflow.d.ts +248 -0
  748. package/platform/types/components/cloudflare/workflow.d.ts.map +1 -0
  749. package/platform/types/components/component.d.ts +67 -0
  750. package/platform/types/components/component.d.ts.map +1 -0
  751. package/platform/types/components/core.d.ts +16 -0
  752. package/platform/types/components/core.d.ts.map +1 -0
  753. package/platform/types/components/cpu.d.ts +3 -0
  754. package/platform/types/components/cpu.d.ts.map +1 -0
  755. package/platform/types/components/dns.d.ts +63 -0
  756. package/platform/types/components/dns.d.ts.map +1 -0
  757. package/platform/types/components/duration.d.ts +9 -0
  758. package/platform/types/components/duration.d.ts.map +1 -0
  759. package/platform/types/components/error.d.ts +4 -0
  760. package/platform/types/components/error.d.ts.map +1 -0
  761. package/platform/types/components/esbuild.d.ts +3 -0
  762. package/platform/types/components/esbuild.d.ts.map +1 -0
  763. package/platform/types/components/experimental/dev-command.d.ts +99 -0
  764. package/platform/types/components/experimental/dev-command.d.ts.map +1 -0
  765. package/platform/types/components/experimental/index.d.ts +2 -0
  766. package/platform/types/components/experimental/index.d.ts.map +1 -0
  767. package/platform/types/components/groups.d.ts +6 -0
  768. package/platform/types/components/groups.d.ts.map +1 -0
  769. package/platform/types/components/index.d.ts +5 -0
  770. package/platform/types/components/index.d.ts.map +1 -0
  771. package/platform/types/components/input.d.ts +3 -0
  772. package/platform/types/components/input.d.ts.map +1 -0
  773. package/platform/types/components/link.d.ts +41 -0
  774. package/platform/types/components/link.d.ts.map +1 -0
  775. package/platform/types/components/linkable.d.ts +301 -0
  776. package/platform/types/components/linkable.d.ts.map +1 -0
  777. package/platform/types/components/naming-rules.d.ts +32 -0
  778. package/platform/types/components/naming-rules.d.ts.map +1 -0
  779. package/platform/types/components/naming.d.ts +21 -0
  780. package/platform/types/components/naming.d.ts.map +1 -0
  781. package/platform/types/components/parts-component.d.ts +241 -0
  782. package/platform/types/components/parts-component.d.ts.map +1 -0
  783. package/platform/types/components/parts.d.ts +194 -0
  784. package/platform/types/components/parts.d.ts.map +1 -0
  785. package/platform/types/components/path.d.ts +2 -0
  786. package/platform/types/components/path.d.ts.map +1 -0
  787. package/platform/types/components/rpc/rpc.d.ts +19 -0
  788. package/platform/types/components/rpc/rpc.d.ts.map +1 -0
  789. package/platform/types/components/secret.d.ts +123 -0
  790. package/platform/types/components/secret.d.ts.map +1 -0
  791. package/platform/types/components/size.d.ts +5 -0
  792. package/platform/types/components/size.d.ts.map +1 -0
  793. package/platform/types/components/takeover.d.ts +88 -0
  794. package/platform/types/components/takeover.d.ts.map +1 -0
  795. package/platform/types/components/transform.d.ts +34 -0
  796. package/platform/types/components/transform.d.ts.map +1 -0
  797. package/platform/types/components/vercel/account-id.d.ts +2 -0
  798. package/platform/types/components/vercel/account-id.d.ts.map +1 -0
  799. package/platform/types/components/vercel/dns.d.ts +73 -0
  800. package/platform/types/components/vercel/dns.d.ts.map +1 -0
  801. package/platform/types/components/vercel/index.d.ts +3 -0
  802. package/platform/types/components/vercel/index.d.ts.map +1 -0
  803. package/platform/types/components/vercel/providers/dns-record.d.ts +15 -0
  804. package/platform/types/components/vercel/providers/dns-record.d.ts.map +1 -0
  805. package/platform/types/config.d.ts +1437 -0
  806. package/platform/types/config.d.ts.map +1 -0
  807. package/platform/types/global-aliases.d.ts +37 -0
  808. package/platform/types/global.d.ts +374 -0
  809. package/platform/types/internal.d.ts +18 -0
  810. package/platform/types/runtime/worker/unenv.d.ts +14 -0
  811. package/platform/types/testing/global.d.ts +11 -0
  812. package/platform/types/testing/global.d.ts.map +1 -0
  813. package/platform/types/testing/index.d.ts +80 -0
  814. package/platform/types/testing/index.d.ts.map +1 -0
  815. package/platform/types/testing/mock.d.ts +136 -0
  816. package/platform/types/testing/mock.d.ts.map +1 -0
  817. package/platform/types/testing/vitest.d.ts +19 -0
  818. package/platform/types/testing/vitest.d.ts.map +1 -0
  819. package/platform/types/util/compare-semver.d.ts +4 -0
  820. package/platform/types/util/compare-semver.d.ts.map +1 -0
  821. package/platform/types/util/fs.d.ts +5 -0
  822. package/platform/types/util/fs.d.ts.map +1 -0
  823. package/platform/types/util/lazy.d.ts +2 -0
  824. package/platform/types/util/lazy.d.ts.map +1 -0
  825. package/platform/types/util/minify.d.ts +2 -0
  826. package/platform/types/util/minify.d.ts.map +1 -0
  827. package/platform/types/util/package.d.ts +10 -0
  828. package/platform/types/util/package.d.ts.map +1 -0
  829. package/platform/types/util/semaphore.d.ts +9 -0
  830. package/platform/types/util/semaphore.d.ts.map +1 -0
  831. package/platform/types/util/warn.d.ts +2 -0
  832. package/platform/types/util/warn.d.ts.map +1 -0
@@ -0,0 +1,3246 @@
1
+ import {
2
+ URL_UNAVAILABLE,
3
+ buildApp,
4
+ buildApp2,
5
+ getContentType,
6
+ isALteB,
7
+ prepare,
8
+ toMilliseconds,
9
+ toSeconds
10
+ } from "../../chunks/chunk-ONNI4XNK.js";
11
+ import {
12
+ rpc
13
+ } from "../../chunks/chunk-VIFHC73J.js";
14
+ import {
15
+ Link
16
+ } from "../../chunks/chunk-HIZZCEDS.js";
17
+ import {
18
+ Component,
19
+ VisibleError,
20
+ logicalName,
21
+ prefixName,
22
+ transform
23
+ } from "../../chunks/chunk-KOKHGKJ2.js";
24
+ import {
25
+ __export
26
+ } from "../../chunks/chunk-WJ6BVA46.js";
27
+
28
+ // platform/src/components/cloudflare/bucket.ts
29
+ import * as cloudflare from "@pulumi/cloudflare";
30
+
31
+ // platform/src/components/cloudflare/binding.ts
32
+ function binding(input) {
33
+ return {
34
+ type: "cloudflare.binding",
35
+ binding: input.type,
36
+ properties: input.properties
37
+ };
38
+ }
39
+
40
+ // platform/src/components/cloudflare/account-id.ts
41
+ var DEFAULT_ACCOUNT_ID = process.env.CLOUDFLARE_DEFAULT_ACCOUNT_ID;
42
+
43
+ // platform/src/components/cloudflare/bucket.ts
44
+ var Bucket = class extends Component {
45
+ bucket;
46
+ constructor(name, args, opts) {
47
+ super(__pulumiType, name, args, opts);
48
+ const parent = this;
49
+ const bucket = createBucket();
50
+ this.bucket = bucket;
51
+ function createBucket() {
52
+ return new cloudflare.R2Bucket(
53
+ ...transform(
54
+ args?.transform?.bucket,
55
+ `${name}Bucket`,
56
+ {
57
+ name: "",
58
+ accountId: args?.accountId ?? DEFAULT_ACCOUNT_ID
59
+ },
60
+ { parent }
61
+ )
62
+ );
63
+ }
64
+ }
65
+ /**
66
+ * When you link a bucket to a worker, you can interact with it using these
67
+ * [Bucket methods](https://developers.cloudflare.com/r2/api/workers/workers-api-reference/#bucket-method-definitions).
68
+ *
69
+ * @example
70
+ * ```ts title="index.ts" {3}
71
+ * import { Resource } from "sst";
72
+ *
73
+ * await Resource.MyBucket.list();
74
+ * ```
75
+ *
76
+ * @internal
77
+ */
78
+ getSSTLink() {
79
+ return {
80
+ properties: {
81
+ name: this.bucket.name
82
+ },
83
+ include: [
84
+ binding({
85
+ type: "r2BucketBindings",
86
+ properties: {
87
+ bucketName: this.bucket.name
88
+ }
89
+ })
90
+ ]
91
+ };
92
+ }
93
+ /**
94
+ * The generated name of the R2 Bucket.
95
+ */
96
+ get name() {
97
+ return this.bucket.name;
98
+ }
99
+ /**
100
+ * The underlying [resources](/docs/components/#nodes) this component creates.
101
+ */
102
+ get nodes() {
103
+ return {
104
+ /**
105
+ * The Cloudflare R2 Bucket.
106
+ */
107
+ bucket: this.bucket
108
+ };
109
+ }
110
+ };
111
+ var __pulumiType = "sst:cloudflare:Bucket";
112
+ Bucket.__pulumiType = __pulumiType;
113
+
114
+ // platform/src/components/cloudflare/kv.ts
115
+ import * as cloudflare2 from "@pulumi/cloudflare";
116
+ var Kv = class _Kv extends Component {
117
+ namespace;
118
+ constructor(name, args, opts) {
119
+ super(__pulumiType2, name, args, opts);
120
+ const parent = this;
121
+ if (args && "ref" in args) {
122
+ const ref = args;
123
+ this.namespace = ref.namespace;
124
+ return;
125
+ }
126
+ const namespace = createNamespace();
127
+ this.namespace = namespace;
128
+ function createNamespace() {
129
+ return new cloudflare2.WorkersKvNamespace(
130
+ ...transform(
131
+ args?.transform?.namespace,
132
+ `${name}Namespace`,
133
+ {
134
+ title: "",
135
+ accountId: args?.accountId ?? DEFAULT_ACCOUNT_ID
136
+ },
137
+ { parent }
138
+ )
139
+ );
140
+ }
141
+ }
142
+ /**
143
+ * Reference an existing KV namespace with the given name. This is useful when you
144
+ * create a KV namespace in one stage and want to share it in another.
145
+ *
146
+ * :::tip
147
+ * You can use the `static get` method to share KV namespaces across stages.
148
+ * :::
149
+ *
150
+ * @param name The name of the component.
151
+ * @param args The arguments to get the KV namespace.
152
+ * @param opts Resource options.
153
+ *
154
+ * @example
155
+ * Imagine you create a KV namespace in the `dev` stage. And in your personal stage `frank`,
156
+ * instead of creating a new namespace, you want to share the same one from `dev`.
157
+ *
158
+ * ```ts title="sst.config.ts"
159
+ * const storage = $app.stage === "frank"
160
+ * ? sst.cloudflare.Kv.get("MyStorage", {
161
+ * namespaceId: "a1b2c3d4e5f6",
162
+ * })
163
+ * : new sst.cloudflare.Kv("MyStorage");
164
+ * ```
165
+ */
166
+ static get(name, args, opts) {
167
+ const namespace = cloudflare2.WorkersKvNamespace.get(
168
+ `${name}Namespace`,
169
+ `${args.accountId ?? DEFAULT_ACCOUNT_ID}/${args.namespaceId}`,
170
+ void 0,
171
+ opts
172
+ );
173
+ return new _Kv(
174
+ name,
175
+ {
176
+ ref: true,
177
+ namespace
178
+ },
179
+ opts
180
+ );
181
+ }
182
+ /**
183
+ * When you link a KV storage, the storage will be available to the worker and you can
184
+ * interact with it using its [API methods](https://developers.cloudflare.com/kv/api/).
185
+ *
186
+ * @example
187
+ * ```ts title="index.ts" {3}
188
+ * import { Resource } from "sst";
189
+ *
190
+ * await Resource.MyStorage.get("someKey");
191
+ * ```
192
+ *
193
+ * @internal
194
+ */
195
+ getSSTLink() {
196
+ return {
197
+ properties: {
198
+ namespaceId: this.namespaceId
199
+ },
200
+ include: [
201
+ binding({
202
+ type: "kvNamespaceBindings",
203
+ properties: {
204
+ namespaceId: this.namespaceId
205
+ }
206
+ })
207
+ ]
208
+ };
209
+ }
210
+ /**
211
+ * The generated ID of the KV namespace.
212
+ * @deprecated Use `namespaceId` instead.
213
+ */
214
+ get id() {
215
+ return this.namespaceId;
216
+ }
217
+ /**
218
+ * The generated ID of the KV namespace.
219
+ */
220
+ get namespaceId() {
221
+ return this.namespace.id.apply(
222
+ (id) => id.includes("/") ? id.split("/")[1] : id
223
+ );
224
+ }
225
+ /**
226
+ * The underlying [resources](/docs/components/#nodes) this component creates.
227
+ */
228
+ get nodes() {
229
+ return {
230
+ /**
231
+ * The Cloudflare KV namespace.
232
+ */
233
+ namespace: this.namespace
234
+ };
235
+ }
236
+ };
237
+ var __pulumiType2 = "sst:cloudflare:Kv";
238
+ Kv.__pulumiType = __pulumiType2;
239
+
240
+ // platform/src/components/cloudflare/d1.ts
241
+ import * as cloudflare3 from "@pulumi/cloudflare";
242
+ var D1 = class _D1 extends Component {
243
+ database;
244
+ constructor(name, args, opts) {
245
+ super(__pulumiType3, name, args, opts);
246
+ if (args && "ref" in args) {
247
+ const ref = args;
248
+ this.database = ref.database;
249
+ return;
250
+ }
251
+ const parent = this;
252
+ const db = createDB();
253
+ this.database = db;
254
+ function createDB() {
255
+ return new cloudflare3.D1Database(
256
+ ...transform(
257
+ args?.transform?.database,
258
+ `${name}Database`,
259
+ {
260
+ name: "",
261
+ accountId: args?.accountId ?? DEFAULT_ACCOUNT_ID
262
+ },
263
+ { parent }
264
+ )
265
+ );
266
+ }
267
+ }
268
+ /**
269
+ * When you link a D1 database, the database will be available to the worker and you can
270
+ * query it using its [API methods](https://developers.cloudflare.com/d1/build-with-d1/d1-client-api/).
271
+ *
272
+ * @example
273
+ * ```ts title="index.ts" {1} "Resource.MyDatabase.prepare"
274
+ * import { Resource } from "sst";
275
+ *
276
+ * await Resource.MyDatabase.prepare(
277
+ * "SELECT id FROM todo ORDER BY id DESC LIMIT 1",
278
+ * ).first();
279
+ * ```
280
+ *
281
+ * @internal
282
+ */
283
+ getSSTLink() {
284
+ return {
285
+ properties: {
286
+ databaseId: this.databaseId
287
+ },
288
+ include: [
289
+ binding({
290
+ type: "d1DatabaseBindings",
291
+ properties: {
292
+ id: this.databaseId
293
+ }
294
+ })
295
+ ]
296
+ };
297
+ }
298
+ /**
299
+ * The generated ID of the D1 database.
300
+ */
301
+ get databaseId() {
302
+ return this.database.id.apply(
303
+ (id) => id.includes("/") ? id.split("/")[1] : id
304
+ );
305
+ }
306
+ /**
307
+ * The underlying [resources](/docs/components/#nodes) this component creates.
308
+ */
309
+ get nodes() {
310
+ return {
311
+ /**
312
+ * The Cloudflare D1 database.
313
+ */
314
+ database: this.database
315
+ };
316
+ }
317
+ static get(name, argsOrDatabaseId, opts) {
318
+ if (typeof argsOrDatabaseId === "string") {
319
+ const database2 = cloudflare3.D1Database.get(
320
+ `${name}Database`,
321
+ `${DEFAULT_ACCOUNT_ID}/${argsOrDatabaseId}`,
322
+ void 0,
323
+ opts
324
+ );
325
+ return new _D1(name, {
326
+ ref: true,
327
+ database: database2
328
+ });
329
+ }
330
+ const database = cloudflare3.D1Database.get(
331
+ `${name}Database`,
332
+ `${argsOrDatabaseId.accountId ?? DEFAULT_ACCOUNT_ID}/${argsOrDatabaseId.databaseId}`,
333
+ void 0,
334
+ opts
335
+ );
336
+ return new _D1(name, {
337
+ ref: true,
338
+ database
339
+ });
340
+ }
341
+ };
342
+ var __pulumiType3 = "sst:cloudflare:D1";
343
+ D1.__pulumiType = __pulumiType3;
344
+
345
+ // platform/src/components/cloudflare/dns.ts
346
+ import * as cloudflare4 from "@pulumi/cloudflare";
347
+
348
+ // platform/src/components/cloudflare/providers/zone-lookup.ts
349
+ import { dynamic } from "@pulumi/pulumi";
350
+
351
+ // platform/src/components/cloudflare/helpers/fetch.ts
352
+ var CLOUDFLARE_API_BASE_URL = process.env.CLOUDFLARE_API_BASE_URL ?? "https://api.cloudflare.com/client/v4";
353
+ var apiToken = () => $app.providers?.cloudflare?.apiToken || process.env.CLOUDFLARE_API_TOKEN;
354
+ async function cfFetch(resource, init = {}) {
355
+ const maxRetries = 3;
356
+ let lastError;
357
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
358
+ try {
359
+ const ret = await fetch(`${CLOUDFLARE_API_BASE_URL}${resource}`, {
360
+ ...init,
361
+ headers: {
362
+ Authorization: `Bearer ${apiToken()}`,
363
+ ...init.headers
364
+ }
365
+ });
366
+ const json = await ret.json();
367
+ if (json.success) {
368
+ return json;
369
+ }
370
+ lastError = new Error(
371
+ `A request to the Cloudflare API (${resource}) failed.`
372
+ );
373
+ lastError.errors = json.errors;
374
+ lastError.messages = json.messages;
375
+ } catch (error) {
376
+ lastError = error;
377
+ }
378
+ if (attempt < maxRetries) {
379
+ await new Promise(
380
+ (resolve) => setTimeout(resolve, Math.pow(2, attempt) * 200)
381
+ );
382
+ }
383
+ }
384
+ throw lastError;
385
+ }
386
+
387
+ // platform/src/components/cloudflare/providers/zone-lookup.ts
388
+ var Provider = class {
389
+ async create(inputs) {
390
+ const { zoneId, zoneName } = await this.lookup(inputs);
391
+ return { id: zoneId, outs: { zoneId, zoneName } };
392
+ }
393
+ async update(id, olds, news) {
394
+ const { zoneId, zoneName } = await this.lookup(news);
395
+ return { outs: { zoneId, zoneName } };
396
+ }
397
+ async lookup(inputs, page = 1) {
398
+ try {
399
+ const qs = new URLSearchParams({
400
+ per_page: "50",
401
+ page: String(page),
402
+ "account.id": inputs.accountId
403
+ }).toString();
404
+ const ret = await cfFetch(
405
+ `/zones?${qs}`,
406
+ { headers: { "Content-Type": "application/json" } }
407
+ );
408
+ const zone = ret.result.find(
409
+ // ensure `example.com` does not match `myexample.com`
410
+ (z) => inputs.domain === z.name || inputs.domain.endsWith(`.${z.name}`)
411
+ );
412
+ if (zone) return { zoneId: zone.id, zoneName: zone.name };
413
+ if (ret.result.length < ret.result_info.per_page)
414
+ throw new Error(
415
+ `Could not find hosted zone for domain ${inputs.domain}`
416
+ );
417
+ return this.lookup(inputs, page + 1);
418
+ } catch (error) {
419
+ console.log(error);
420
+ throw error;
421
+ }
422
+ }
423
+ };
424
+ var ZoneLookup = class extends dynamic.Resource {
425
+ constructor(name, args, opts) {
426
+ super(
427
+ new Provider(),
428
+ `${name}.sst.cloudflare.ZoneLookup`,
429
+ { ...args, zoneId: void 0, zoneName: void 0 },
430
+ opts
431
+ );
432
+ }
433
+ };
434
+
435
+ // platform/src/components/cloudflare/dns.ts
436
+ import { output } from "@pulumi/pulumi";
437
+
438
+ // platform/src/components/cloudflare/providers/dns-record.ts
439
+ import { dynamic as dynamic2 } from "@pulumi/pulumi";
440
+ var DnsRecord = class extends dynamic2.Resource {
441
+ constructor(name, args, opts) {
442
+ super(
443
+ new rpc.Provider("Cloudflare.DnsRecord"),
444
+ `${name}.sst.cloudflare.DnsRecord`,
445
+ {
446
+ ...args,
447
+ recordId: void 0,
448
+ accountId: args.accountId ?? DEFAULT_ACCOUNT_ID,
449
+ apiToken: $app.providers?.cloudflare?.apiToken || process.env.CLOUDFLARE_API_TOKEN
450
+ },
451
+ opts
452
+ );
453
+ }
454
+ };
455
+
456
+ // platform/src/components/cloudflare/dns.ts
457
+ function dns(args = {}) {
458
+ return {
459
+ provider: "cloudflare",
460
+ createAlias,
461
+ createCaa,
462
+ createRecord
463
+ };
464
+ function lookupZone(namePrefix, recordType, recordName, opts) {
465
+ if (args.zone) {
466
+ const zone2 = cloudflare4.getZoneOutput({
467
+ zoneId: args.zone
468
+ });
469
+ return {
470
+ id: output(args.zone),
471
+ name: zone2.name
472
+ };
473
+ }
474
+ const zone = new ZoneLookup(
475
+ `${namePrefix}${recordType}${recordName}ZoneLookup`,
476
+ {
477
+ accountId: args.accountId ?? DEFAULT_ACCOUNT_ID,
478
+ domain: recordName.replace(/\.$/, "")
479
+ },
480
+ opts
481
+ );
482
+ return {
483
+ id: zone.zoneId,
484
+ name: zone.zoneName
485
+ };
486
+ }
487
+ function createAlias(namePrefix, record, opts) {
488
+ return handleCreate(
489
+ namePrefix,
490
+ {
491
+ name: record.name,
492
+ type: "CNAME",
493
+ value: record.aliasName,
494
+ isAlias: true
495
+ },
496
+ opts
497
+ );
498
+ }
499
+ function createCaa(namePrefix, recordName, opts) {
500
+ const zone = lookupZone(namePrefix, "CAA", recordName, opts);
501
+ return [
502
+ new DnsRecord(
503
+ `${namePrefix}CAA${recordName}Record`,
504
+ {
505
+ zoneId: zone.id,
506
+ type: "CAA",
507
+ name: zone.name,
508
+ accountId: args.accountId,
509
+ data: {
510
+ flags: "0",
511
+ tag: "issue",
512
+ value: "amazonaws.com"
513
+ }
514
+ },
515
+ opts
516
+ ),
517
+ new DnsRecord(
518
+ `${namePrefix}CAAWildcard${recordName}Record`,
519
+ {
520
+ zoneId: zone.id,
521
+ type: "CAA",
522
+ name: zone.name,
523
+ accountId: args.accountId,
524
+ data: {
525
+ flags: "0",
526
+ tag: "issuewild",
527
+ value: "amazonaws.com"
528
+ }
529
+ },
530
+ opts
531
+ )
532
+ ];
533
+ }
534
+ function createRecord(namePrefix, record, opts) {
535
+ return handleCreate(namePrefix, record, opts);
536
+ }
537
+ function handleCreate(namePrefix, record, opts) {
538
+ return output(record).apply((record2) => {
539
+ const zone = lookupZone(namePrefix, record2.type, record2.name, opts);
540
+ const proxy = output(args.proxy).apply(
541
+ (proxy2) => (proxy2 && record2.isAlias) ?? false
542
+ );
543
+ const nameSuffix = logicalName(record2.name);
544
+ const type = record2.type.toUpperCase();
545
+ return new cloudflare4.DnsRecord(
546
+ ...transform(
547
+ args.transform?.record,
548
+ `${namePrefix}${record2.type}Record${nameSuffix}`,
549
+ {
550
+ zoneId: zone.id,
551
+ proxied: output(proxy),
552
+ type,
553
+ name: record2.name,
554
+ ...type === "TXT" ? {
555
+ content: record2.value.startsWith(`"`) ? record2.value : `"${record2.value}"`
556
+ } : {
557
+ content: record2.value
558
+ },
559
+ ...record2.priority !== void 0 ? { priority: record2.priority } : {},
560
+ ttl: output(proxy).apply((proxy2) => proxy2 ? 1 : 60)
561
+ },
562
+ opts
563
+ )
564
+ );
565
+ });
566
+ }
567
+ }
568
+
569
+ // platform/src/components/cloudflare/durable-object.ts
570
+ import { output as output2 } from "@pulumi/pulumi";
571
+ var DurableObject = class extends Component {
572
+ /**
573
+ * The exported Durable Object class name.
574
+ */
575
+ className;
576
+ constructor(name, args, opts) {
577
+ super(__pulumiType4, name, args, opts);
578
+ this.className = output2(args.className);
579
+ }
580
+ /**
581
+ * When you link a Durable Object to a worker, SST adds a Cloudflare Durable
582
+ * Object namespace binding.
583
+ *
584
+ * @internal
585
+ */
586
+ getSSTLink() {
587
+ const properties = {
588
+ className: this.className
589
+ };
590
+ return {
591
+ properties,
592
+ include: [
593
+ binding({
594
+ type: "durableObjectNamespaceBindings",
595
+ properties
596
+ }),
597
+ {
598
+ type: "cloudflare.durableObject",
599
+ ...properties
600
+ }
601
+ ]
602
+ };
603
+ }
604
+ };
605
+ var __pulumiType4 = "sst:cloudflare:DurableObject";
606
+ DurableObject.__pulumiType = __pulumiType4;
607
+
608
+ // platform/src/components/cloudflare/static-site.ts
609
+ import fs3 from "fs";
610
+ import path2 from "path";
611
+ import crypto2 from "crypto";
612
+ import { all as all3, output as output5 } from "@pulumi/pulumi";
613
+ import { globSync } from "glob";
614
+
615
+ // platform/src/components/cloudflare/providers/kv-data.ts
616
+ import fs from "fs";
617
+ import { dynamic as dynamic3 } from "@pulumi/pulumi";
618
+ var Provider2 = class {
619
+ async create(inputs) {
620
+ await this.upload(inputs.accountId, inputs.namespaceId, inputs.entries, []);
621
+ return { id: "data" };
622
+ }
623
+ async update(id, olds, news) {
624
+ await this.upload(
625
+ news.accountId,
626
+ news.namespaceId,
627
+ news.entries,
628
+ news.namespaceId === olds.namespaceId ? olds.entries : []
629
+ );
630
+ return {};
631
+ }
632
+ async upload(accountId, namespaceId, entries, oldEntries) {
633
+ const oldFilesMap = new Map(oldEntries.map((f) => [f.key, f]));
634
+ const changedEntries = entries.filter((entry) => {
635
+ const old = oldFilesMap.get(entry.key);
636
+ return old?.hash !== entry.hash || old?.contentType !== entry.contentType || old?.cacheControl !== entry.cacheControl;
637
+ });
638
+ const htmlEntries = changedEntries.filter((e) => e.key.endsWith(".html"));
639
+ const nonHtmlEntries = changedEntries.filter(
640
+ (e) => !e.key.endsWith(".html")
641
+ );
642
+ const uploadEntry = async (entry) => {
643
+ const formData = new FormData();
644
+ formData.append(
645
+ "metadata",
646
+ JSON.stringify({
647
+ contentType: entry.contentType,
648
+ cacheControl: entry.cacheControl
649
+ })
650
+ );
651
+ formData.append(
652
+ "value",
653
+ await fs.promises.readFile(entry.source, "base64")
654
+ );
655
+ try {
656
+ await cfFetch(
657
+ `/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${entry.key}`,
658
+ {
659
+ method: "PUT",
660
+ body: formData
661
+ }
662
+ );
663
+ } catch (error) {
664
+ console.log(error);
665
+ throw error;
666
+ }
667
+ };
668
+ await Promise.all(nonHtmlEntries.map(uploadEntry));
669
+ await Promise.all(htmlEntries.map(uploadEntry));
670
+ }
671
+ };
672
+ var KvData = class extends dynamic3.Resource {
673
+ constructor(name, args, opts) {
674
+ super(new Provider2(), `${name}.sst.cloudflare.KvPairs`, args, opts);
675
+ }
676
+ };
677
+
678
+ // platform/src/components/cloudflare/worker.ts
679
+ import fs2 from "fs/promises";
680
+ import path from "path";
681
+ import crypto from "crypto";
682
+ import {
683
+ output as output4,
684
+ all as all2,
685
+ jsonStringify,
686
+ interpolate
687
+ } from "@pulumi/pulumi";
688
+ import * as cf from "@pulumi/cloudflare";
689
+
690
+ // platform/src/components/cloudflare/providers/worker-url.ts
691
+ import { dynamic as dynamic4 } from "@pulumi/pulumi";
692
+ var Provider3 = class {
693
+ async create(inputs) {
694
+ const url = await this.process(inputs);
695
+ return {
696
+ id: inputs.scriptName,
697
+ outs: url ? { url } : {}
698
+ };
699
+ }
700
+ async update(id, olds, news) {
701
+ const url = await this.process(news);
702
+ return {
703
+ outs: url ? { url } : {}
704
+ };
705
+ }
706
+ async process(inputs) {
707
+ if (inputs.enabled === false) {
708
+ await this.setEnabledFlag(inputs);
709
+ return void 0;
710
+ }
711
+ const [userSubdomain] = await Promise.all([
712
+ this.getWorkerDevSubdomain(inputs),
713
+ this.setEnabledFlag(inputs)
714
+ ]);
715
+ return `${inputs.scriptName}.${userSubdomain}.workers.dev`;
716
+ }
717
+ async getWorkerDevSubdomain(inputs) {
718
+ try {
719
+ const ret = await cfFetch(
720
+ `/accounts/${inputs.accountId}/workers/subdomain`,
721
+ {
722
+ headers: { "Content-Type": "application/json" }
723
+ }
724
+ );
725
+ return ret.result.subdomain;
726
+ } catch (error) {
727
+ console.log(error);
728
+ throw error;
729
+ }
730
+ }
731
+ async setEnabledFlag(inputs) {
732
+ try {
733
+ await cfFetch(
734
+ `/accounts/${inputs.accountId}/workers/scripts/${inputs.scriptName}/subdomain`,
735
+ {
736
+ method: "POST",
737
+ headers: { "Content-Type": "application/json" },
738
+ body: JSON.stringify({ enabled: inputs.enabled })
739
+ }
740
+ );
741
+ await new Promise((resolve) => setTimeout(resolve, 3e3));
742
+ } catch (error) {
743
+ console.log(error);
744
+ throw error;
745
+ }
746
+ }
747
+ };
748
+ var WorkerUrl = class extends dynamic4.Resource {
749
+ constructor(name, args, opts) {
750
+ super(
751
+ new Provider3(),
752
+ `${name}.sst.cloudflare.WorkerUrl`,
753
+ { ...args, url: void 0 },
754
+ opts
755
+ );
756
+ }
757
+ };
758
+
759
+ // platform/src/components/cloudflare/providers/worker-placement.ts
760
+ import { dynamic as dynamic5 } from "@pulumi/pulumi";
761
+ function buildPlacement(inputs) {
762
+ if (inputs.mode) return { mode: inputs.mode };
763
+ if (inputs.region) return { region: inputs.region };
764
+ if (inputs.host) return { host: inputs.host };
765
+ if (inputs.hostname) return { hostname: inputs.hostname };
766
+ return {};
767
+ }
768
+ var Provider4 = class {
769
+ async create(inputs) {
770
+ await this.patch(inputs, buildPlacement(inputs));
771
+ return {
772
+ id: inputs.scriptName,
773
+ outs: { scriptName: inputs.scriptName }
774
+ };
775
+ }
776
+ async update(id, olds, news) {
777
+ await this.patch(news, buildPlacement(news));
778
+ return {
779
+ outs: { scriptName: news.scriptName }
780
+ };
781
+ }
782
+ async delete(id, inputs) {
783
+ await this.patch(inputs, {});
784
+ }
785
+ async patch(inputs, placement) {
786
+ const accountId = inputs.accountId || DEFAULT_ACCOUNT_ID;
787
+ const formData = new FormData();
788
+ formData.append(
789
+ "settings",
790
+ new Blob([JSON.stringify({ placement })], {
791
+ type: "application/json"
792
+ })
793
+ );
794
+ await cfFetch(
795
+ `/accounts/${accountId}/workers/scripts/${inputs.scriptName}/settings`,
796
+ {
797
+ method: "PATCH",
798
+ body: formData
799
+ }
800
+ );
801
+ }
802
+ };
803
+ var WorkerPlacement = class extends dynamic5.Resource {
804
+ constructor(name, args, opts) {
805
+ super(
806
+ new Provider4(),
807
+ `${name}.sst.cloudflare.WorkerPlacement`,
808
+ { ...args, scriptName: args.scriptName },
809
+ opts
810
+ );
811
+ }
812
+ };
813
+
814
+ // platform/src/components/cloudflare/worker.ts
815
+ import { iam } from "@pulumi/aws";
816
+
817
+ // platform/src/components/cloudflare/helpers/compatibility.ts
818
+ import { all, output as output3 } from "@pulumi/pulumi";
819
+ var DEFAULT_COMPATIBILITY_DATE = "2025-05-05";
820
+ var DEFAULT_COMPATIBILITY_FLAGS = ["nodejs_compat"];
821
+ function normalizeCompatibility(args) {
822
+ const compatibility = output3(args?.compatibility);
823
+ const workerTransform = typeof args?.transform?.worker === "function" ? void 0 : args?.transform?.worker;
824
+ return output3({
825
+ date: all([
826
+ compatibility.apply((value) => value?.date),
827
+ workerTransform?.compatibilityDate
828
+ ]).apply(
829
+ ([argValue, transformValue]) => transformValue ?? argValue ?? DEFAULT_COMPATIBILITY_DATE
830
+ ),
831
+ flags: all([
832
+ compatibility.apply((value) => value?.flags),
833
+ workerTransform?.compatibilityFlags
834
+ ]).apply(
835
+ ([argValue, transformValue]) => transformValue ?? argValue ?? DEFAULT_COMPATIBILITY_FLAGS
836
+ )
837
+ });
838
+ }
839
+
840
+ // platform/src/components/cloudflare/worker.ts
841
+ var Worker = class extends Component {
842
+ script;
843
+ workerUrl;
844
+ workerPlacement;
845
+ workerDomain;
846
+ constructor(name, args, opts) {
847
+ super(__pulumiType5, name, args, opts);
848
+ const parent = this;
849
+ const accountId = args.accountId ?? DEFAULT_ACCOUNT_ID;
850
+ const dev = normalizeDev();
851
+ const urlEnabled = normalizeUrl();
852
+ const compatibility = normalizeCompatibility(args);
853
+ const domain = normalizeDomain();
854
+ const bindings = buildBindings();
855
+ const iamCredentials = createAwsCredentials();
856
+ const buildInput = all2([
857
+ name,
858
+ args.handler,
859
+ args.build,
860
+ compatibility
861
+ ]).apply(async ([name2, handler, build2, compatibility2]) => {
862
+ return {
863
+ functionID: name2,
864
+ links: {},
865
+ handler,
866
+ runtime: "worker",
867
+ properties: {
868
+ accountID: accountId,
869
+ build: build2,
870
+ compatibility: compatibility2
871
+ }
872
+ };
873
+ });
874
+ const build = buildHandler();
875
+ const script = createScript();
876
+ const workerUrl = createWorkersUrl();
877
+ const workerPlacement = createWorkerPlacement();
878
+ const workerDomain = createWorkersDomain();
879
+ createAliases();
880
+ createRedirects();
881
+ this.script = script;
882
+ this.workerUrl = workerUrl;
883
+ this.workerPlacement = workerPlacement;
884
+ this.workerDomain = workerDomain;
885
+ all2([dev, buildInput, script.scriptName]).apply(
886
+ async ([dev2, buildInput2, scriptName]) => {
887
+ if (!dev2) return void 0;
888
+ await rpc.call("Runtime.AddTarget", {
889
+ ...buildInput2,
890
+ properties: {
891
+ ...buildInput2.properties,
892
+ scriptName
893
+ }
894
+ });
895
+ }
896
+ );
897
+ this.registerOutputs({
898
+ _live: all2([name, args.handler, args.build, compatibility, dev]).apply(
899
+ ([name2, handler, build2, compatibility2, dev2]) => {
900
+ if (!dev2) return void 0;
901
+ return {
902
+ functionID: name2,
903
+ links: [],
904
+ handler,
905
+ runtime: "worker",
906
+ properties: {
907
+ accountID: accountId,
908
+ scriptName: script.scriptName,
909
+ build: build2,
910
+ compatibility: compatibility2
911
+ }
912
+ };
913
+ }
914
+ ),
915
+ _metadata: {
916
+ handler: args.handler
917
+ }
918
+ });
919
+ function normalizeDev() {
920
+ return output4(args.dev).apply((v) => $dev && v !== false);
921
+ }
922
+ function normalizeUrl() {
923
+ return output4(args.url).apply((v) => v ?? false);
924
+ }
925
+ function normalizeDomain() {
926
+ if (!args.domain) return;
927
+ if (typeof args.domain === "object" && args.domain !== null && "name" in args.domain) {
928
+ return {
929
+ name: args.domain.name,
930
+ aliases: args.domain.aliases ?? [],
931
+ redirects: args.domain.redirects ?? []
932
+ };
933
+ }
934
+ return {
935
+ name: args.domain,
936
+ aliases: [],
937
+ redirects: []
938
+ };
939
+ }
940
+ function buildBindings() {
941
+ const result = [
942
+ {
943
+ type: "plain_text",
944
+ name: "SST_RESOURCE_App",
945
+ text: jsonStringify({
946
+ name: $app.name,
947
+ stage: $app.stage
948
+ })
949
+ }
950
+ ];
951
+ if (!args.link) return result;
952
+ return output4(args.link).apply((links) => {
953
+ for (let link of links) {
954
+ if (!Link.isLinkable(link)) continue;
955
+ const name2 = output4(link.urn).apply((uri) => uri.split("::").at(-1));
956
+ const item = link.getSSTLink();
957
+ const b = item.include?.find(
958
+ (i) => i.type === "cloudflare.binding"
959
+ );
960
+ result.push(
961
+ b ? {
962
+ type: {
963
+ aiBindings: "ai",
964
+ plainTextBindings: "plain_text",
965
+ secretTextBindings: "secret_text",
966
+ queueBindings: "queue",
967
+ serviceBindings: "service",
968
+ durableObjectNamespaceBindings: "durable_object_namespace",
969
+ kvNamespaceBindings: "kv_namespace",
970
+ d1DatabaseBindings: "d1",
971
+ r2BucketBindings: "r2_bucket",
972
+ hyperdriveBindings: "hyperdrive",
973
+ versionMetadataBindings: "version_metadata",
974
+ workflowBindings: "workflow",
975
+ rateLimitBindings: "ratelimit"
976
+ }[b.binding],
977
+ name: name2,
978
+ ...b.properties
979
+ } : {
980
+ type: "secret_text",
981
+ name: output4(name2).apply((name3) => `SST_RESOURCE_${name3}`),
982
+ text: jsonStringify(item.properties)
983
+ }
984
+ );
985
+ }
986
+ return result;
987
+ });
988
+ }
989
+ function createAwsCredentials() {
990
+ return output4(
991
+ Link.getInclude("aws.permission", args.link)
992
+ ).apply((permissions) => {
993
+ if (permissions.length === 0) return;
994
+ const user = new iam.User(
995
+ `${name}AwsUser`,
996
+ { forceDestroy: true },
997
+ { parent }
998
+ );
999
+ new iam.UserPolicy(
1000
+ `${name}AwsPolicy`,
1001
+ {
1002
+ user: user.name,
1003
+ policy: jsonStringify({
1004
+ Statement: permissions.map((p) => ({
1005
+ Effect: (() => {
1006
+ const effect = p.effect ?? "allow";
1007
+ return effect.charAt(0).toUpperCase() + effect.slice(1);
1008
+ })(),
1009
+ Action: p.actions,
1010
+ Resource: p.resources,
1011
+ ..."conditions" in p && p.conditions ? {
1012
+ Condition: Object.fromEntries(
1013
+ p.conditions.map((c) => [
1014
+ c.test,
1015
+ { [c.variable]: c.values }
1016
+ ])
1017
+ )
1018
+ } : {}
1019
+ }))
1020
+ })
1021
+ },
1022
+ { parent }
1023
+ );
1024
+ const keys = new iam.AccessKey(
1025
+ `${name}AwsCredentials`,
1026
+ { user: user.name },
1027
+ { parent }
1028
+ );
1029
+ return keys;
1030
+ });
1031
+ }
1032
+ function buildHandler() {
1033
+ const buildResult = buildInput.apply(async (input) => {
1034
+ const result = await rpc.call("Runtime.Build", input);
1035
+ if (result.errors.length > 0) {
1036
+ throw new Error(result.errors.join("\n"));
1037
+ }
1038
+ return result;
1039
+ });
1040
+ return buildResult;
1041
+ }
1042
+ function createScript() {
1043
+ const scriptName = prefixName(54, `${name}Script`).toLowerCase();
1044
+ const durableObjectMigrationState = args.migrations ? all2([args.migrations, accountId]).apply(
1045
+ async ([migrations, accountId2]) => {
1046
+ const latest = migrations.at(-1);
1047
+ if (!latest) {
1048
+ return {
1049
+ migrationTag: void 0,
1050
+ migrations: void 0
1051
+ };
1052
+ }
1053
+ let currentTag;
1054
+ try {
1055
+ const published = await cfFetch(`/accounts/${accountId2}/workers/scripts`);
1056
+ currentTag = published.result.find(
1057
+ (script2) => script2.id === scriptName
1058
+ )?.migration_tag;
1059
+ } catch (error) {
1060
+ const code = typeof error === "object" && error !== null && "errors" in error && Array.isArray(error.errors) && typeof error.errors[0]?.code === "number" ? error.errors[0].code : void 0;
1061
+ const serviceNotFound = code === 10090;
1062
+ const environmentNotFound = code === 10092;
1063
+ if (!serviceNotFound && !environmentNotFound) {
1064
+ throw error;
1065
+ }
1066
+ }
1067
+ if (currentTag) {
1068
+ const foundIndex = migrations.findIndex(
1069
+ (migration) => migration.tag === currentTag
1070
+ );
1071
+ if (foundIndex === migrations.length - 1) {
1072
+ return {
1073
+ migrationTag: currentTag,
1074
+ migrations: void 0
1075
+ };
1076
+ }
1077
+ const pending = foundIndex === -1 ? migrations : migrations.slice(foundIndex + 1);
1078
+ const steps2 = pending.map(({ tag: _tag, ...step }) => step);
1079
+ return {
1080
+ migrationTag: currentTag,
1081
+ migrations: {
1082
+ oldTag: currentTag,
1083
+ newTag: latest.tag,
1084
+ steps: steps2
1085
+ }
1086
+ };
1087
+ }
1088
+ const steps = migrations.map(({ tag: _tag, ...step }) => step);
1089
+ return {
1090
+ migrationTag: "",
1091
+ migrations: {
1092
+ newTag: latest.tag,
1093
+ steps
1094
+ }
1095
+ };
1096
+ }
1097
+ ) : void 0;
1098
+ const contentFilePath = build.apply(
1099
+ (build2) => path.join(build2.out, build2.handler)
1100
+ );
1101
+ return new cf.WorkersScript(
1102
+ ...transform(
1103
+ args.transform?.worker,
1104
+ `${name}Script`,
1105
+ {
1106
+ scriptName,
1107
+ mainModule: "placeholder",
1108
+ accountId,
1109
+ contentFile: contentFilePath,
1110
+ contentSha256: contentFilePath.apply(
1111
+ async (p) => crypto.createHash("sha256").update(await fs2.readFile(p, "utf-8")).digest("hex")
1112
+ ),
1113
+ compatibilityDate: compatibility.apply((value) => value.date),
1114
+ compatibilityFlags: compatibility.apply((value) => value.flags),
1115
+ ...durableObjectMigrationState ? {
1116
+ migrations: durableObjectMigrationState.apply(
1117
+ (state) => state.migrations
1118
+ ),
1119
+ migrationTag: durableObjectMigrationState.apply(
1120
+ (state) => state.migrationTag
1121
+ )
1122
+ } : {},
1123
+ assets: args.assets ? output4(args.assets).apply(async (assets) => {
1124
+ const directory = path.isAbsolute(assets.directory) ? assets.directory : path.join($cli.paths.root, assets.directory);
1125
+ let headers;
1126
+ let redirects;
1127
+ try {
1128
+ headers = await fs2.readFile(
1129
+ path.join(directory, "_headers"),
1130
+ "utf-8"
1131
+ );
1132
+ } catch (e) {
1133
+ }
1134
+ try {
1135
+ redirects = await fs2.readFile(
1136
+ path.join(directory, "_redirects"),
1137
+ "utf-8"
1138
+ );
1139
+ } catch (e) {
1140
+ }
1141
+ return {
1142
+ directory,
1143
+ config: {
1144
+ headers,
1145
+ redirects,
1146
+ htmlHandling: assets.htmlHandling,
1147
+ notFoundHandling: assets.notFoundHandling,
1148
+ runWorkerFirst: assets.runWorkerFirst
1149
+ }
1150
+ };
1151
+ }) : void 0,
1152
+ bindings: all2([args.environment, iamCredentials, bindings]).apply(
1153
+ ([environment, iamCredentials2, bindings2]) => [
1154
+ ...bindings2,
1155
+ ...iamCredentials2 ? [
1156
+ {
1157
+ type: "plain_text",
1158
+ name: "AWS_ACCESS_KEY_ID",
1159
+ text: iamCredentials2.id
1160
+ },
1161
+ {
1162
+ type: "secret_text",
1163
+ name: "AWS_SECRET_ACCESS_KEY",
1164
+ text: iamCredentials2.secret
1165
+ }
1166
+ ] : [],
1167
+ ...args.assets ? [
1168
+ {
1169
+ type: "assets",
1170
+ name: "ASSETS"
1171
+ }
1172
+ ] : [],
1173
+ ...Object.entries(environment ?? {}).map(([key, value]) => ({
1174
+ type: "plain_text",
1175
+ name: key,
1176
+ text: value
1177
+ }))
1178
+ ]
1179
+ )
1180
+ },
1181
+ { parent, ignoreChanges: ["scriptName"] }
1182
+ )
1183
+ );
1184
+ }
1185
+ function createWorkersUrl() {
1186
+ return new WorkerUrl(
1187
+ `${name}Url`,
1188
+ {
1189
+ accountId,
1190
+ scriptName: script.scriptName,
1191
+ enabled: urlEnabled,
1192
+ etag: script.etag
1193
+ },
1194
+ { parent }
1195
+ );
1196
+ }
1197
+ function createWorkerPlacement() {
1198
+ if (!args.placement) return;
1199
+ return new WorkerPlacement(
1200
+ `${name}Placement`,
1201
+ {
1202
+ accountId,
1203
+ scriptName: script.scriptName,
1204
+ // Reapply placement after each script update. Asset-backed SSR workers
1205
+ // can rewrite script settings and reset placement back to the default.
1206
+ etag: script.etag,
1207
+ ...args.placement
1208
+ },
1209
+ { parent }
1210
+ );
1211
+ }
1212
+ function createWorkersDomain() {
1213
+ if (!domain) return;
1214
+ const zone = new ZoneLookup(
1215
+ `${name}ZoneLookup`,
1216
+ {
1217
+ accountId,
1218
+ domain: domain.name
1219
+ },
1220
+ { parent }
1221
+ );
1222
+ return new cf.WorkersCustomDomain(
1223
+ `${name}Domain`,
1224
+ {
1225
+ accountId,
1226
+ service: script.scriptName,
1227
+ hostname: domain.name,
1228
+ zoneId: zone.id,
1229
+ environment: "production"
1230
+ },
1231
+ { parent }
1232
+ );
1233
+ }
1234
+ function createAliases() {
1235
+ if (!domain) return;
1236
+ for (const [i, hostname] of domain.aliases.entries()) {
1237
+ const zone = new ZoneLookup(
1238
+ `${name}Alias${i}ZoneLookup`,
1239
+ {
1240
+ accountId,
1241
+ domain: hostname
1242
+ },
1243
+ { parent }
1244
+ );
1245
+ new cf.WorkersCustomDomain(
1246
+ `${name}Alias${i}Domain`,
1247
+ {
1248
+ accountId,
1249
+ service: script.scriptName,
1250
+ hostname,
1251
+ zoneId: zone.id,
1252
+ environment: "production"
1253
+ },
1254
+ { parent }
1255
+ );
1256
+ }
1257
+ }
1258
+ function createRedirects() {
1259
+ if (!domain) return;
1260
+ for (const [i, hostname] of domain.redirects.entries()) {
1261
+ const resourceName = `${name}Redirect${i}`;
1262
+ const zone = new ZoneLookup(
1263
+ `${resourceName}ZoneLookup`,
1264
+ {
1265
+ accountId,
1266
+ domain: hostname
1267
+ },
1268
+ { parent }
1269
+ );
1270
+ new cf.DnsRecord(
1271
+ `${resourceName}Record`,
1272
+ {
1273
+ zoneId: zone.id,
1274
+ name: hostname,
1275
+ type: "AAAA",
1276
+ content: "100::",
1277
+ proxied: true,
1278
+ ttl: 1
1279
+ },
1280
+ { parent }
1281
+ );
1282
+ new cf.PageRule(
1283
+ `${resourceName}Rule`,
1284
+ {
1285
+ zoneId: zone.id,
1286
+ target: interpolate`${hostname}/*`,
1287
+ priority: i + 1,
1288
+ status: "active",
1289
+ actions: {
1290
+ forwardingUrl: {
1291
+ statusCode: 301,
1292
+ url: output4(domain.name).apply(
1293
+ (domainName) => `https://${domainName}/$1`
1294
+ )
1295
+ }
1296
+ }
1297
+ },
1298
+ { parent }
1299
+ );
1300
+ }
1301
+ }
1302
+ }
1303
+ /**
1304
+ * The Worker URL if `url` is enabled.
1305
+ */
1306
+ get url() {
1307
+ return this.workerDomain ? interpolate`https://${this.workerDomain.hostname}` : this.workerUrl.url.apply((url) => url ? `https://${url}` : url);
1308
+ }
1309
+ /**
1310
+ * The underlying [resources](/docs/components/#nodes) this component creates.
1311
+ */
1312
+ get nodes() {
1313
+ return {
1314
+ /**
1315
+ * The Cloudflare Worker script.
1316
+ */
1317
+ worker: this.script
1318
+ };
1319
+ }
1320
+ /**
1321
+ * When you link a worker, say WorkerA, to another worker, WorkerB; it automatically creates
1322
+ * a service binding between the workers. It allows WorkerA to call WorkerB without going
1323
+ * through a publicly-accessible URL.
1324
+ *
1325
+ * @example
1326
+ * ```ts title="index.ts" {3}
1327
+ * import { Resource } from "sst";
1328
+ *
1329
+ * await Resource.WorkerB.fetch(request);
1330
+ * ```
1331
+ *
1332
+ * Read more about [binding Workers](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/).
1333
+ *
1334
+ * @internal
1335
+ */
1336
+ getSSTLink() {
1337
+ return {
1338
+ properties: {
1339
+ url: this.url
1340
+ },
1341
+ include: [
1342
+ binding({
1343
+ type: "serviceBindings",
1344
+ properties: {
1345
+ service: this.script.id
1346
+ }
1347
+ })
1348
+ ]
1349
+ };
1350
+ }
1351
+ };
1352
+ var __pulumiType5 = "sst:cloudflare:Worker";
1353
+ Worker.__pulumiType = __pulumiType5;
1354
+
1355
+ // platform/src/components/cloudflare/static-site.ts
1356
+ var StaticSite = class extends Component {
1357
+ assets;
1358
+ router;
1359
+ constructor(name, args = {}, opts = {}) {
1360
+ super(__pulumiType6, name, args, opts);
1361
+ const parent = this;
1362
+ const { sitePath, environment, indexPage } = prepare(args);
1363
+ const outputPath = $dev ? path2.join($cli.paths.platform, "functions", "empty-site") : buildApp2(parent, name, args.build, sitePath, environment);
1364
+ const storage = createKvStorage();
1365
+ const assetManifest = generateAssetManifest();
1366
+ const kvData = uploadAssets();
1367
+ const worker = createRouter();
1368
+ this.assets = storage;
1369
+ this.router = worker;
1370
+ this.registerOutputs({
1371
+ _hint: this.url,
1372
+ _dev: {
1373
+ environment,
1374
+ command: "npm run dev",
1375
+ directory: sitePath,
1376
+ autostart: true
1377
+ },
1378
+ _metadata: {
1379
+ path: sitePath,
1380
+ environment,
1381
+ url: this.url
1382
+ }
1383
+ });
1384
+ function createKvStorage() {
1385
+ return new Kv(
1386
+ ...transform(
1387
+ args.transform?.assets,
1388
+ `${name}Assets`,
1389
+ {
1390
+ accountId: args.accountId
1391
+ },
1392
+ {
1393
+ parent,
1394
+ retainOnDelete: false
1395
+ }
1396
+ )
1397
+ );
1398
+ }
1399
+ function generateAssetManifest() {
1400
+ return all3([outputPath, args.assets]).apply(
1401
+ async ([outputPath2, assets]) => {
1402
+ const fileOptions = assets?.fileOptions ?? [
1403
+ {
1404
+ files: "**",
1405
+ cacheControl: "max-age=0,no-cache,no-store,must-revalidate"
1406
+ },
1407
+ {
1408
+ files: ["**/*.js", "**/*.css"],
1409
+ cacheControl: "max-age=31536000,public,immutable"
1410
+ }
1411
+ ];
1412
+ const manifest = [];
1413
+ const filesProcessed = [];
1414
+ for (const fileOption of fileOptions.reverse()) {
1415
+ const files = globSync(fileOption.files, {
1416
+ cwd: path2.resolve(outputPath2),
1417
+ nodir: true,
1418
+ dot: true,
1419
+ ignore: [
1420
+ ".sst/**",
1421
+ ...typeof fileOption.ignore === "string" ? [fileOption.ignore] : fileOption.ignore ?? []
1422
+ ]
1423
+ }).filter((file) => !filesProcessed.includes(file));
1424
+ filesProcessed.push(...files);
1425
+ manifest.push(
1426
+ ...await Promise.all(
1427
+ files.map(async (file) => {
1428
+ const source = path2.resolve(outputPath2, file);
1429
+ const content = await fs3.promises.readFile(source, "utf-8");
1430
+ const hash = crypto2.createHash("sha256").update(content).digest("hex");
1431
+ return {
1432
+ source,
1433
+ key: file,
1434
+ hash,
1435
+ cacheControl: fileOption.cacheControl,
1436
+ contentType: fileOption.contentType ?? getContentType(file, "UTF-8")
1437
+ };
1438
+ })
1439
+ )
1440
+ );
1441
+ }
1442
+ return manifest;
1443
+ }
1444
+ );
1445
+ }
1446
+ function uploadAssets() {
1447
+ return new KvData(
1448
+ `${name}AssetFiles`,
1449
+ {
1450
+ accountId: args.accountId ?? DEFAULT_ACCOUNT_ID,
1451
+ namespaceId: storage.id,
1452
+ entries: assetManifest.apply(
1453
+ (manifest) => manifest.map((m) => ({
1454
+ source: m.source,
1455
+ key: m.key,
1456
+ hash: m.hash,
1457
+ cacheControl: m.cacheControl,
1458
+ contentType: m.contentType
1459
+ }))
1460
+ )
1461
+ },
1462
+ { parent, ignoreChanges: $dev ? ["*"] : void 0 }
1463
+ );
1464
+ }
1465
+ function createRouter() {
1466
+ return new Worker(
1467
+ `${name}Router`,
1468
+ {
1469
+ accountId: args.accountId,
1470
+ handler: path2.join(
1471
+ $cli.paths.platform,
1472
+ "functions",
1473
+ "cf-static-site-router-worker"
1474
+ ),
1475
+ url: true,
1476
+ domain: args.domain,
1477
+ environment: {
1478
+ INDEX_PAGE: indexPage,
1479
+ ...args.errorPage ? { ERROR_PAGE: args.errorPage } : {}
1480
+ },
1481
+ build: {
1482
+ esbuild: assetManifest.apply((assetManifest2) => ({
1483
+ define: {
1484
+ SST_ASSET_MANIFEST: JSON.stringify(
1485
+ Object.fromEntries(assetManifest2.map((e) => [e.key, e.hash]))
1486
+ )
1487
+ }
1488
+ }))
1489
+ },
1490
+ transform: {
1491
+ worker: (workerArgs) => {
1492
+ workerArgs.bindings = output5(workerArgs.bindings ?? []).apply(
1493
+ (bindings) => [
1494
+ ...bindings,
1495
+ {
1496
+ type: "kv_namespace",
1497
+ name: "ASSETS",
1498
+ namespaceId: storage.id
1499
+ }
1500
+ ]
1501
+ );
1502
+ }
1503
+ }
1504
+ },
1505
+ // create worker after KV upload finishes
1506
+ { dependsOn: kvData, parent }
1507
+ );
1508
+ }
1509
+ }
1510
+ /**
1511
+ * The URL of the website.
1512
+ *
1513
+ * If the `domain` is set, this is the URL with the custom domain.
1514
+ * Otherwise, it's the auto-generated worker URL.
1515
+ */
1516
+ get url() {
1517
+ return this.router.url;
1518
+ }
1519
+ /**
1520
+ * The underlying [resources](/docs/components/#nodes) this component creates.
1521
+ */
1522
+ get nodes() {
1523
+ return {
1524
+ /**
1525
+ * The KV namespace that stores the assets.
1526
+ */
1527
+ assets: this.assets,
1528
+ /**
1529
+ * The worker that serves the requests.
1530
+ */
1531
+ router: this.router
1532
+ };
1533
+ }
1534
+ /** @internal */
1535
+ getSSTLink() {
1536
+ return {
1537
+ properties: {
1538
+ url: this.url
1539
+ }
1540
+ };
1541
+ }
1542
+ };
1543
+ var __pulumiType6 = "sst:cloudflare:StaticSite";
1544
+ StaticSite.__pulumiType = __pulumiType6;
1545
+
1546
+ // platform/src/components/cloudflare/static-site-v2.ts
1547
+ import path3 from "path";
1548
+ import { output as output6 } from "@pulumi/pulumi";
1549
+ var StaticSiteV2 = class extends Component {
1550
+ server;
1551
+ devUrl = output6(URL_UNAVAILABLE);
1552
+ constructor(name, args = {}, opts = {}) {
1553
+ super(__pulumiType7, name, args, opts);
1554
+ const self = this;
1555
+ const { sitePath, environment, indexPage } = prepare(args);
1556
+ const dev = normalizeDev();
1557
+ if (dev.enabled) {
1558
+ this.devUrl = dev.url;
1559
+ this.registerOutputs({
1560
+ _hint: void 0,
1561
+ _dev: dev.outputs,
1562
+ _metadata: {
1563
+ mode: "placeholder",
1564
+ path: sitePath,
1565
+ environment,
1566
+ url: this.url
1567
+ }
1568
+ });
1569
+ return;
1570
+ }
1571
+ function normalizeDev() {
1572
+ const enabled = $dev && args.dev !== false;
1573
+ const devArgs = args.dev || {};
1574
+ return {
1575
+ enabled,
1576
+ url: output6(devArgs.url ?? URL_UNAVAILABLE),
1577
+ outputs: {
1578
+ title: devArgs.title,
1579
+ environment,
1580
+ command: output6(devArgs.command ?? "npm run dev"),
1581
+ autostart: output6(devArgs.autostart ?? true),
1582
+ directory: output6(devArgs.directory ?? sitePath)
1583
+ }
1584
+ };
1585
+ }
1586
+ const htmlHandling = normalizeHtmlHandling();
1587
+ const notFound = normalizeNotFound();
1588
+ const outputPath = buildApp2(self, name, args.build, sitePath, environment);
1589
+ const worker = createRouter();
1590
+ this.server = worker;
1591
+ this.registerOutputs({
1592
+ _hint: this.url,
1593
+ _dev: dev.outputs,
1594
+ _metadata: {
1595
+ mode: "deployed",
1596
+ path: sitePath,
1597
+ environment,
1598
+ url: this.url
1599
+ }
1600
+ });
1601
+ function createRouter() {
1602
+ return new Worker(
1603
+ ...transform(
1604
+ args.transform?.server,
1605
+ `${name}Router`,
1606
+ {
1607
+ accountId: args.accountId,
1608
+ handler: path3.join(
1609
+ $cli.paths.platform,
1610
+ "functions",
1611
+ "cf-static-site-router-worker-experimental"
1612
+ ),
1613
+ environment: environment.apply((e) => ({
1614
+ ...e,
1615
+ ...args.indexPage || args.errorPage ? { INDEX_PAGE: indexPage } : {},
1616
+ ...args.errorPage ? { ERROR_PAGE: args.errorPage } : {}
1617
+ })),
1618
+ url: true,
1619
+ dev: false,
1620
+ domain: args.domain,
1621
+ assets: {
1622
+ directory: outputPath,
1623
+ htmlHandling,
1624
+ notFoundHandling: notFound
1625
+ }
1626
+ },
1627
+ { parent: self }
1628
+ )
1629
+ );
1630
+ }
1631
+ function normalizeHtmlHandling() {
1632
+ return args.trailingSlash === "force" ? "force-trailing-slash" : args.trailingSlash === "drop" ? "drop-trailing-slash" : "auto-trailing-slash";
1633
+ }
1634
+ function normalizeNotFound() {
1635
+ return args.notFound === "404" ? "404-page" : "single-page-application";
1636
+ }
1637
+ }
1638
+ /**
1639
+ * The URL of the website.
1640
+ *
1641
+ * If the `domain` is set, this is the URL with the custom domain.
1642
+ * Otherwise, it's the auto-generated worker URL.
1643
+ */
1644
+ get url() {
1645
+ return this.server?.url ?? this.devUrl;
1646
+ }
1647
+ /**
1648
+ * The underlying [resources](/docs/components/#nodes) this component creates.
1649
+ */
1650
+ get nodes() {
1651
+ return {
1652
+ /**
1653
+ * The worker that serves the requests.
1654
+ */
1655
+ server: this.server
1656
+ };
1657
+ }
1658
+ /** @internal */
1659
+ getSSTLink() {
1660
+ return {
1661
+ properties: {
1662
+ url: this.url
1663
+ }
1664
+ };
1665
+ }
1666
+ };
1667
+ var __pulumiType7 = "sst:cloudflare:StaticSite";
1668
+ StaticSiteV2.__pulumiType = __pulumiType7;
1669
+
1670
+ // platform/src/components/cloudflare/auth.ts
1671
+ import {
1672
+ output as output7,
1673
+ secret
1674
+ } from "@pulumi/pulumi";
1675
+ import { PrivateKey } from "@pulumi/tls";
1676
+ var Auth = class extends Component {
1677
+ _key;
1678
+ _authenticator;
1679
+ constructor(name, args, opts) {
1680
+ super(__pulumiType8, name, args, opts);
1681
+ this._key = new PrivateKey(`${name}Keypair`, {
1682
+ algorithm: "RSA"
1683
+ });
1684
+ this._authenticator = output7(args.authenticator).apply((args2) => {
1685
+ return new Worker(`${name}Authenticator`, {
1686
+ ...args2,
1687
+ url: true,
1688
+ environment: {
1689
+ ...args2.environment,
1690
+ AUTH_PRIVATE_KEY: secret(this.key.privateKeyPemPkcs8),
1691
+ AUTH_PUBLIC_KEY: secret(this.key.publicKeyPem)
1692
+ }
1693
+ });
1694
+ });
1695
+ }
1696
+ get key() {
1697
+ return this._key;
1698
+ }
1699
+ get authenticator() {
1700
+ return this._authenticator;
1701
+ }
1702
+ get url() {
1703
+ return this._authenticator.url;
1704
+ }
1705
+ /** @internal */
1706
+ getSSTLink() {
1707
+ return {
1708
+ properties: {
1709
+ url: this._authenticator.url,
1710
+ publicKey: secret(this.key.publicKeyPem)
1711
+ }
1712
+ };
1713
+ }
1714
+ };
1715
+ var __pulumiType8 = "sst:cloudflare:Auth";
1716
+ Auth.__pulumiType = __pulumiType8;
1717
+
1718
+ // platform/src/components/cloudflare/queue.ts
1719
+ import * as cloudflare6 from "@pulumi/cloudflare";
1720
+
1721
+ // platform/src/components/cloudflare/queue-worker-subscriber.ts
1722
+ import { output as output9 } from "@pulumi/pulumi";
1723
+ import * as cloudflare5 from "@pulumi/cloudflare";
1724
+
1725
+ // platform/src/components/cloudflare/helpers/worker-builder.ts
1726
+ import {
1727
+ output as output8
1728
+ } from "@pulumi/pulumi";
1729
+ function workerBuilder(name, definition, argsTransform, opts, accountId) {
1730
+ return output8(definition).apply((definition2) => {
1731
+ if (typeof definition2 === "string") {
1732
+ const worker = new Worker(
1733
+ ...transform(argsTransform, name, { accountId, handler: definition2 }, opts || {})
1734
+ );
1735
+ return {
1736
+ getWorker: () => worker,
1737
+ script: worker.nodes.worker
1738
+ };
1739
+ } else if (definition2.handler) {
1740
+ const worker = new Worker(
1741
+ ...transform(
1742
+ argsTransform,
1743
+ name,
1744
+ {
1745
+ accountId,
1746
+ ...definition2
1747
+ },
1748
+ opts || {}
1749
+ )
1750
+ );
1751
+ return {
1752
+ getWorker: () => worker,
1753
+ script: worker.nodes.worker
1754
+ };
1755
+ }
1756
+ throw new Error(`Invalid worker definition for the "${name}" Worker`);
1757
+ });
1758
+ }
1759
+
1760
+ // platform/src/components/cloudflare/queue-worker-subscriber.ts
1761
+ var QueueWorkerSubscriber = class extends Component {
1762
+ _worker;
1763
+ consumer;
1764
+ constructor(name, args, opts) {
1765
+ super(__pulumiType9, name, args, opts);
1766
+ const self = this;
1767
+ const queue = output9(args.queue);
1768
+ const accountId = args.accountId ?? DEFAULT_ACCOUNT_ID;
1769
+ const worker = createWorker();
1770
+ const batchSize = output9(args.batch?.size ?? 10);
1771
+ const window = output9(args.batch?.window ?? "5 seconds");
1772
+ const retryDelay = output9(args.dlq?.retryDelay ?? "0 seconds");
1773
+ const consumer = createConsumer();
1774
+ this._worker = worker;
1775
+ this.consumer = consumer;
1776
+ function createWorker() {
1777
+ return workerBuilder(
1778
+ `${name}Function`,
1779
+ args.subscriber,
1780
+ args.transform?.worker,
1781
+ { parent: self },
1782
+ accountId
1783
+ );
1784
+ }
1785
+ function createConsumer() {
1786
+ return new cloudflare5.QueueConsumer(
1787
+ ...transform(
1788
+ args.transform?.consumer,
1789
+ `${name}Consumer`,
1790
+ {
1791
+ accountId,
1792
+ deadLetterQueue: args.dlq?.queue,
1793
+ queueId: queue.id,
1794
+ scriptName: worker.script.scriptName,
1795
+ settings: {
1796
+ batchSize,
1797
+ maxConcurrency: args.maxConcurrency,
1798
+ maxRetries: args.dlq?.retry,
1799
+ retryDelay: retryDelay.apply((v) => toMilliseconds(v)),
1800
+ maxWaitTimeMs: window.apply((v) => toMilliseconds(v))
1801
+ },
1802
+ type: "worker"
1803
+ },
1804
+ { parent: self }
1805
+ )
1806
+ );
1807
+ }
1808
+ }
1809
+ /**
1810
+ * The underlying [resources](/docs/components/#nodes) this component creates.
1811
+ */
1812
+ get nodes() {
1813
+ const self = this;
1814
+ return {
1815
+ /**
1816
+ * The Worker that'll process messages from the queue.
1817
+ */
1818
+ get worker() {
1819
+ return self._worker.apply((worker) => worker.getWorker());
1820
+ },
1821
+ /**
1822
+ * The Cloudflare Queue Consumer.
1823
+ */
1824
+ consumer: this.consumer
1825
+ };
1826
+ }
1827
+ };
1828
+ var __pulumiType9 = "sst:cloudflare:QueueWorkerSubscriber";
1829
+ QueueWorkerSubscriber.__pulumiType = __pulumiType9;
1830
+
1831
+ // platform/src/components/cloudflare/queue.ts
1832
+ var Queue2 = class extends Component {
1833
+ queue;
1834
+ isSubscribed = false;
1835
+ constructorName;
1836
+ constructorArgs;
1837
+ constructorOpts;
1838
+ constructor(name, args, opts) {
1839
+ super(__pulumiType10, name, args, opts);
1840
+ const parent = this;
1841
+ this.constructorName = name;
1842
+ this.constructorArgs = args;
1843
+ this.constructorOpts = opts;
1844
+ const queue = create();
1845
+ this.queue = queue;
1846
+ function create() {
1847
+ return new cloudflare6.Queue(
1848
+ ...transform(
1849
+ args?.transform?.queue,
1850
+ `${name}Queue`,
1851
+ {
1852
+ queueName: "",
1853
+ accountId: args?.accountId ?? DEFAULT_ACCOUNT_ID
1854
+ },
1855
+ { parent }
1856
+ )
1857
+ );
1858
+ }
1859
+ }
1860
+ /**
1861
+ * Subscribe to the queue with a worker.
1862
+ *
1863
+ * @param subscriber The worker that'll process messages from the queue.
1864
+ * @param args Configure the subscription.
1865
+ * @param opts Component resource options.
1866
+ *
1867
+ * @example
1868
+ *
1869
+ * Subscribe to the queue with a worker file.
1870
+ *
1871
+ * ```ts title="sst.config.ts"
1872
+ * queue.subscribe("consumer.ts");
1873
+ * ```
1874
+ *
1875
+ * Pass in full worker props.
1876
+ *
1877
+ * ```ts title="sst.config.ts"
1878
+ * const bucket = new sst.cloudflare.Bucket("MyBucket");
1879
+ *
1880
+ * queue.subscribe({
1881
+ * handler: "consumer.ts",
1882
+ * link: [bucket],
1883
+ * });
1884
+ * ```
1885
+ *
1886
+ * Configure batch settings.
1887
+ *
1888
+ * ```ts title="sst.config.ts"
1889
+ * queue.subscribe("consumer.ts", {
1890
+ * batch: {
1891
+ * size: 10,
1892
+ * window: "20 seconds",
1893
+ * },
1894
+ * });
1895
+ * ```
1896
+ */
1897
+ subscribe(subscriber, args, opts) {
1898
+ if (this.isSubscribed) {
1899
+ throw new VisibleError(
1900
+ `Cannot subscribe to the "${this.constructorName}" queue multiple times. A Cloudflare Queue can only have one consumer.`
1901
+ );
1902
+ }
1903
+ this.isSubscribed = true;
1904
+ const parent = this;
1905
+ const name = this.constructorName;
1906
+ return new QueueWorkerSubscriber(
1907
+ `${name}Subscriber`,
1908
+ {
1909
+ queue: { id: this.queue.id },
1910
+ subscriber,
1911
+ accountId: this.constructorArgs?.accountId,
1912
+ dlq: this.constructorArgs?.dlq,
1913
+ maxConcurrency: this.constructorArgs?.maxConcurrency,
1914
+ batch: args?.batch,
1915
+ transform: args?.transform
1916
+ },
1917
+ { ...opts, provider: this.constructorOpts?.provider }
1918
+ );
1919
+ }
1920
+ getSSTLink() {
1921
+ return {
1922
+ properties: {},
1923
+ include: [
1924
+ binding({
1925
+ type: "queueBindings",
1926
+ properties: {
1927
+ queueName: this.queue.queueName
1928
+ }
1929
+ })
1930
+ ]
1931
+ };
1932
+ }
1933
+ /**
1934
+ * The generated id of the queue
1935
+ */
1936
+ get id() {
1937
+ return this.queue.id;
1938
+ }
1939
+ /**
1940
+ * The underlying [resources](/docs/components/#nodes) this component creates.
1941
+ */
1942
+ get nodes() {
1943
+ return {
1944
+ /**
1945
+ * The Cloudflare queue.
1946
+ */
1947
+ queue: this.queue
1948
+ };
1949
+ }
1950
+ };
1951
+ var __pulumiType10 = "sst:cloudflare:Queue";
1952
+ Queue2.__pulumiType = __pulumiType10;
1953
+
1954
+ // platform/src/components/cloudflare/cron.ts
1955
+ import { all as all4 } from "@pulumi/pulumi";
1956
+ import * as cloudflare7 from "@pulumi/cloudflare";
1957
+ var Cron = class extends Component {
1958
+ worker;
1959
+ trigger;
1960
+ constructor(name, args, opts) {
1961
+ super(__pulumiType11, name, args, opts);
1962
+ const parent = this;
1963
+ const workerArgs = normalizeWorker();
1964
+ const worker = createWorker();
1965
+ const trigger = createTrigger();
1966
+ this.worker = worker;
1967
+ this.trigger = trigger;
1968
+ function normalizeWorker() {
1969
+ if (args.job && args.worker)
1970
+ throw new VisibleError(
1971
+ `You cannot provide both "job" and "worker" in the "${name}" Cron component. The "job" property has been deprecated. Use "worker" instead.`
1972
+ );
1973
+ return args.worker ?? args.job;
1974
+ }
1975
+ function createWorker() {
1976
+ if (!workerArgs)
1977
+ throw new VisibleError(
1978
+ `You must provide a "worker" for the "${name}" Cron component.`
1979
+ );
1980
+ return workerBuilder(`${name}Handler`, workerArgs, void 0, void 0, args.accountId);
1981
+ }
1982
+ function createTrigger() {
1983
+ return all4([args.schedules]).apply(([schedules]) => {
1984
+ return new cloudflare7.WorkersCronTrigger(
1985
+ ...transform(
1986
+ args.transform?.trigger,
1987
+ `${name}Trigger`,
1988
+ {
1989
+ accountId: args.accountId ?? DEFAULT_ACCOUNT_ID,
1990
+ scriptName: worker.script.scriptName,
1991
+ schedules: schedules.map((s) => ({ cron: s }))
1992
+ },
1993
+ { parent }
1994
+ )
1995
+ );
1996
+ });
1997
+ }
1998
+ }
1999
+ /**
2000
+ * The underlying [resources](/docs/components/#nodes) this component creates.
2001
+ */
2002
+ get nodes() {
2003
+ return {
2004
+ /**
2005
+ * The Cloudflare Worker.
2006
+ */
2007
+ worker: this.worker.script,
2008
+ /**
2009
+ * The Cloudflare Worker Cron Trigger.
2010
+ */
2011
+ trigger: this.trigger
2012
+ };
2013
+ }
2014
+ };
2015
+ var __pulumiType11 = "sst:cloudflare:Cron";
2016
+ Cron.__pulumiType = __pulumiType11;
2017
+
2018
+ // platform/src/components/cloudflare/ai.ts
2019
+ var Ai = class extends Component {
2020
+ constructor(name, args, opts) {
2021
+ super(__pulumiType12, name, args, opts);
2022
+ }
2023
+ /**
2024
+ * When you link an AI binding, it will be available to the worker and you can
2025
+ * interact with it using its [API methods](https://developers.cloudflare.com/workers-ai/).
2026
+ *
2027
+ * @example
2028
+ * ```ts title="index.ts" {3}
2029
+ * import { Resource } from "sst";
2030
+ *
2031
+ * const result = await Resource.MyAi.run("@cf/meta/llama-3-8b-instruct", {
2032
+ * prompt: "What is the origin of the phrase 'Hello, World'"
2033
+ * });
2034
+ * ```
2035
+ *
2036
+ * @internal
2037
+ */
2038
+ getSSTLink() {
2039
+ return {
2040
+ properties: {},
2041
+ include: [
2042
+ binding({
2043
+ type: "aiBindings",
2044
+ properties: {}
2045
+ })
2046
+ ]
2047
+ };
2048
+ }
2049
+ };
2050
+ var __pulumiType12 = "sst:cloudflare:Ai";
2051
+ Ai.__pulumiType = __pulumiType12;
2052
+
2053
+ // platform/src/components/cloudflare/hyperdrive.ts
2054
+ import { output as output10 } from "@pulumi/pulumi";
2055
+ import * as cloudflare8 from "@pulumi/cloudflare";
2056
+ var Hyperdrive = class _Hyperdrive extends Component {
2057
+ hyperdrive;
2058
+ constructor(name, args, opts) {
2059
+ super(__pulumiType13, name, args, opts);
2060
+ if (args && "ref" in args) {
2061
+ const ref = args;
2062
+ this.hyperdrive = ref.hyperdrive;
2063
+ return;
2064
+ }
2065
+ const parent = this;
2066
+ const origin = output10(args.origin);
2067
+ const caching = normalizeCaching();
2068
+ this.hyperdrive = new cloudflare8.HyperdriveConfig(
2069
+ ...transform(
2070
+ args.transform?.hyperdrive,
2071
+ `${name}Hyperdrive`,
2072
+ {
2073
+ accountId: args.accountId ?? DEFAULT_ACCOUNT_ID,
2074
+ caching,
2075
+ mtls: args.mtls,
2076
+ name: "",
2077
+ origin,
2078
+ originConnectionLimit: args.connectionLimit
2079
+ },
2080
+ { parent }
2081
+ )
2082
+ );
2083
+ function normalizeCaching() {
2084
+ if (args.caching === void 0) return void 0;
2085
+ return output10(args.caching).apply((c) => {
2086
+ if (c === false) return { disabled: true };
2087
+ return {
2088
+ maxAge: c.maxAge ? toSeconds(c.maxAge) : void 0,
2089
+ staleWhileRevalidate: c.staleWhileRevalidate ? toSeconds(c.staleWhileRevalidate) : void 0
2090
+ };
2091
+ });
2092
+ }
2093
+ }
2094
+ /**
2095
+ * When you link Hyperdrive to a worker, the Hyperdrive binding will be available in the
2096
+ * worker and you can use its `connectionString` to connect with a PostgreSQL or MySQL client.
2097
+ *
2098
+ * @example
2099
+ * ```ts title="index.ts" {3}
2100
+ * import postgres from "postgres"
2101
+ * import { Resource } from "sst"
2102
+ *
2103
+ * const sql = postgres(Resource.PostgresDatabase.connectionString)
2104
+ * ```
2105
+ *
2106
+ * For MySQL:
2107
+ *
2108
+ * ```ts title="index.ts" {3}
2109
+ * import mysql from "mysql2/promise"
2110
+ * import { Resource } from "sst"
2111
+ *
2112
+ * const db = await mysql.createConnection(Resource.MySQLDatabase.connectionString)
2113
+ * ```
2114
+ *
2115
+ * @internal
2116
+ */
2117
+ getSSTLink() {
2118
+ return {
2119
+ properties: {
2120
+ id: this.id
2121
+ },
2122
+ include: [
2123
+ binding({
2124
+ type: "hyperdriveBindings",
2125
+ properties: {
2126
+ id: this.id
2127
+ }
2128
+ })
2129
+ ]
2130
+ };
2131
+ }
2132
+ /**
2133
+ * The generated ID of the Hyperdrive config.
2134
+ */
2135
+ get id() {
2136
+ return this.hyperdrive.id.apply(
2137
+ (id) => id.includes("/") ? id.split("/")[1] : id
2138
+ );
2139
+ }
2140
+ /**
2141
+ * The generated name of the Hyperdrive config.
2142
+ */
2143
+ get name() {
2144
+ return this.hyperdrive.name;
2145
+ }
2146
+ /**
2147
+ * The underlying [resources](/docs/components/#nodes) this component creates.
2148
+ */
2149
+ get nodes() {
2150
+ return {
2151
+ /**
2152
+ * The Cloudflare Hyperdrive config.
2153
+ */
2154
+ hyperdrive: this.hyperdrive
2155
+ };
2156
+ }
2157
+ /**
2158
+ * Reference an existing Hyperdrive config with the given ID. This is useful when you
2159
+ * create a Hyperdrive config in one stage and want to share it in another.
2160
+ *
2161
+ * :::tip
2162
+ * You can use the `static get` method to share Hyperdrive configs across stages.
2163
+ * :::
2164
+ *
2165
+ * @param name The name of the component.
2166
+ * @param args The arguments to get the Hyperdrive config.
2167
+ * @param opts Resource options.
2168
+ *
2169
+ * @example
2170
+ * Imagine you create a Hyperdrive config in the `dev` stage. And in your personal stage
2171
+ * `frank`, instead of creating a new one, you want to share the same one from `dev`.
2172
+ *
2173
+ * ```ts title="sst.config.ts"
2174
+ * const hyperdrive = $app.stage === "frank"
2175
+ * ? sst.cloudflare.Hyperdrive.get("MyDatabase", {
2176
+ * hyperdriveId: "a1b2c3d4e5f6",
2177
+ * })
2178
+ * : new sst.cloudflare.Hyperdrive("MyDatabase", { ... });
2179
+ * ```
2180
+ */
2181
+ static get(name, args, opts) {
2182
+ const hyperdrive = cloudflare8.HyperdriveConfig.get(
2183
+ `${name}Hyperdrive`,
2184
+ `${args.accountId ?? DEFAULT_ACCOUNT_ID}/${args.hyperdriveId}`,
2185
+ void 0,
2186
+ opts
2187
+ );
2188
+ return new _Hyperdrive(
2189
+ name,
2190
+ {
2191
+ ref: true,
2192
+ hyperdrive
2193
+ },
2194
+ opts
2195
+ );
2196
+ }
2197
+ };
2198
+ var __pulumiType13 = "sst:cloudflare:Hyperdrive";
2199
+ Hyperdrive.__pulumiType = __pulumiType13;
2200
+
2201
+ // platform/src/components/cloudflare/astro.ts
2202
+ import fs9 from "fs/promises";
2203
+ import path8 from "path";
2204
+
2205
+ // platform/src/components/cloudflare/ssr-site.ts
2206
+ import path5 from "path";
2207
+ import fs5 from "fs";
2208
+ import { output as output11, all as all5 } from "@pulumi/pulumi";
2209
+
2210
+ // platform/src/components/cloudflare/helpers/wrangler.ts
2211
+ import fs4 from "fs";
2212
+ import path4 from "path";
2213
+ function createWranglerConfig(input) {
2214
+ const config = {
2215
+ ...input.frameworkConfig ?? {},
2216
+ name: sanitizeWranglerName(`sst-${input.appStage}-${input.name}`),
2217
+ compatibility_date: input.compatibility.date,
2218
+ compatibility_flags: input.compatibility.flags
2219
+ };
2220
+ if (input.accountId) {
2221
+ config.account_id = input.accountId;
2222
+ }
2223
+ const vars = {
2224
+ ...input.environment ?? {},
2225
+ SST_RESOURCE_App: JSON.stringify({
2226
+ name: input.appName,
2227
+ stage: input.appStage
2228
+ })
2229
+ };
2230
+ const kvNamespaces = [];
2231
+ const r2Buckets = [];
2232
+ const d1Databases = [];
2233
+ const hyperdrives = [];
2234
+ const services = [];
2235
+ const queueProducers = [];
2236
+ const workflows = [];
2237
+ const rateLimits = [];
2238
+ let ai;
2239
+ let versionMetadata;
2240
+ for (const link of input.links ?? []) {
2241
+ const binding2 = link.include.find(
2242
+ (item) => item.type === "cloudflare.binding"
2243
+ );
2244
+ if (!binding2) {
2245
+ vars[`SST_RESOURCE_${link.name}`] = JSON.stringify(link.properties ?? {});
2246
+ continue;
2247
+ }
2248
+ const properties = binding2.properties ?? {};
2249
+ switch (binding2.binding) {
2250
+ case "aiBindings":
2251
+ ai = {
2252
+ binding: link.name,
2253
+ remote: true
2254
+ };
2255
+ break;
2256
+ case "kvNamespaceBindings":
2257
+ kvNamespaces.push({
2258
+ binding: link.name,
2259
+ id: stringValue(properties.namespaceId),
2260
+ remote: true
2261
+ });
2262
+ break;
2263
+ case "secretTextBindings":
2264
+ case "plainTextBindings":
2265
+ vars[link.name] = stringValue(properties.text);
2266
+ break;
2267
+ case "serviceBindings":
2268
+ services.push({
2269
+ binding: link.name,
2270
+ service: stringValue(properties.service),
2271
+ remote: true
2272
+ });
2273
+ break;
2274
+ case "queueBindings":
2275
+ queueProducers.push({
2276
+ binding: link.name,
2277
+ queue: stringValue(properties.queueName),
2278
+ remote: true
2279
+ });
2280
+ break;
2281
+ case "r2BucketBindings":
2282
+ r2Buckets.push({
2283
+ binding: link.name,
2284
+ bucket_name: stringValue(properties.bucketName),
2285
+ remote: true
2286
+ });
2287
+ break;
2288
+ case "d1DatabaseBindings":
2289
+ d1Databases.push({
2290
+ binding: link.name,
2291
+ database_id: stringValue(properties.id),
2292
+ remote: true
2293
+ });
2294
+ break;
2295
+ case "hyperdriveBindings":
2296
+ hyperdrives.push({
2297
+ binding: link.name,
2298
+ id: stringValue(properties.id)
2299
+ });
2300
+ break;
2301
+ case "versionMetadataBindings":
2302
+ versionMetadata = {
2303
+ binding: link.name
2304
+ };
2305
+ break;
2306
+ case "workflowBindings":
2307
+ workflows.push({
2308
+ binding: link.name,
2309
+ name: stringValue(properties.workflowName),
2310
+ class_name: stringValue(properties.className),
2311
+ script_name: stringValue(properties.scriptName),
2312
+ remote: true
2313
+ });
2314
+ break;
2315
+ case "rateLimitBindings":
2316
+ rateLimits.push({
2317
+ name: link.name,
2318
+ namespace_id: stringValue(properties.namespaceId),
2319
+ simple: properties.simple
2320
+ });
2321
+ break;
2322
+ }
2323
+ }
2324
+ if (Object.keys(vars).length > 0) {
2325
+ config.vars = vars;
2326
+ }
2327
+ if (kvNamespaces.length > 0) {
2328
+ config.kv_namespaces = kvNamespaces;
2329
+ }
2330
+ if (r2Buckets.length > 0) {
2331
+ config.r2_buckets = r2Buckets;
2332
+ }
2333
+ if (d1Databases.length > 0) {
2334
+ config.d1_databases = d1Databases;
2335
+ }
2336
+ if (hyperdrives.length > 0) {
2337
+ config.hyperdrive = hyperdrives;
2338
+ }
2339
+ if (services.length > 0) {
2340
+ config.services = services;
2341
+ }
2342
+ if (queueProducers.length > 0) {
2343
+ config.queues = {
2344
+ producers: queueProducers
2345
+ };
2346
+ }
2347
+ if (ai) {
2348
+ config.ai = ai;
2349
+ }
2350
+ if (versionMetadata) {
2351
+ config.version_metadata = versionMetadata;
2352
+ }
2353
+ if (workflows.length > 0) {
2354
+ config.workflows = workflows;
2355
+ }
2356
+ if (rateLimits.length > 0) {
2357
+ config.rate_limits = rateLimits;
2358
+ }
2359
+ return config;
2360
+ }
2361
+ function writeWranglerConfig(args) {
2362
+ const wranglerPath = path4.join(
2363
+ args.workDir,
2364
+ "wrangler",
2365
+ args.stage,
2366
+ `${args.name}.jsonc`
2367
+ );
2368
+ const contents = JSON.stringify(args.config, null, 2);
2369
+ fs4.mkdirSync(path4.dirname(wranglerPath), { recursive: true });
2370
+ if (!fs4.existsSync(wranglerPath) || fs4.readFileSync(wranglerPath, "utf-8") !== contents) {
2371
+ fs4.writeFileSync(wranglerPath, contents);
2372
+ }
2373
+ return wranglerPath;
2374
+ }
2375
+ function stringValue(input) {
2376
+ return typeof input === "string" ? input : "";
2377
+ }
2378
+ var wranglerNameRegex = /[^a-z0-9-]+/g;
2379
+ function sanitizeWranglerName(input) {
2380
+ const value = input.toLowerCase().replaceAll(wranglerNameRegex, "-");
2381
+ return value.replace(/^-+|-+$/g, "") || "sst";
2382
+ }
2383
+
2384
+ // platform/src/components/cloudflare/ssr-site.ts
2385
+ var SsrSite = class extends Component {
2386
+ server;
2387
+ devUrl;
2388
+ validate(_sitePath) {
2389
+ }
2390
+ buildWrangler(_sitePath) {
2391
+ return void 0;
2392
+ }
2393
+ constructor(type, name, args = {}, opts = {}) {
2394
+ super(type, name, args, opts);
2395
+ const self = this;
2396
+ const sitePath = normalizeSitePath();
2397
+ const compatibility = resolveCompatibility();
2398
+ const frameworkConfig = resolveFrameworkConfig();
2399
+ const wranglerConfig = resolveWranglerConfig();
2400
+ const dev = normalizeDev();
2401
+ this.validate(sitePath);
2402
+ if (dev.enabled) {
2403
+ this.devUrl = dev.url;
2404
+ this.registerOutputs({
2405
+ _dev: dev.outputs,
2406
+ _metadata: {
2407
+ mode: "placeholder",
2408
+ path: sitePath
2409
+ }
2410
+ });
2411
+ return;
2412
+ }
2413
+ const outputPath = buildApp(
2414
+ self,
2415
+ name,
2416
+ args,
2417
+ sitePath,
2418
+ void 0,
2419
+ resolveBuildEnvironment()
2420
+ );
2421
+ const plan = this.buildPlan(outputPath);
2422
+ const worker = createWorker();
2423
+ this.server = worker;
2424
+ this.registerOutputs({
2425
+ _hint: this.url,
2426
+ _metadata: {
2427
+ mode: "deployed",
2428
+ path: sitePath
2429
+ }
2430
+ });
2431
+ function normalizeDev() {
2432
+ const enabled = $dev && args.dev !== false;
2433
+ const devArgs = args.dev || {};
2434
+ return {
2435
+ enabled,
2436
+ url: output11(devArgs.url ?? URL_UNAVAILABLE),
2437
+ outputs: {
2438
+ title: devArgs.title,
2439
+ environment: args.environment,
2440
+ cloudflare: enabled ? {
2441
+ path: resolveDevWranglerPath()
2442
+ } : void 0,
2443
+ command: output11(devArgs.command ?? "npm run dev"),
2444
+ autostart: output11(devArgs.autostart ?? true),
2445
+ directory: devArgs.directory ?? sitePath,
2446
+ links: output11(args.link || []).apply(Link.build).apply((links) => links.map((link) => link.name))
2447
+ }
2448
+ };
2449
+ }
2450
+ function resolveFrameworkConfig() {
2451
+ return output11(self.buildWrangler(sitePath)).apply((config) => config ?? {});
2452
+ }
2453
+ function resolveCompatibility() {
2454
+ const [, workerArgs] = transform(
2455
+ args.transform?.server,
2456
+ `${name}Worker`,
2457
+ {
2458
+ environment: args.environment,
2459
+ link: args.link,
2460
+ accountId: args.accountId,
2461
+ url: true,
2462
+ dev: false,
2463
+ domain: args.domain,
2464
+ handler: output11(""),
2465
+ assets: {
2466
+ directory: output11("")
2467
+ }
2468
+ },
2469
+ { parent: self }
2470
+ );
2471
+ return normalizeCompatibility(workerArgs);
2472
+ }
2473
+ function resolveBuildEnvironment() {
2474
+ return resolveBuildWranglerPath().apply((wranglerPath) => ({
2475
+ SST_WRANGLER_PATH: wranglerPath
2476
+ }));
2477
+ }
2478
+ function resolveDevWranglerPath() {
2479
+ return wranglerConfig.apply((config) => {
2480
+ return writeWranglerConfig({
2481
+ workDir: $cli.paths.work,
2482
+ stage: $app.stage,
2483
+ name,
2484
+ config
2485
+ });
2486
+ });
2487
+ }
2488
+ function resolveWranglerConfig() {
2489
+ return all5([
2490
+ output11(args.environment ?? {}),
2491
+ resolveLinkBindings(),
2492
+ compatibility,
2493
+ frameworkConfig,
2494
+ args.accountId
2495
+ ]).apply(([environment, links, compatibility2, frameworkConfig2, accountId]) => {
2496
+ return createWranglerConfig({
2497
+ appName: $app.name,
2498
+ appStage: $app.stage,
2499
+ name,
2500
+ frameworkConfig: frameworkConfig2,
2501
+ compatibility: compatibility2,
2502
+ environment,
2503
+ links,
2504
+ accountId: accountId ?? DEFAULT_ACCOUNT_ID
2505
+ });
2506
+ });
2507
+ }
2508
+ function resolveBuildWranglerPath() {
2509
+ return wranglerConfig.apply((config) => {
2510
+ return writeWranglerConfig({
2511
+ workDir: $cli.paths.work,
2512
+ stage: $app.stage,
2513
+ name,
2514
+ config
2515
+ });
2516
+ });
2517
+ }
2518
+ function resolveLinkBindings() {
2519
+ return output11(args.link ?? []).apply((links) => {
2520
+ const linkBindings = links.filter(Link.isLinkable).map(
2521
+ (link) => output11({
2522
+ urn: link.urn,
2523
+ link: link.getSSTLink()
2524
+ }).apply(({ urn, link: link2 }) => ({
2525
+ name: urn.split("::").at(-1),
2526
+ include: link2.include ?? [],
2527
+ properties: link2.properties
2528
+ }))
2529
+ );
2530
+ return linkBindings.length > 0 ? all5(linkBindings) : [];
2531
+ });
2532
+ }
2533
+ function normalizeSitePath() {
2534
+ const sitePath2 = args.path ?? ".";
2535
+ if (!fs5.existsSync(sitePath2)) {
2536
+ throw new VisibleError(
2537
+ `Site directory not found at "${path5.resolve(
2538
+ sitePath2
2539
+ )}". Please check the path setting in your configuration.`
2540
+ );
2541
+ }
2542
+ return sitePath2;
2543
+ }
2544
+ function createWorker() {
2545
+ return new Worker(
2546
+ ...transform(
2547
+ args.transform?.server,
2548
+ `${name}Worker`,
2549
+ {
2550
+ environment: args.environment,
2551
+ link: args.link,
2552
+ accountId: args.accountId,
2553
+ url: true,
2554
+ dev: false,
2555
+ domain: args.domain,
2556
+ handler: all5([outputPath, plan.server]).apply(
2557
+ ([outputPath2, server]) => path5.join(outputPath2, server)
2558
+ ),
2559
+ assets: {
2560
+ directory: all5([outputPath, plan.assets]).apply(
2561
+ ([outputPath2, assets]) => path5.join(outputPath2, assets)
2562
+ )
2563
+ }
2564
+ },
2565
+ { parent: self }
2566
+ )
2567
+ );
2568
+ }
2569
+ }
2570
+ /**
2571
+ * The URL of the site.
2572
+ *
2573
+ * If the `domain` is set, this is the URL with the custom domain.
2574
+ * Otherwise, it's the auto-generated Worker URL.
2575
+ */
2576
+ get url() {
2577
+ if (this.server) return this.server.url;
2578
+ return this.devUrl;
2579
+ }
2580
+ /**
2581
+ * The underlying [resources](/docs/components/#nodes) this component creates.
2582
+ */
2583
+ get nodes() {
2584
+ return {
2585
+ /**
2586
+ * The Cloudflare Worker that renders the site.
2587
+ */
2588
+ server: this.server
2589
+ };
2590
+ }
2591
+ /** @internal */
2592
+ getSSTLink() {
2593
+ return {
2594
+ properties: {
2595
+ url: this.url
2596
+ }
2597
+ };
2598
+ }
2599
+ };
2600
+
2601
+ // platform/src/util/fs.ts
2602
+ import fs6 from "fs/promises";
2603
+ async function existsAsync(input) {
2604
+ return fs6.access(input).then(() => true).catch(() => false);
2605
+ }
2606
+
2607
+ // platform/src/util/package.ts
2608
+ import fs7 from "fs";
2609
+ import path6 from "path";
2610
+ function getPackageVersion(sitePath, packageName) {
2611
+ try {
2612
+ const pkgPath = path6.join(sitePath, "package.json");
2613
+ if (!fs7.existsSync(pkgPath)) {
2614
+ return void 0;
2615
+ }
2616
+ const pkg = JSON.parse(fs7.readFileSync(pkgPath, "utf-8"));
2617
+ return pkg.dependencies?.[packageName] ?? pkg.devDependencies?.[packageName];
2618
+ } catch {
2619
+ return void 0;
2620
+ }
2621
+ }
2622
+
2623
+ // platform/src/components/cloudflare/helpers/validation.ts
2624
+ import fs8 from "fs";
2625
+ import path7 from "path";
2626
+ function validateNoWranglerFile(sitePath, componentName) {
2627
+ const wranglerFiles = ["wrangler.toml", "wrangler.json", "wrangler.jsonc"];
2628
+ for (const file of wranglerFiles) {
2629
+ const filePath = path7.join(sitePath, file);
2630
+ if (fs8.existsSync(filePath)) {
2631
+ throw new VisibleError(
2632
+ [
2633
+ `Found ${file} in "${path7.resolve(sitePath)}" for ${componentName}.`,
2634
+ "",
2635
+ "Remove it to avoid interfering with SST managed wrangler configurations:",
2636
+ `https://sst-community.github.io/sst/docs/cloudflare/#cloudflare-vite-plugin`
2637
+ ].join("\n")
2638
+ );
2639
+ }
2640
+ }
2641
+ }
2642
+ function validateFrameworkConfig(input) {
2643
+ const { sitePath, configName, componentName } = input;
2644
+ const extensions = [".ts", ".js", ".mjs"];
2645
+ const configDir = sitePath;
2646
+ let configPath;
2647
+ for (const ext of extensions) {
2648
+ const candidate = path7.join(configDir, `${configName}${ext}`);
2649
+ if (fs8.existsSync(candidate)) {
2650
+ configPath = candidate;
2651
+ break;
2652
+ }
2653
+ }
2654
+ if (!configPath) {
2655
+ throw new VisibleError(
2656
+ `Could not find config file for ${componentName} in "${path7.resolve(configDir)}".
2657
+ Expected one of: ${extensions.map((e) => `${configName}${e}`).join(", ")}.`
2658
+ );
2659
+ }
2660
+ const content = fs8.readFileSync(configPath, "utf-8");
2661
+ const hasWranglerPath = /configPath\s*[:=]\s*process\.env\.SST_WRANGLER_PATH/.test(content);
2662
+ if (!hasWranglerPath) {
2663
+ throw new VisibleError(
2664
+ [
2665
+ `Missing required configuration for ${componentName}.`,
2666
+ "",
2667
+ `The Cloudflare adapter must be configured with:`,
2668
+ ` configPath: process.env.SST_WRANGLER_PATH,`,
2669
+ "",
2670
+ `This is required for linked resources to work correctly:`,
2671
+ `https://sst-community.github.io/sst/docs/cloudflare/#cloudflare-vite-plugin`
2672
+ ].join("\n")
2673
+ );
2674
+ }
2675
+ }
2676
+
2677
+ // platform/src/components/cloudflare/astro.ts
2678
+ var Astro = class extends SsrSite {
2679
+ constructor(name, args = {}, opts = {}) {
2680
+ super(__pulumiType14, name, args, opts);
2681
+ }
2682
+ validate(sitePath) {
2683
+ const astroVersion = getPackageVersion(sitePath, "astro");
2684
+ const isV6Plus = !astroVersion || isALteB("6.0.0", astroVersion);
2685
+ if (isV6Plus) {
2686
+ validateFrameworkConfig({
2687
+ sitePath,
2688
+ configName: "astro.config",
2689
+ componentName: "Astro"
2690
+ });
2691
+ }
2692
+ validateNoWranglerFile(sitePath, "Astro");
2693
+ }
2694
+ buildPlan(outputPath) {
2695
+ return outputPath.apply(async (outputPath2) => {
2696
+ const distPath = path8.join(outputPath2, "dist");
2697
+ const legacyServer = path8.join(distPath, "_worker.js", "index.js");
2698
+ if (await existsAsync(legacyServer)) {
2699
+ const ignorePath = path8.join(distPath, ".assetsignore");
2700
+ const ignorePatterns = await existsAsync(ignorePath) ? (await fs9.readFile(ignorePath, "utf-8")).split("\n") : [];
2701
+ let dirty = false;
2702
+ ["_worker.js", "_routes.json"].forEach((pattern) => {
2703
+ if (ignorePatterns.includes(pattern)) return;
2704
+ ignorePatterns.push(pattern);
2705
+ dirty = true;
2706
+ });
2707
+ if (dirty) {
2708
+ await fs9.appendFile(ignorePath, "\n_worker.js\n_routes.json");
2709
+ }
2710
+ return {
2711
+ server: "./dist/_worker.js/index.js",
2712
+ assets: "./dist"
2713
+ };
2714
+ }
2715
+ const wranglerPath = path8.join(distPath, "server", "wrangler.json");
2716
+ if (await existsAsync(wranglerPath)) {
2717
+ const serverPath = path8.dirname(wranglerPath);
2718
+ const wrangler = JSON.parse(
2719
+ await fs9.readFile(wranglerPath, "utf-8")
2720
+ );
2721
+ const main = wrangler.main ?? "entry.mjs";
2722
+ const serverEntry = path8.resolve(serverPath, main);
2723
+ const assetsDirectory = wrangler.assets?.directory;
2724
+ const assetsPath = assetsDirectory ? path8.resolve(serverPath, assetsDirectory) : path8.join(distPath, "client");
2725
+ if (await existsAsync(serverEntry)) {
2726
+ return {
2727
+ server: toRelativePath(serverEntry),
2728
+ assets: toRelativePath(assetsPath)
2729
+ };
2730
+ }
2731
+ }
2732
+ throw new VisibleError(
2733
+ `SSR server bundle not found in the build output at:
2734
+ "${path8.resolve(distPath)}".
2735
+
2736
+ Expected either Astro v5 output in \`dist/_worker.js/index.js\` or Astro v6+ output in \`dist/server/wrangler.json\`.
2737
+ If your Astro project is entirely pre-rendered, use the \`sst.cloudflare.StaticSite\` component instead of \`sst.cloudflare.Astro\`.`
2738
+ );
2739
+ function toRelativePath(filePath) {
2740
+ const relative = path8.relative(outputPath2, filePath);
2741
+ return relative.startsWith(".") ? relative : `./${relative}`;
2742
+ }
2743
+ });
2744
+ }
2745
+ /**
2746
+ * The URL of the Astro site.
2747
+ *
2748
+ * If the `domain` is set, this is the URL with the custom domain.
2749
+ * Otherwise, it's the auto-generated Worker URL.
2750
+ */
2751
+ get url() {
2752
+ return super.url;
2753
+ }
2754
+ };
2755
+ var __pulumiType14 = "sst:cloudflare:Astro";
2756
+ Astro.__pulumiType = __pulumiType14;
2757
+
2758
+ // platform/src/components/cloudflare/react-router.ts
2759
+ import path9 from "path";
2760
+ var ReactRouter = class extends SsrSite {
2761
+ constructor(name, args = {}, opts = {}) {
2762
+ super(__pulumiType15, name, args, opts);
2763
+ }
2764
+ validate(sitePath) {
2765
+ validateFrameworkConfig({
2766
+ sitePath,
2767
+ configName: "vite.config",
2768
+ componentName: "ReactRouter"
2769
+ });
2770
+ validateNoWranglerFile(sitePath, "ReactRouter");
2771
+ }
2772
+ buildPlan(outputPath) {
2773
+ return outputPath.apply(async (outputPath2) => {
2774
+ const serverPath = path9.join(outputPath2, "build", "server", "index.js");
2775
+ const assetsPath = path9.join(outputPath2, "build", "client");
2776
+ if (!await existsAsync(serverPath)) {
2777
+ throw new VisibleError(
2778
+ [
2779
+ `React Router server bundle not found at:
2780
+ "${serverPath}".`,
2781
+ "",
2782
+ "Make sure the Cloudflare Vite plugin is configured in your `vite.config.ts`.",
2783
+ "If your React Router project is entirely pre-rendered, use `sst.cloudflare.StaticSite` instead."
2784
+ ].join("\n")
2785
+ );
2786
+ }
2787
+ if (!await existsAsync(assetsPath)) {
2788
+ throw new VisibleError(
2789
+ `React Router assets directory not found at:
2790
+ "${assetsPath}".`
2791
+ );
2792
+ }
2793
+ return {
2794
+ server: "./build/server/index.js",
2795
+ assets: "./build/client"
2796
+ };
2797
+ });
2798
+ }
2799
+ buildWrangler(sitePath) {
2800
+ return {
2801
+ main: path9.resolve(sitePath, "workers/app.ts")
2802
+ };
2803
+ }
2804
+ /**
2805
+ * The URL of the React Router app.
2806
+ *
2807
+ * If the `domain` is set, this is the URL with the custom domain.
2808
+ * Otherwise, it's the auto-generated Worker URL.
2809
+ */
2810
+ get url() {
2811
+ return super.url;
2812
+ }
2813
+ };
2814
+ var __pulumiType15 = "sst:cloudflare:ReactRouter";
2815
+ ReactRouter.__pulumiType = __pulumiType15;
2816
+
2817
+ // platform/src/components/cloudflare/tan-stack-start.ts
2818
+ import fs10 from "fs/promises";
2819
+ import path10 from "path";
2820
+ var TanStackStart = class extends SsrSite {
2821
+ constructor(name, args = {}, opts = {}) {
2822
+ super(__pulumiType16, name, args, opts);
2823
+ }
2824
+ validate(sitePath) {
2825
+ validateFrameworkConfig({
2826
+ sitePath,
2827
+ configName: "vite.config",
2828
+ componentName: "TanStackStart"
2829
+ });
2830
+ validateNoWranglerFile(sitePath, "TanStackStart");
2831
+ }
2832
+ buildPlan(outputPath) {
2833
+ return outputPath.apply(async (outputPath2) => {
2834
+ const distPlan = await resolveDistPlan();
2835
+ if (distPlan) return distPlan;
2836
+ const legacyPlan = await resolveLegacyPlan();
2837
+ if (legacyPlan) return legacyPlan;
2838
+ throw new VisibleError(
2839
+ [
2840
+ `TanStack Start build output not found in "${path10.resolve(outputPath2)}".`,
2841
+ "",
2842
+ "Expected one of:",
2843
+ " - dist/server/wrangler.json and dist/client",
2844
+ " - dist/server/index.js and dist/client",
2845
+ " - .output/server/index.mjs and .output/public",
2846
+ "",
2847
+ "Use the Cloudflare deployment adapter in TanStack Start, or if your project is entirely pre-rendered, use `sst.cloudflare.StaticSite` instead."
2848
+ ].join("\n")
2849
+ );
2850
+ async function resolveDistPlan() {
2851
+ const wranglerPath = path10.join(
2852
+ outputPath2,
2853
+ "dist",
2854
+ "server",
2855
+ "wrangler.json"
2856
+ );
2857
+ if (await existsAsync(wranglerPath)) {
2858
+ const wrangler = JSON.parse(await fs10.readFile(wranglerPath, "utf-8"));
2859
+ if (!wrangler.main) {
2860
+ throw new VisibleError(
2861
+ `TanStack Start build output at "${path10.resolve(wranglerPath)}" is missing the Worker entry in \`main\`.`
2862
+ );
2863
+ }
2864
+ const serverPath = path10.resolve(outputPath2, "dist", "server", wrangler.main);
2865
+ const assetsPath = path10.resolve(
2866
+ outputPath2,
2867
+ "dist",
2868
+ "server",
2869
+ wrangler.assets?.directory ?? "../client"
2870
+ );
2871
+ if (!await existsAsync(serverPath)) {
2872
+ throw new VisibleError(
2873
+ `TanStack Start server bundle not found at:
2874
+ "${serverPath}".`
2875
+ );
2876
+ }
2877
+ if (!await existsAsync(assetsPath)) {
2878
+ throw new VisibleError(
2879
+ `TanStack Start assets directory not found at:
2880
+ "${assetsPath}".`
2881
+ );
2882
+ }
2883
+ return {
2884
+ server: toPlanPath(serverPath),
2885
+ assets: toPlanPath(assetsPath)
2886
+ };
2887
+ }
2888
+ for (const serverFile of ["index.js", "index.mjs"]) {
2889
+ const serverPath = path10.join(
2890
+ outputPath2,
2891
+ "dist",
2892
+ "server",
2893
+ serverFile
2894
+ );
2895
+ const assetsPath = path10.join(outputPath2, "dist", "client");
2896
+ if (await existsAsync(serverPath) && await existsAsync(assetsPath)) {
2897
+ return {
2898
+ server: toPlanPath(serverPath),
2899
+ assets: toPlanPath(assetsPath)
2900
+ };
2901
+ }
2902
+ }
2903
+ }
2904
+ async function resolveLegacyPlan() {
2905
+ const serverPath = path10.join(
2906
+ outputPath2,
2907
+ ".output",
2908
+ "server",
2909
+ "index.mjs"
2910
+ );
2911
+ const assetsPath = path10.join(outputPath2, ".output", "public");
2912
+ if (!await existsAsync(serverPath)) return;
2913
+ if (!await existsAsync(assetsPath)) {
2914
+ throw new VisibleError(
2915
+ `TanStack Start assets directory not found at:
2916
+ "${path10.resolve(
2917
+ assetsPath
2918
+ )}".`
2919
+ );
2920
+ }
2921
+ return {
2922
+ server: toPlanPath(serverPath),
2923
+ assets: toPlanPath(assetsPath)
2924
+ };
2925
+ }
2926
+ function toPlanPath(filePath) {
2927
+ const relativePath = path10.relative(outputPath2, filePath);
2928
+ return `./${relativePath.split(path10.sep).join("/")}`;
2929
+ }
2930
+ });
2931
+ }
2932
+ buildWrangler() {
2933
+ return {
2934
+ main: "@tanstack/react-start/server-entry"
2935
+ };
2936
+ }
2937
+ /**
2938
+ * The URL of the TanStack Start app.
2939
+ *
2940
+ * If the `domain` is set, this is the URL with the custom domain.
2941
+ * Otherwise, it's the auto-generated Worker URL.
2942
+ */
2943
+ get url() {
2944
+ return super.url;
2945
+ }
2946
+ };
2947
+ var __pulumiType16 = "sst:cloudflare:TanStackStart";
2948
+ TanStackStart.__pulumiType = __pulumiType16;
2949
+
2950
+ // platform/src/components/cloudflare/workflow.ts
2951
+ import * as cf2 from "@pulumi/cloudflare";
2952
+ var Workflow2 = class extends Component {
2953
+ worker;
2954
+ workflow;
2955
+ constructor(name, args, opts) {
2956
+ super(__pulumiType17, name, args, opts);
2957
+ const parent = this;
2958
+ const worker = createWorker();
2959
+ const workflow = createWorkflow();
2960
+ this.worker = worker;
2961
+ this.workflow = workflow;
2962
+ function createWorker() {
2963
+ return new Worker(
2964
+ ...transform(
2965
+ args.transform?.worker,
2966
+ `${name}Script`,
2967
+ {
2968
+ handler: args.handler,
2969
+ link: args.link,
2970
+ environment: args.environment
2971
+ },
2972
+ { parent }
2973
+ )
2974
+ );
2975
+ }
2976
+ function createWorkflow() {
2977
+ return new cf2.Workflow(
2978
+ ...transform(
2979
+ args.transform?.workflow,
2980
+ `${name}Workflow`,
2981
+ {
2982
+ accountId: args.accountId ?? DEFAULT_ACCOUNT_ID,
2983
+ workflowName: "",
2984
+ className: args.className,
2985
+ scriptName: worker.nodes.worker.scriptName
2986
+ },
2987
+ { parent }
2988
+ )
2989
+ );
2990
+ }
2991
+ }
2992
+ /**
2993
+ * The name of the Cloudflare Workflow.
2994
+ */
2995
+ get workflowName() {
2996
+ return this.workflow.workflowName;
2997
+ }
2998
+ /**
2999
+ * The name of the workflow class.
3000
+ */
3001
+ get className() {
3002
+ return this.workflow.className;
3003
+ }
3004
+ /**
3005
+ * The name of the Worker script that hosts the workflow class.
3006
+ */
3007
+ get scriptName() {
3008
+ return this.workflow.scriptName;
3009
+ }
3010
+ /**
3011
+ * The underlying [resources](/docs/components/#nodes) this component creates.
3012
+ */
3013
+ get nodes() {
3014
+ return {
3015
+ /**
3016
+ * The Cloudflare Worker that hosts the workflow class.
3017
+ */
3018
+ worker: this.worker,
3019
+ /**
3020
+ * The Cloudflare Workflow resource.
3021
+ */
3022
+ workflow: this.workflow
3023
+ };
3024
+ }
3025
+ /**
3026
+ * When you link a workflow to a worker, it automatically creates a
3027
+ * [Workflow binding](https://developers.cloudflare.com/workflows/build/workers-api/#call-workflows-from-workers)
3028
+ * on the worker. This lets you trigger, inspect, and manage workflow instances
3029
+ * from your worker code.
3030
+ *
3031
+ * @example
3032
+ * ```ts title="src/api.ts"
3033
+ * import { Resource } from "sst";
3034
+ *
3035
+ * const instance = await Resource.MyWorkflow.create({ params: { hello: "world" } });
3036
+ * ```
3037
+ *
3038
+ * @internal
3039
+ */
3040
+ getSSTLink() {
3041
+ return {
3042
+ properties: {
3043
+ workflowName: this.workflow.workflowName,
3044
+ className: this.workflow.className,
3045
+ scriptName: this.workflow.scriptName
3046
+ },
3047
+ include: [
3048
+ binding({
3049
+ type: "workflowBindings",
3050
+ properties: {
3051
+ workflowName: this.workflow.workflowName,
3052
+ className: this.workflow.className,
3053
+ scriptName: this.workflow.scriptName
3054
+ }
3055
+ })
3056
+ ]
3057
+ };
3058
+ }
3059
+ };
3060
+ var __pulumiType17 = "sst:cloudflare:Workflow";
3061
+ Workflow2.__pulumiType = __pulumiType17;
3062
+
3063
+ // platform/src/components/cloudflare/rate-limit.ts
3064
+ import {
3065
+ output as output12
3066
+ } from "@pulumi/pulumi";
3067
+ var RateLimit = class extends Component {
3068
+ _namespaceId;
3069
+ _limit;
3070
+ _period;
3071
+ constructor(name, args, opts) {
3072
+ super(__pulumiType18, name, args, opts);
3073
+ const namespaceId = normalizeNamespaceId();
3074
+ const limit = output12(args.limit);
3075
+ const period = normalizePeriod();
3076
+ this._namespaceId = namespaceId;
3077
+ this._limit = limit;
3078
+ this._period = period;
3079
+ function normalizeNamespaceId() {
3080
+ return output12(args.namespaceId).apply((namespaceId2) => {
3081
+ if (!Number.isInteger(namespaceId2) || namespaceId2 <= 0) {
3082
+ throw new VisibleError(
3083
+ "The `namespaceId` property must be a positive integer."
3084
+ );
3085
+ }
3086
+ return namespaceId2.toString();
3087
+ });
3088
+ }
3089
+ function normalizePeriod() {
3090
+ return output12(args.period).apply(toSeconds);
3091
+ }
3092
+ }
3093
+ /**
3094
+ * A unique identifier for the rate limit namespace.
3095
+ */
3096
+ get namespaceId() {
3097
+ return this._namespaceId;
3098
+ }
3099
+ /**
3100
+ * The number of allowed requests within the specified period of time.
3101
+ */
3102
+ get limit() {
3103
+ return this._limit;
3104
+ }
3105
+ /**
3106
+ * The duration of the rate limit window, in seconds.
3107
+ */
3108
+ get period() {
3109
+ return this._period;
3110
+ }
3111
+ /**
3112
+ * When you link a RateLimit binding, it will be available to the worker and you can
3113
+ * interact with it using its [API methods](https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/).
3114
+ *
3115
+ * @example
3116
+ * ```ts title="index.ts"
3117
+ * import { Resource } from "sst/resource";
3118
+ *
3119
+ * export default {
3120
+ * async fetch(req, env): Promise<Response> {
3121
+ * const url = new URL(req.url);
3122
+ *
3123
+ * const outcome = await Resource.MyRateLimit.limit({ key: url.pathname });
3124
+ * if (!outcome.success) {
3125
+ * return new Response(`Rate limit exceeded for ${url.pathname}`, { status: 429 });
3126
+ * }
3127
+ *
3128
+ * return new Response("OK", { status: 200 });
3129
+ * }
3130
+ * }
3131
+ * ```
3132
+ *
3133
+ * @internal
3134
+ */
3135
+ getSSTLink() {
3136
+ return {
3137
+ properties: {},
3138
+ include: [
3139
+ binding({
3140
+ type: "rateLimitBindings",
3141
+ properties: {
3142
+ namespaceId: this._namespaceId,
3143
+ simple: {
3144
+ limit: this._limit,
3145
+ period: this._period
3146
+ }
3147
+ }
3148
+ })
3149
+ ]
3150
+ };
3151
+ }
3152
+ };
3153
+ var __pulumiType18 = "sst:cloudflare:RateLimit";
3154
+ RateLimit.__pulumiType = __pulumiType18;
3155
+
3156
+ // platform/src/components/cloudflare/experimental/index.ts
3157
+ var experimental_exports = {};
3158
+ __export(experimental_exports, {
3159
+ Astro: () => Astro,
3160
+ SolidStart: () => SolidStart,
3161
+ StaticSite: () => StaticSiteV2
3162
+ });
3163
+
3164
+ // platform/src/components/cloudflare/experimental/solid-start.ts
3165
+ import fs11 from "fs/promises";
3166
+ import path11 from "path";
3167
+ var SolidStart = class extends SsrSite {
3168
+ constructor(name, args = {}, opts = {}) {
3169
+ super(__pulumiType19, name, args, opts);
3170
+ }
3171
+ buildPlan(outputPath) {
3172
+ return outputPath.apply(async (outputPath2) => {
3173
+ const nitro = JSON.parse(
3174
+ await fs11.readFile(
3175
+ path11.join(outputPath2, ".output", "nitro.json"),
3176
+ "utf-8"
3177
+ )
3178
+ );
3179
+ if (!["cloudflare-module"].includes(nitro.preset)) {
3180
+ throw new VisibleError(
3181
+ `SolidStart's nitro.config.ts must be configured to use the "cloudflare-module" preset. It is currently set to "${nitro.preset}".`
3182
+ );
3183
+ }
3184
+ if (!await existsAsync(
3185
+ path11.join(outputPath2, ".output", "server", "index.mjs")
3186
+ )) {
3187
+ throw new VisibleError(
3188
+ `SSR server bundle "index.mjs" not found in the build output at:
3189
+ "${path11.resolve(outputPath2, ".output", "server")}".
3190
+
3191
+ If your SolidStart project is entirely pre-rendered, use the \`sst.cloudflare.StaticSite\` component instead of \`sst.cloudflare.SolidStart\`.`
3192
+ );
3193
+ }
3194
+ const ignorePath = path11.join(outputPath2, ".output", ".assetsignore");
3195
+ const ignorePatterns = await existsAsync(ignorePath) ? (await fs11.readFile(ignorePath, "utf-8")).split("\n") : [];
3196
+ let dirty = false;
3197
+ ["server"].forEach((pattern) => {
3198
+ if (ignorePatterns.includes(pattern)) return;
3199
+ ignorePatterns.push(pattern);
3200
+ dirty = true;
3201
+ });
3202
+ if (dirty) {
3203
+ await fs11.appendFile(ignorePath, "\nserver");
3204
+ }
3205
+ return {
3206
+ server: "./.output/server/index.mjs",
3207
+ assets: "./.output/public"
3208
+ };
3209
+ });
3210
+ }
3211
+ /**
3212
+ * The URL of the SolidStart app.
3213
+ *
3214
+ * If the `domain` is set, this is the URL with the custom domain.
3215
+ * Otherwise, it's the auto-generated Worker URL.
3216
+ */
3217
+ get url() {
3218
+ return super.url;
3219
+ }
3220
+ };
3221
+ var __pulumiType19 = "sst:cloudflare:SolidStart";
3222
+ SolidStart.__pulumiType = __pulumiType19;
3223
+ export {
3224
+ Ai,
3225
+ Astro,
3226
+ Auth,
3227
+ Bucket,
3228
+ Cron,
3229
+ D1,
3230
+ DEFAULT_ACCOUNT_ID,
3231
+ DurableObject,
3232
+ Hyperdrive,
3233
+ Kv,
3234
+ Queue2 as Queue,
3235
+ RateLimit,
3236
+ ReactRouter,
3237
+ StaticSite,
3238
+ StaticSiteV2,
3239
+ TanStackStart,
3240
+ Worker,
3241
+ Workflow2 as Workflow,
3242
+ binding,
3243
+ dns,
3244
+ experimental_exports as x
3245
+ };
3246
+ //# sourceMappingURL=index.js.map