alchemy 0.12.21 → 0.14.0

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 (319) hide show
  1. package/lib/ai/client.d.ts.map +1 -1
  2. package/lib/ai/client.js +3 -5
  3. package/lib/ai/client.js.map +1 -1
  4. package/lib/alchemy.d.ts +2 -1
  5. package/lib/alchemy.d.ts.map +1 -1
  6. package/lib/alchemy.js +87 -92
  7. package/lib/alchemy.js.map +1 -1
  8. package/lib/apply.d.ts.map +1 -1
  9. package/lib/apply.js +6 -1
  10. package/lib/apply.js.map +1 -1
  11. package/lib/aws/bucket.d.ts.map +1 -1
  12. package/lib/aws/bucket.js +55 -57
  13. package/lib/aws/bucket.js.map +1 -1
  14. package/lib/aws/function.d.ts.map +1 -1
  15. package/lib/aws/function.js +250 -252
  16. package/lib/aws/function.js.map +1 -1
  17. package/lib/aws/policy-attachment.d.ts.map +1 -1
  18. package/lib/aws/policy-attachment.js +4 -6
  19. package/lib/aws/policy-attachment.js.map +1 -1
  20. package/lib/aws/policy.d.ts.map +1 -1
  21. package/lib/aws/policy.js +63 -65
  22. package/lib/aws/policy.js.map +1 -1
  23. package/lib/aws/queue.js +88 -90
  24. package/lib/aws/queue.js.map +1 -1
  25. package/lib/aws/table.d.ts.map +1 -1
  26. package/lib/aws/table.js +95 -99
  27. package/lib/aws/table.js.map +1 -1
  28. package/lib/cloudflare/account-api-token.d.ts +1 -1
  29. package/lib/cloudflare/account-api-token.d.ts.map +1 -1
  30. package/lib/cloudflare/account-api-token.js +0 -1
  31. package/lib/cloudflare/account-api-token.js.map +1 -1
  32. package/lib/cloudflare/ai-gateway.js.map +1 -1
  33. package/lib/cloudflare/ai.d.ts +1 -1
  34. package/lib/cloudflare/ai.d.ts.map +1 -1
  35. package/lib/cloudflare/ai.js.map +1 -1
  36. package/lib/cloudflare/api.d.ts +5 -5
  37. package/lib/cloudflare/api.d.ts.map +1 -1
  38. package/lib/cloudflare/api.js +52 -15
  39. package/lib/cloudflare/api.js.map +1 -1
  40. package/lib/cloudflare/auth.d.ts +24 -55
  41. package/lib/cloudflare/auth.d.ts.map +1 -1
  42. package/lib/cloudflare/auth.js +15 -72
  43. package/lib/cloudflare/auth.js.map +1 -1
  44. package/lib/cloudflare/bucket.d.ts +2 -2
  45. package/lib/cloudflare/bucket.d.ts.map +1 -1
  46. package/lib/cloudflare/bucket.js +22 -24
  47. package/lib/cloudflare/bucket.js.map +1 -1
  48. package/lib/cloudflare/bundle/alias-plugin.d.ts +6 -0
  49. package/lib/cloudflare/bundle/alias-plugin.d.ts.map +1 -0
  50. package/lib/cloudflare/bundle/alias-plugin.js +36 -0
  51. package/lib/cloudflare/bundle/alias-plugin.js.map +1 -0
  52. package/lib/cloudflare/bundle/build-failures.d.ts +12 -0
  53. package/lib/cloudflare/bundle/build-failures.d.ts.map +1 -0
  54. package/lib/cloudflare/bundle/build-failures.js +45 -0
  55. package/lib/cloudflare/bundle/build-failures.js.map +1 -0
  56. package/lib/cloudflare/bundle/bundle-worker.d.ts +7 -0
  57. package/lib/cloudflare/bundle/bundle-worker.d.ts.map +1 -0
  58. package/lib/cloudflare/bundle/bundle-worker.js +69 -0
  59. package/lib/cloudflare/bundle/bundle-worker.js.map +1 -0
  60. package/lib/cloudflare/bundle/external.d.ts +1 -0
  61. package/lib/cloudflare/bundle/external.d.ts.map +1 -1
  62. package/lib/cloudflare/bundle/external.js +8 -1
  63. package/lib/cloudflare/bundle/external.js.map +1 -1
  64. package/lib/cloudflare/bundle/local-dev-cloudflare-shim.d.ts +1 -1
  65. package/lib/cloudflare/bundle/local-dev-cloudflare-shim.d.ts.map +1 -1
  66. package/lib/cloudflare/bundle/local-dev-cloudflare-shim.js +6 -6
  67. package/lib/cloudflare/bundle/local-dev-cloudflare-shim.js.map +1 -1
  68. package/lib/cloudflare/bundle/nodejs-compat-mode.d.ts +17 -0
  69. package/lib/cloudflare/bundle/nodejs-compat-mode.d.ts.map +1 -0
  70. package/lib/cloudflare/bundle/nodejs-compat-mode.js +27 -0
  71. package/lib/cloudflare/bundle/nodejs-compat-mode.js.map +1 -0
  72. package/lib/cloudflare/bundle/{hybrid-nodejs-compat.d.ts → nodejs-compat.d.ts} +2 -2
  73. package/lib/cloudflare/bundle/nodejs-compat.d.ts.map +1 -0
  74. package/lib/cloudflare/bundle/{hybrid-nodejs-compat.js → nodejs-compat.js} +2 -2
  75. package/lib/cloudflare/bundle/nodejs-compat.js.map +1 -0
  76. package/lib/cloudflare/custom-domain.d.ts.map +1 -1
  77. package/lib/cloudflare/custom-domain.js +3 -5
  78. package/lib/cloudflare/custom-domain.js.map +1 -1
  79. package/lib/cloudflare/d1-database.d.ts +1 -1
  80. package/lib/cloudflare/d1-database.d.ts.map +1 -1
  81. package/lib/cloudflare/d1-database.js +70 -72
  82. package/lib/cloudflare/d1-database.js.map +1 -1
  83. package/lib/cloudflare/d1-migrations.d.ts +1 -1
  84. package/lib/cloudflare/d1-migrations.d.ts.map +1 -1
  85. package/lib/cloudflare/d1-migrations.js +2 -3
  86. package/lib/cloudflare/d1-migrations.js.map +1 -1
  87. package/lib/cloudflare/dns-records.d.ts.map +1 -1
  88. package/lib/cloudflare/dns-records.js +2 -4
  89. package/lib/cloudflare/dns-records.js.map +1 -1
  90. package/lib/cloudflare/kv-namespace.d.ts +1 -1
  91. package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
  92. package/lib/cloudflare/kv-namespace.js +24 -27
  93. package/lib/cloudflare/kv-namespace.js.map +1 -1
  94. package/lib/cloudflare/pipeline.d.ts +1 -1
  95. package/lib/cloudflare/pipeline.d.ts.map +1 -1
  96. package/lib/cloudflare/pipeline.js +32 -34
  97. package/lib/cloudflare/pipeline.js.map +1 -1
  98. package/lib/cloudflare/queue-consumer.d.ts +1 -1
  99. package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
  100. package/lib/cloudflare/queue-consumer.js +27 -33
  101. package/lib/cloudflare/queue-consumer.js.map +1 -1
  102. package/lib/cloudflare/queue.d.ts +1 -1
  103. package/lib/cloudflare/queue.d.ts.map +1 -1
  104. package/lib/cloudflare/queue.js +36 -38
  105. package/lib/cloudflare/queue.js.map +1 -1
  106. package/lib/cloudflare/r2-rest-state-store.js +4 -8
  107. package/lib/cloudflare/r2-rest-state-store.js.map +1 -1
  108. package/lib/cloudflare/types.d.ts.map +1 -1
  109. package/lib/cloudflare/types.js +1 -3
  110. package/lib/cloudflare/types.js.map +1 -1
  111. package/lib/cloudflare/user.d.ts +51 -0
  112. package/lib/cloudflare/user.d.ts.map +1 -0
  113. package/lib/cloudflare/user.js +62 -0
  114. package/lib/cloudflare/user.js.map +1 -0
  115. package/lib/cloudflare/vectorize-index.d.ts.map +1 -1
  116. package/lib/cloudflare/vectorize-index.js +37 -39
  117. package/lib/cloudflare/vectorize-index.js.map +1 -1
  118. package/lib/cloudflare/vectorize-metadata-index.d.ts +1 -1
  119. package/lib/cloudflare/vectorize-metadata-index.d.ts.map +1 -1
  120. package/lib/cloudflare/vectorize-metadata-index.js +10 -13
  121. package/lib/cloudflare/vectorize-metadata-index.js.map +1 -1
  122. package/lib/cloudflare/worker.d.ts +18 -3
  123. package/lib/cloudflare/worker.d.ts.map +1 -1
  124. package/lib/cloudflare/worker.js +11 -54
  125. package/lib/cloudflare/worker.js.map +1 -1
  126. package/lib/cloudflare/workflow.d.ts +1 -1
  127. package/lib/cloudflare/workflow.d.ts.map +1 -1
  128. package/lib/cloudflare/workflow.js.map +1 -1
  129. package/lib/cloudflare/zone.d.ts.map +1 -1
  130. package/lib/cloudflare/zone.js +48 -50
  131. package/lib/cloudflare/zone.js.map +1 -1
  132. package/lib/dns/godaddy.js +1 -1
  133. package/lib/dns/import-dns.js +1 -1
  134. package/lib/dns/import-dns.js.map +1 -1
  135. package/lib/env.js +7 -9
  136. package/lib/env.js.map +1 -1
  137. package/lib/esbuild/bundle.d.ts.map +1 -1
  138. package/lib/esbuild/bundle.js +8 -11
  139. package/lib/esbuild/bundle.js.map +1 -1
  140. package/lib/fs/copy-file.d.ts.map +1 -1
  141. package/lib/fs/copy-file.js +27 -29
  142. package/lib/fs/copy-file.js.map +1 -1
  143. package/lib/fs/file.d.ts +1 -1
  144. package/lib/fs/file.d.ts.map +1 -1
  145. package/lib/fs/file.js +1 -1
  146. package/lib/fs/file.js.map +1 -1
  147. package/lib/fs/folder.d.ts.map +1 -1
  148. package/lib/fs/folder.js +1 -3
  149. package/lib/fs/folder.js.map +1 -1
  150. package/lib/github/client.d.ts.map +1 -1
  151. package/lib/github/client.js +3 -5
  152. package/lib/github/client.js.map +1 -1
  153. package/lib/github/repository-environment.d.ts.map +1 -1
  154. package/lib/github/repository-environment.js +173 -176
  155. package/lib/github/repository-environment.js.map +1 -1
  156. package/lib/github/secret.d.ts.map +1 -1
  157. package/lib/github/secret.js +97 -99
  158. package/lib/github/secret.js.map +1 -1
  159. package/lib/internal/docs/providers.d.ts.map +1 -1
  160. package/lib/internal/docs/providers.js +5 -7
  161. package/lib/internal/docs/providers.js.map +1 -1
  162. package/lib/neon/api.js +1 -2
  163. package/lib/neon/api.js.map +1 -1
  164. package/lib/neon/project.js +2 -2
  165. package/lib/neon/project.js.map +1 -1
  166. package/lib/os/exec.d.ts +5 -0
  167. package/lib/os/exec.d.ts.map +1 -1
  168. package/lib/os/exec.js +88 -56
  169. package/lib/os/exec.js.map +1 -1
  170. package/lib/scope.d.ts +3 -0
  171. package/lib/scope.d.ts.map +1 -1
  172. package/lib/scope.js +10 -3
  173. package/lib/scope.js.map +1 -1
  174. package/lib/secret.d.ts.map +1 -1
  175. package/lib/secret.js +1 -3
  176. package/lib/secret.js.map +1 -1
  177. package/lib/serde.d.ts.map +1 -1
  178. package/lib/serde.js +13 -15
  179. package/lib/serde.js.map +1 -1
  180. package/lib/stripe/price.d.ts.map +1 -1
  181. package/lib/stripe/price.js +69 -73
  182. package/lib/stripe/price.js.map +1 -1
  183. package/lib/stripe/product.d.ts.map +1 -1
  184. package/lib/stripe/product.js +50 -52
  185. package/lib/stripe/product.js.map +1 -1
  186. package/lib/stripe/webhook.d.ts.map +1 -1
  187. package/lib/stripe/webhook.js +51 -53
  188. package/lib/stripe/webhook.js.map +1 -1
  189. package/lib/test/bun.d.ts +1 -1
  190. package/lib/test/bun.d.ts.map +1 -1
  191. package/lib/test/bun.js +3 -8
  192. package/lib/test/bun.js.map +1 -1
  193. package/lib/test/prune.d.ts.map +1 -1
  194. package/lib/test/prune.js.map +1 -1
  195. package/lib/util/dedent.js +4 -4
  196. package/lib/util/dedent.js.map +1 -1
  197. package/lib/web/astro.js +1 -1
  198. package/lib/web/shadcn.js +4 -4
  199. package/lib/web/shadcn.js.map +1 -1
  200. package/lib/web/tailwind.d.ts.map +1 -1
  201. package/lib/web/tailwind.js +0 -1
  202. package/lib/web/tailwind.js.map +1 -1
  203. package/lib/web/vite.js +3 -3
  204. package/lib/web/vitepress/home-page.d.ts.map +1 -1
  205. package/lib/web/vitepress/home-page.js +6 -8
  206. package/lib/web/vitepress/home-page.js.map +1 -1
  207. package/lib/web/vitepress/process-front-matter-files.js +1 -1
  208. package/lib/web/vitepress/process-front-matter-files.js.map +1 -1
  209. package/lib/web/vitepress/vitepress.js +2 -2
  210. package/lib/web/vitepress/vitepress.js.map +1 -1
  211. package/package.json +4 -1
  212. package/src/ai/astro-file.ts +4 -4
  213. package/src/ai/client.ts +4 -5
  214. package/src/ai/css-file.ts +4 -4
  215. package/src/ai/document.ts +3 -3
  216. package/src/ai/html-file.ts +4 -4
  217. package/src/ai/json-file.ts +1 -1
  218. package/src/ai/typescript-file.ts +4 -4
  219. package/src/ai/vue-file.ts +4 -4
  220. package/src/ai/yaml-file.ts +1 -1
  221. package/src/alchemy.ts +111 -104
  222. package/src/apply.ts +13 -6
  223. package/src/aws/bucket.ts +72 -75
  224. package/src/aws/function.ts +296 -297
  225. package/src/aws/oidc/github-oidc-provider.ts +1 -1
  226. package/src/aws/oidc/oidc-provider.ts +15 -15
  227. package/src/aws/policy-attachment.ts +10 -11
  228. package/src/aws/policy.ts +91 -94
  229. package/src/aws/queue.ts +111 -111
  230. package/src/aws/role.ts +24 -24
  231. package/src/aws/ses.ts +17 -17
  232. package/src/aws/table.ts +114 -115
  233. package/src/cloudflare/account-api-token.ts +11 -11
  234. package/src/cloudflare/ai-gateway.ts +4 -4
  235. package/src/cloudflare/ai.ts +1 -1
  236. package/src/cloudflare/api-error.ts +1 -1
  237. package/src/cloudflare/api.ts +70 -25
  238. package/src/cloudflare/assets.ts +4 -4
  239. package/src/cloudflare/auth.ts +49 -164
  240. package/src/cloudflare/bucket.ts +62 -63
  241. package/src/cloudflare/bundle/alias-plugin.ts +48 -0
  242. package/src/cloudflare/bundle/build-failures.ts +55 -0
  243. package/src/cloudflare/bundle/bundle-worker.ts +89 -0
  244. package/src/cloudflare/bundle/external.ts +9 -1
  245. package/src/cloudflare/bundle/local-dev-cloudflare-shim.ts +7 -6
  246. package/src/cloudflare/bundle/nodejs-compat-mode.ts +49 -0
  247. package/src/cloudflare/bundle/{hybrid-nodejs-compat.ts → nodejs-compat.ts} +10 -10
  248. package/src/cloudflare/custom-domain.ts +27 -28
  249. package/src/cloudflare/d1-database.ts +101 -102
  250. package/src/cloudflare/d1-migrations.ts +10 -10
  251. package/src/cloudflare/dns-records.ts +23 -24
  252. package/src/cloudflare/durable-object-namespace.ts +1 -1
  253. package/src/cloudflare/event-source.ts +1 -1
  254. package/src/cloudflare/hyperdrive.ts +3 -3
  255. package/src/cloudflare/kv-namespace.ts +36 -37
  256. package/src/cloudflare/nuxt.ts +1 -1
  257. package/src/cloudflare/permission-groups.ts +7 -7
  258. package/src/cloudflare/pipeline.ts +55 -56
  259. package/src/cloudflare/queue-consumer.ts +46 -53
  260. package/src/cloudflare/queue.ts +56 -57
  261. package/src/cloudflare/r2-rest-state-store.ts +11 -11
  262. package/src/cloudflare/redwood.ts +1 -1
  263. package/src/cloudflare/tanstack-start.ts +1 -1
  264. package/src/cloudflare/types.ts +1 -2
  265. package/src/cloudflare/user.ts +142 -0
  266. package/src/cloudflare/vectorize-index.ts +60 -61
  267. package/src/cloudflare/vectorize-metadata-index.ts +25 -25
  268. package/src/cloudflare/vite.ts +1 -1
  269. package/src/cloudflare/website.ts +3 -3
  270. package/src/cloudflare/worker.ts +83 -108
  271. package/src/cloudflare/workflow.ts +4 -4
  272. package/src/cloudflare/wrangler.json.ts +4 -4
  273. package/src/cloudflare/zone.ts +69 -70
  274. package/src/destroy.ts +4 -4
  275. package/src/dns/godaddy.ts +1 -1
  276. package/src/dns/import-dns.ts +5 -5
  277. package/src/encrypt.ts +6 -6
  278. package/src/env.ts +10 -10
  279. package/src/esbuild/bundle.ts +14 -15
  280. package/src/fs/copy-file.ts +35 -36
  281. package/src/fs/file-system-state-store.ts +4 -4
  282. package/src/fs/file.ts +9 -8
  283. package/src/fs/folder.ts +6 -7
  284. package/src/github/client.ts +15 -14
  285. package/src/github/repository-environment.ts +206 -210
  286. package/src/github/secret.ts +111 -116
  287. package/src/internal/docs/providers.ts +16 -17
  288. package/src/neon/api-error.ts +1 -1
  289. package/src/neon/api.ts +6 -6
  290. package/src/neon/project.ts +18 -17
  291. package/src/os/exec.ts +107 -66
  292. package/src/resource.ts +3 -3
  293. package/src/scope.ts +14 -4
  294. package/src/secret.ts +2 -3
  295. package/src/serde.ts +30 -22
  296. package/src/stripe/price.ts +74 -77
  297. package/src/stripe/product.ts +55 -56
  298. package/src/stripe/webhook.ts +56 -57
  299. package/src/test/bun.ts +9 -13
  300. package/src/test/prune.ts +4 -4
  301. package/src/util/dedent.ts +4 -4
  302. package/src/web/astro.ts +10 -10
  303. package/src/web/shadcn-component.ts +4 -4
  304. package/src/web/shadcn.ts +10 -10
  305. package/src/web/tailwind.ts +2 -3
  306. package/src/web/vite.ts +11 -11
  307. package/src/web/vitepress/config.ts +2 -2
  308. package/src/web/vitepress/custom-theme.ts +7 -7
  309. package/src/web/vitepress/dependencies.ts +4 -4
  310. package/src/web/vitepress/home-page.ts +8 -9
  311. package/src/web/vitepress/process-front-matter-files.ts +5 -5
  312. package/src/web/vitepress/vitepress.ts +7 -7
  313. package/lib/cloudflare/account-id.d.ts +0 -6
  314. package/lib/cloudflare/account-id.d.ts.map +0 -1
  315. package/lib/cloudflare/account-id.js +0 -6
  316. package/lib/cloudflare/account-id.js.map +0 -1
  317. package/lib/cloudflare/bundle/hybrid-nodejs-compat.d.ts.map +0 -1
  318. package/lib/cloudflare/bundle/hybrid-nodejs-compat.js.map +0 -1
  319. package/src/cloudflare/account-id.ts +0 -12
package/src/aws/role.ts CHANGED
@@ -219,7 +219,7 @@ export const Role = Resource(
219
219
  async function (
220
220
  this: Context<Role>,
221
221
  id: string,
222
- props: RoleProps
222
+ props: RoleProps,
223
223
  ): Promise<Role> {
224
224
  const client = new IAMClient({});
225
225
 
@@ -233,8 +233,8 @@ export const Role = Resource(
233
233
  new DeleteRolePolicyCommand({
234
234
  RoleName: props.roleName,
235
235
  PolicyName: policy.policyName,
236
- })
237
- )
236
+ }),
237
+ ),
238
238
  );
239
239
  }
240
240
  }
@@ -245,7 +245,7 @@ export const Role = Resource(
245
245
  const attachedPoliciesResponse = await client.send(
246
246
  new ListAttachedRolePoliciesCommand({
247
247
  RoleName: props.roleName,
248
- })
248
+ }),
249
249
  );
250
250
 
251
251
  // Detach all managed policies
@@ -257,8 +257,8 @@ export const Role = Resource(
257
257
  new DetachRolePolicyCommand({
258
258
  RoleName: props.roleName,
259
259
  PolicyArn: policy.PolicyArn!,
260
- })
261
- )
260
+ }),
261
+ ),
262
262
  );
263
263
  }
264
264
  } catch (error: any) {
@@ -273,8 +273,8 @@ export const Role = Resource(
273
273
  client.send(
274
274
  new DeleteRoleCommand({
275
275
  RoleName: props.roleName,
276
- })
277
- )
276
+ }),
277
+ ),
278
278
  );
279
279
  } catch (error: any) {
280
280
  // If we get any other error besides NoSuchEntityException, log it but don't fail
@@ -316,7 +316,7 @@ export const Role = Resource(
316
316
  Value: this.id,
317
317
  },
318
318
  ],
319
- })
319
+ }),
320
320
  );
321
321
  }
322
322
  } catch (error: any) {
@@ -328,7 +328,7 @@ export const Role = Resource(
328
328
  const existingRole = await client.send(
329
329
  new GetRoleCommand({
330
330
  RoleName: props.roleName,
331
- })
331
+ }),
332
332
  );
333
333
  const roleTags =
334
334
  existingRole.Role?.Tags?.reduce(
@@ -336,7 +336,7 @@ export const Role = Resource(
336
336
  acc[tag.Key!] = tag.Value!;
337
337
  return acc;
338
338
  },
339
- {} as Record<string, string>
339
+ {} as Record<string, string>,
340
340
  ) || {};
341
341
 
342
342
  if (
@@ -354,7 +354,7 @@ export const Role = Resource(
354
354
  role = await client.send(
355
355
  new GetRoleCommand({
356
356
  RoleName: props.roleName,
357
- })
357
+ }),
358
358
  );
359
359
 
360
360
  // Update assume role policy if it changed
@@ -363,7 +363,7 @@ export const Role = Resource(
363
363
  new UpdateAssumeRolePolicyCommand({
364
364
  RoleName: props.roleName,
365
365
  PolicyDocument: assumeRolePolicyDocument,
366
- })
366
+ }),
367
367
  );
368
368
  }
369
369
 
@@ -377,7 +377,7 @@ export const Role = Resource(
377
377
  RoleName: props.roleName,
378
378
  Description: props.description,
379
379
  MaxSessionDuration: props.maxSessionDuration,
380
- })
380
+ }),
381
381
  );
382
382
  }
383
383
 
@@ -395,7 +395,7 @@ export const Role = Resource(
395
395
  new TagRoleCommand({
396
396
  RoleName: props.roleName,
397
397
  Tags: tags,
398
- })
398
+ }),
399
399
  );
400
400
 
401
401
  // Handle policy changes
@@ -407,7 +407,7 @@ export const Role = Resource(
407
407
  for (const oldPolicy of previousPolicies) {
408
408
  if (
409
409
  !currentPolicies.some(
410
- (p: { policyName: string }) => p.policyName === oldPolicy.policyName
410
+ (p: { policyName: string }) => p.policyName === oldPolicy.policyName,
411
411
  )
412
412
  ) {
413
413
  await ignore(NoSuchEntityException.name, () =>
@@ -415,8 +415,8 @@ export const Role = Resource(
415
415
  new DeleteRolePolicyCommand({
416
416
  RoleName: props.roleName,
417
417
  PolicyName: oldPolicy.policyName,
418
- })
419
- )
418
+ }),
419
+ ),
420
420
  );
421
421
  }
422
422
  }
@@ -424,7 +424,7 @@ export const Role = Resource(
424
424
  // Update or create policies
425
425
  for (const policy of currentPolicies) {
426
426
  const oldPolicy = previousPolicies.find(
427
- (p) => p.policyName === policy.policyName
427
+ (p) => p.policyName === policy.policyName,
428
428
  );
429
429
  if (
430
430
  !oldPolicy ||
@@ -436,7 +436,7 @@ export const Role = Resource(
436
436
  RoleName: props.roleName,
437
437
  PolicyName: policy.policyName,
438
438
  PolicyDocument: JSON.stringify(policy.policyDocument),
439
- })
439
+ }),
440
440
  );
441
441
  }
442
442
  }
@@ -446,7 +446,7 @@ export const Role = Resource(
446
446
  const attachedPoliciesResponse = await client.send(
447
447
  new ListAttachedRolePoliciesCommand({
448
448
  RoleName: props.roleName,
449
- })
449
+ }),
450
450
  );
451
451
 
452
452
  const currentAttachedPolicies =
@@ -464,7 +464,7 @@ export const Role = Resource(
464
464
  new DetachRolePolicyCommand({
465
465
  RoleName: props.roleName,
466
466
  PolicyArn: policyArn,
467
- })
467
+ }),
468
468
  );
469
469
  }
470
470
  }
@@ -476,7 +476,7 @@ export const Role = Resource(
476
476
  new AttachRolePolicyCommand({
477
477
  RoleName: props.roleName,
478
478
  PolicyArn: policyArn,
479
- })
479
+ }),
480
480
  );
481
481
  }
482
482
  }
@@ -493,5 +493,5 @@ export const Role = Resource(
493
493
  roleName: role.Role.RoleName ?? props.roleName,
494
494
  createDate: role.Role.CreateDate!,
495
495
  });
496
- }
496
+ },
497
497
  );
package/src/aws/ses.ts CHANGED
@@ -161,7 +161,7 @@ export const SES = Resource(
161
161
  async function (
162
162
  this: Context<SES>,
163
163
  id: string,
164
- props: SESProps
164
+ props: SESProps,
165
165
  ): Promise<SES> {
166
166
  // Create SES client
167
167
  const client = new SESv2Client({});
@@ -180,8 +180,8 @@ export const SES = Resource(
180
180
  client.send(
181
181
  new DeleteConfigurationSetCommand({
182
182
  ConfigurationSetName: output.configurationSetName,
183
- })
184
- )
183
+ }),
184
+ ),
185
185
  );
186
186
  }
187
187
 
@@ -191,8 +191,8 @@ export const SES = Resource(
191
191
  client.send(
192
192
  new DeleteEmailIdentityCommand({
193
193
  EmailIdentity: output.emailIdentity,
194
- })
195
- )
194
+ }),
195
+ ),
196
196
  );
197
197
  }
198
198
 
@@ -214,7 +214,7 @@ export const SES = Resource(
214
214
  await client.send(
215
215
  new GetConfigurationSetCommand({
216
216
  ConfigurationSetName: props.configurationSetName,
217
- })
217
+ }),
218
218
  );
219
219
  configSetExists = true;
220
220
  } catch (error) {
@@ -232,7 +232,7 @@ export const SES = Resource(
232
232
  new PutConfigurationSetSendingOptionsCommand({
233
233
  ConfigurationSetName: props.configurationSetName,
234
234
  SendingEnabled: props.sendingOptions.SendingEnabled,
235
- })
235
+ }),
236
236
  );
237
237
  }
238
238
 
@@ -242,7 +242,7 @@ export const SES = Resource(
242
242
  ConfigurationSetName: props.configurationSetName,
243
243
  ReputationMetricsEnabled:
244
244
  props.reputationOptions.ReputationMetricsEnabled,
245
- })
245
+ }),
246
246
  );
247
247
  }
248
248
 
@@ -251,7 +251,7 @@ export const SES = Resource(
251
251
  new PutConfigurationSetTrackingOptionsCommand({
252
252
  ConfigurationSetName: props.configurationSetName,
253
253
  CustomRedirectDomain: props.trackingOptions.CustomRedirectDomain,
254
- })
254
+ }),
255
255
  );
256
256
  }
257
257
 
@@ -260,7 +260,7 @@ export const SES = Resource(
260
260
  new PutConfigurationSetSuppressionOptionsCommand({
261
261
  ConfigurationSetName: props.configurationSetName,
262
262
  SuppressedReasons: props.suppressionOptions.SuppressedReasons,
263
- })
263
+ }),
264
264
  );
265
265
  }
266
266
 
@@ -270,7 +270,7 @@ export const SES = Resource(
270
270
  ConfigurationSetName: props.configurationSetName,
271
271
  TlsPolicy: props.deliveryOptions.TlsPolicy,
272
272
  SendingPoolName: props.deliveryOptions.SendingPoolName,
273
- })
273
+ }),
274
274
  );
275
275
  }
276
276
 
@@ -290,7 +290,7 @@ export const SES = Resource(
290
290
  Key,
291
291
  Value,
292
292
  })),
293
- })
293
+ }),
294
294
  );
295
295
 
296
296
  // In SESv2, the ARN isn't directly returned in the response
@@ -306,7 +306,7 @@ export const SES = Resource(
306
306
  getIdentityResult = await client.send(
307
307
  new GetEmailIdentityCommand({
308
308
  EmailIdentity: props.emailIdentity,
309
- })
309
+ }),
310
310
  );
311
311
  } catch (error) {
312
312
  if (error instanceof NotFoundException) {
@@ -325,7 +325,7 @@ export const SES = Resource(
325
325
  Key,
326
326
  Value,
327
327
  })),
328
- })
328
+ }),
329
329
  );
330
330
 
331
331
  // If it's an email address, we don't need to explicitly verify in v2
@@ -350,7 +350,7 @@ export const SES = Resource(
350
350
  new PutEmailIdentityDkimAttributesCommand({
351
351
  EmailIdentity: props.emailIdentity,
352
352
  SigningEnabled: true,
353
- })
353
+ }),
354
354
  );
355
355
 
356
356
  // We can check the current status of DKIM
@@ -360,7 +360,7 @@ export const SES = Resource(
360
360
  const updatedIdentity = await client.send(
361
361
  new GetEmailIdentityCommand({
362
362
  EmailIdentity: props.emailIdentity,
363
- })
363
+ }),
364
364
  );
365
365
 
366
366
  if (updatedIdentity.DkimAttributes?.Status) {
@@ -379,5 +379,5 @@ export const SES = Resource(
379
379
  emailIdentityVerificationStatus,
380
380
  dkimVerificationStatus,
381
381
  });
382
- }
382
+ },
383
383
  );
package/src/aws/table.ts CHANGED
@@ -143,7 +143,7 @@ export const Table = Resource(
143
143
  async function (
144
144
  this: Context<Table>,
145
145
  id: string,
146
- props: TableProps
146
+ props: TableProps,
147
147
  ): Promise<Table> {
148
148
  const client = new DynamoDBClient({});
149
149
 
@@ -154,13 +154,13 @@ export const Table = Resource(
154
154
  client.send(
155
155
  new DeleteTableCommand({
156
156
  TableName: props.tableName,
157
- })
158
- )
157
+ }),
158
+ ),
159
159
  );
160
160
  },
161
161
  isRetryableError,
162
162
  10, // Max attempts
163
- 200 // Initial delay in ms
163
+ 200, // Initial delay in ms
164
164
  );
165
165
 
166
166
  // Wait for table to be deleted
@@ -173,7 +173,7 @@ export const Table = Resource(
173
173
  await client.send(
174
174
  new DescribeTableCommand({
175
175
  TableName: props.tableName,
176
- })
176
+ }),
177
177
  );
178
178
  // If we get here, table still exists
179
179
  retryCount++;
@@ -191,138 +191,137 @@ export const Table = Resource(
191
191
 
192
192
  if (!tableDeleted) {
193
193
  throw new Error(
194
- `Timed out waiting for table ${props.tableName} to be deleted`
194
+ `Timed out waiting for table ${props.tableName} to be deleted`,
195
195
  );
196
196
  }
197
197
 
198
198
  return this.destroy();
199
- } else {
200
- // Setup for table creation
201
- const attributeDefinitions = [
202
- {
203
- AttributeName: props.partitionKey.name,
204
- AttributeType: props.partitionKey.type,
205
- },
206
- ];
207
-
208
- const keySchema: KeySchemaElement[] = [
209
- {
210
- AttributeName: props.partitionKey.name,
211
- KeyType: "HASH",
212
- },
213
- ];
214
-
215
- if (props.sortKey) {
216
- attributeDefinitions.push({
217
- AttributeName: props.sortKey.name,
218
- AttributeType: props.sortKey.type,
219
- });
220
- keySchema.push({
221
- AttributeName: props.sortKey.name,
222
- KeyType: "RANGE",
223
- });
224
- }
225
-
226
- // Attempt to create the table with exponential backoff for ResourceInUseException
227
- await withExponentialBackoff(
228
- async () => {
229
- try {
230
- // First check if table already exists
231
- const describeResponse = await client.send(
232
- new DescribeTableCommand({
233
- TableName: props.tableName,
234
- })
235
- );
199
+ }
200
+ // Setup for table creation
201
+ const attributeDefinitions = [
202
+ {
203
+ AttributeName: props.partitionKey.name,
204
+ AttributeType: props.partitionKey.type,
205
+ },
206
+ ];
236
207
 
237
- // If table exists and is ACTIVE, no need to create it
238
- if (describeResponse.Table?.TableStatus === "ACTIVE") {
239
- return;
240
- }
208
+ const keySchema: KeySchemaElement[] = [
209
+ {
210
+ AttributeName: props.partitionKey.name,
211
+ KeyType: "HASH",
212
+ },
213
+ ];
241
214
 
242
- // If table exists but not ACTIVE, wait for it in the polling loop below
243
- if (describeResponse.Table) {
244
- return;
245
- }
246
- } catch (error) {
247
- if (error instanceof ResourceNotFoundException) {
248
- // Table doesn't exist, try to create it
249
- await client.send(
250
- new CreateTableCommand({
251
- TableName: props.tableName,
252
- AttributeDefinitions: attributeDefinitions,
253
- KeySchema: keySchema,
254
- BillingMode: props.billingMode || "PAY_PER_REQUEST",
255
- ProvisionedThroughput:
256
- props.billingMode === "PROVISIONED"
257
- ? {
258
- ReadCapacityUnits: props.readCapacity || 5,
259
- WriteCapacityUnits: props.writeCapacity || 5,
260
- }
261
- : undefined,
262
- Tags: props.tags
263
- ? Object.entries(props.tags).map(([Key, Value]) => ({
264
- Key,
265
- Value,
266
- }))
267
- : undefined,
268
- })
269
- );
270
- } else {
271
- throw error;
272
- }
273
- }
274
- },
275
- isRetryableError,
276
- 10, // Max attempts
277
- 200 // Initial delay in ms
278
- );
279
-
280
- // Wait for table to be active with timeout
281
- let tableActive = false;
282
- let tableDescription;
283
- let retryCount = 0;
284
- const maxRetries = 60; // Wait up to 60 seconds
215
+ if (props.sortKey) {
216
+ attributeDefinitions.push({
217
+ AttributeName: props.sortKey.name,
218
+ AttributeType: props.sortKey.type,
219
+ });
220
+ keySchema.push({
221
+ AttributeName: props.sortKey.name,
222
+ KeyType: "RANGE",
223
+ });
224
+ }
285
225
 
286
- while (!tableActive && retryCount < maxRetries) {
226
+ // Attempt to create the table with exponential backoff for ResourceInUseException
227
+ await withExponentialBackoff(
228
+ async () => {
287
229
  try {
288
- const response = await client.send(
230
+ // First check if table already exists
231
+ const describeResponse = await client.send(
289
232
  new DescribeTableCommand({
290
233
  TableName: props.tableName,
291
- })
234
+ }),
292
235
  );
293
236
 
294
- tableActive = response.Table?.TableStatus === "ACTIVE";
295
- if (tableActive) {
296
- tableDescription = response.Table;
297
- } else {
298
- retryCount++;
299
- // Increasing delay for each retry with some jitter
300
- const delay = Math.min(1000 * (1 + 0.1 * Math.random()), 5000);
301
- await new Promise((resolve) => setTimeout(resolve, delay));
237
+ // If table exists and is ACTIVE, no need to create it
238
+ if (describeResponse.Table?.TableStatus === "ACTIVE") {
239
+ return;
240
+ }
241
+
242
+ // If table exists but not ACTIVE, wait for it in the polling loop below
243
+ if (describeResponse.Table) {
244
+ return;
302
245
  }
303
246
  } catch (error) {
304
- retryCount++;
305
- if (!(error instanceof ResourceNotFoundException)) {
247
+ if (error instanceof ResourceNotFoundException) {
248
+ // Table doesn't exist, try to create it
249
+ await client.send(
250
+ new CreateTableCommand({
251
+ TableName: props.tableName,
252
+ AttributeDefinitions: attributeDefinitions,
253
+ KeySchema: keySchema,
254
+ BillingMode: props.billingMode || "PAY_PER_REQUEST",
255
+ ProvisionedThroughput:
256
+ props.billingMode === "PROVISIONED"
257
+ ? {
258
+ ReadCapacityUnits: props.readCapacity || 5,
259
+ WriteCapacityUnits: props.writeCapacity || 5,
260
+ }
261
+ : undefined,
262
+ Tags: props.tags
263
+ ? Object.entries(props.tags).map(([Key, Value]) => ({
264
+ Key,
265
+ Value,
266
+ }))
267
+ : undefined,
268
+ }),
269
+ );
270
+ } else {
306
271
  throw error;
307
272
  }
308
- await new Promise((resolve) => setTimeout(resolve, 1000));
309
273
  }
310
- }
274
+ },
275
+ isRetryableError,
276
+ 10, // Max attempts
277
+ 200, // Initial delay in ms
278
+ );
311
279
 
312
- if (!tableActive) {
313
- throw new Error(
314
- `Timed out waiting for table ${props.tableName} to become active`
280
+ // Wait for table to be active with timeout
281
+ let tableActive = false;
282
+ let tableDescription;
283
+ let retryCount = 0;
284
+ const maxRetries = 60; // Wait up to 60 seconds
285
+
286
+ while (!tableActive && retryCount < maxRetries) {
287
+ try {
288
+ const response = await client.send(
289
+ new DescribeTableCommand({
290
+ TableName: props.tableName,
291
+ }),
315
292
  );
293
+
294
+ tableActive = response.Table?.TableStatus === "ACTIVE";
295
+ if (tableActive) {
296
+ tableDescription = response.Table;
297
+ } else {
298
+ retryCount++;
299
+ // Increasing delay for each retry with some jitter
300
+ const delay = Math.min(1000 * (1 + 0.1 * Math.random()), 5000);
301
+ await new Promise((resolve) => setTimeout(resolve, delay));
302
+ }
303
+ } catch (error) {
304
+ retryCount++;
305
+ if (!(error instanceof ResourceNotFoundException)) {
306
+ throw error;
307
+ }
308
+ await new Promise((resolve) => setTimeout(resolve, 1000));
316
309
  }
310
+ }
317
311
 
318
- return this({
319
- ...props,
320
- arn: tableDescription!.TableArn!,
321
- streamArn: tableDescription!.LatestStreamArn,
322
- tableId: tableDescription!.TableId!,
323
- });
312
+ if (!tableActive) {
313
+ throw new Error(
314
+ `Timed out waiting for table ${props.tableName} to become active`,
315
+ );
324
316
  }
325
- }
317
+
318
+ return this({
319
+ ...props,
320
+ arn: tableDescription!.TableArn!,
321
+ streamArn: tableDescription!.LatestStreamArn,
322
+ tableId: tableDescription!.TableId!,
323
+ });
324
+ },
326
325
  );
327
326
 
328
327
  const retryableErrors = [
@@ -1,9 +1,9 @@
1
1
  import { alchemy } from "../alchemy.js";
2
2
  import type { Context } from "../context.js";
3
3
  import { Resource } from "../resource.js";
4
- import { Secret } from "../secret.js";
4
+ import type { Secret } from "../secret.js";
5
5
  import { sha256 } from "../util/sha256.js";
6
- import { createCloudflareApi, type CloudflareApiOptions } from "./api.js";
6
+ import { type CloudflareApiOptions, createCloudflareApi } from "./api.js";
7
7
 
8
8
  /**
9
9
  * Permission group for a token policy
@@ -223,7 +223,7 @@ export const AccountApiToken = Resource(
223
223
  async function (
224
224
  this: Context<AccountApiToken>,
225
225
  id: string,
226
- props: AccountApiTokenProps
226
+ props: AccountApiTokenProps,
227
227
  ): Promise<AccountApiToken> {
228
228
  // Create Cloudflare API client with automatic account discovery
229
229
  const api = await createCloudflareApi(props);
@@ -233,7 +233,7 @@ export const AccountApiToken = Resource(
233
233
  if (this.output?.id) {
234
234
  try {
235
235
  const deleteResponse = await api.delete(
236
- `/accounts/${api.accountId}/tokens/${this.output.id}`
236
+ `/accounts/${api.accountId}/tokens/${this.output.id}`,
237
237
  );
238
238
 
239
239
  if (!deleteResponse.ok && deleteResponse.status !== 404) {
@@ -291,20 +291,20 @@ export const AccountApiToken = Resource(
291
291
  return dateStr.replace(/\.\d{3}Z$/, "Z");
292
292
  }
293
293
 
294
- let response;
295
- let tokenValue;
294
+ let response: Response;
295
+ let tokenValue: Secret | undefined;
296
296
 
297
297
  if (this.phase === "update" && this.output?.id) {
298
298
  // Update existing token
299
299
  response = await api.put(
300
300
  `/accounts/${api.accountId}/tokens/${this.output.id}`,
301
- apiPayload
301
+ apiPayload,
302
302
  );
303
303
  } else {
304
304
  // Create new token
305
305
  response = await api.post(
306
306
  `/accounts/${api.accountId}/tokens`,
307
- apiPayload
307
+ apiPayload,
308
308
  );
309
309
  }
310
310
 
@@ -316,7 +316,7 @@ export const AccountApiToken = Resource(
316
316
  throw new Error(
317
317
  `Error ${this.phase === "update" ? "updating" : "creating"} token '${props.name}': ${
318
318
  errorData.errors?.[0]?.message || response.statusText
319
- }`
319
+ }`,
320
320
  );
321
321
  }
322
322
 
@@ -328,7 +328,7 @@ export const AccountApiToken = Resource(
328
328
  } else {
329
329
  if (!this.output?.value) {
330
330
  throw new Error(
331
- `Token '${props.name}' was created but we have no record of its value. Try deleting and recreating the token.`
331
+ `Token '${props.name}' was created but we have no record of its value. Try deleting and recreating the token.`,
332
332
  );
333
333
  }
334
334
  tokenValue = this.output?.value;
@@ -365,5 +365,5 @@ export const AccountApiToken = Resource(
365
365
  accessKeyId: tokenData.id,
366
366
  secretAccessKey: sha256(tokenValue.unencrypted),
367
367
  });
368
- }
368
+ },
369
369
  );