alchemy 0.75.0 → 0.76.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 (226) hide show
  1. package/bin/alchemy.js +302 -287
  2. package/bin/commands/util.ts +8 -4
  3. package/bin/services/execute-alchemy.ts +4 -2
  4. package/bin/services/github-workflow.ts +2 -3
  5. package/bin/services/package-manager.ts +1 -5
  6. package/lib/alchemy.d.ts +1 -1
  7. package/lib/alchemy.d.ts.map +1 -1
  8. package/lib/alchemy.js +1 -1
  9. package/lib/alchemy.js.map +1 -1
  10. package/lib/apply.js +10 -0
  11. package/lib/apply.js.map +1 -1
  12. package/lib/aws/control/types.d.ts.map +1 -1
  13. package/lib/aws/control/types.js.map +1 -1
  14. package/lib/clickhouse/api/sdk.gen.d.ts.map +1 -1
  15. package/lib/clickhouse/api/sdk.gen.js.map +1 -1
  16. package/lib/cloudflare/account-api-token.d.ts.map +1 -1
  17. package/lib/cloudflare/account-api-token.js.map +1 -1
  18. package/lib/cloudflare/bound.d.ts.map +1 -1
  19. package/lib/cloudflare/bucket.d.ts +1 -1
  20. package/lib/cloudflare/bucket.d.ts.map +1 -1
  21. package/lib/cloudflare/bucket.js +1 -1
  22. package/lib/cloudflare/bucket.js.map +1 -1
  23. package/lib/cloudflare/cloudflare-env-proxy.d.ts.map +1 -1
  24. package/lib/cloudflare/cloudflare-env-proxy.js +3 -3
  25. package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
  26. package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
  27. package/lib/cloudflare/compatibility-date.gen.js +1 -1
  28. package/lib/cloudflare/d1-database.d.ts.map +1 -1
  29. package/lib/cloudflare/d1-database.js +0 -4
  30. package/lib/cloudflare/d1-database.js.map +1 -1
  31. package/lib/cloudflare/dns-records.js.map +1 -1
  32. package/lib/cloudflare/hyperdrive.d.ts +0 -1
  33. package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
  34. package/lib/cloudflare/hyperdrive.js.map +1 -1
  35. package/lib/cloudflare/miniflare/delete.d.ts.map +1 -1
  36. package/lib/cloudflare/miniflare/delete.js +3 -0
  37. package/lib/cloudflare/miniflare/delete.js.map +1 -1
  38. package/lib/cloudflare/miniflare/paths.d.ts +0 -1
  39. package/lib/cloudflare/miniflare/paths.d.ts.map +1 -1
  40. package/lib/cloudflare/miniflare/paths.js +4 -17
  41. package/lib/cloudflare/miniflare/paths.js.map +1 -1
  42. package/lib/cloudflare/nuxt/plugin.d.ts.map +1 -1
  43. package/lib/cloudflare/nuxt/plugin.js +2 -2
  44. package/lib/cloudflare/nuxt/plugin.js.map +1 -1
  45. package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
  46. package/lib/cloudflare/queue-consumer.js +0 -2
  47. package/lib/cloudflare/queue-consumer.js.map +1 -1
  48. package/lib/cloudflare/react-router/plugin.d.ts.map +1 -1
  49. package/lib/cloudflare/react-router/plugin.js +0 -1
  50. package/lib/cloudflare/react-router/plugin.js.map +1 -1
  51. package/lib/cloudflare/vite/plugin.d.ts.map +1 -1
  52. package/lib/cloudflare/vite/plugin.js +3 -3
  53. package/lib/cloudflare/vite/plugin.js.map +1 -1
  54. package/lib/cloudflare/website.d.ts.map +1 -1
  55. package/lib/cloudflare/website.js +0 -4
  56. package/lib/cloudflare/website.js.map +1 -1
  57. package/lib/cloudflare/worker-assets.d.ts +1 -1
  58. package/lib/cloudflare/worker-assets.d.ts.map +1 -1
  59. package/lib/cloudflare/worker-assets.js +1 -1
  60. package/lib/cloudflare/worker-assets.js.map +1 -1
  61. package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
  62. package/lib/cloudflare/worker-metadata.js.map +1 -1
  63. package/lib/cloudflare/worker-tail.d.ts.map +1 -1
  64. package/lib/cloudflare/worker-tail.js.map +1 -1
  65. package/lib/cloudflare/worker.d.ts.map +1 -1
  66. package/lib/cloudflare/worker.js +3 -1
  67. package/lib/cloudflare/worker.js.map +1 -1
  68. package/lib/cloudflare/wrangler.json.js +0 -1
  69. package/lib/cloudflare/wrangler.json.js.map +1 -1
  70. package/lib/cloudflare/zone.d.ts +1 -1
  71. package/lib/cloudflare/zone.d.ts.map +1 -1
  72. package/lib/cloudflare/zone.js +3 -28
  73. package/lib/cloudflare/zone.js.map +1 -1
  74. package/lib/coinbase/evm-account.d.ts.map +1 -1
  75. package/lib/coinbase/evm-account.js.map +1 -1
  76. package/lib/coinbase/evm-smart-account.d.ts.map +1 -1
  77. package/lib/coinbase/evm-smart-account.js.map +1 -1
  78. package/lib/docker/api.d.ts.map +1 -1
  79. package/lib/docker/api.js.map +1 -1
  80. package/lib/github/secret.d.ts.map +1 -1
  81. package/lib/github/secret.js.map +1 -1
  82. package/lib/neon/api/sdk.gen.d.ts.map +1 -1
  83. package/lib/neon/api/sdk.gen.js.map +1 -1
  84. package/lib/os/exec.d.ts.map +1 -1
  85. package/lib/os/exec.js.map +1 -1
  86. package/lib/planetscale/api/sdk.gen.d.ts.map +1 -1
  87. package/lib/planetscale/api/sdk.gen.js.map +1 -1
  88. package/lib/prisma-postgres/api/sdk.gen.d.ts.map +1 -1
  89. package/lib/prisma-postgres/api/sdk.gen.js.map +1 -1
  90. package/lib/scope.d.ts.map +1 -1
  91. package/lib/scope.js +2 -2
  92. package/lib/scope.js.map +1 -1
  93. package/lib/sentry/client-key.js +1 -1
  94. package/lib/sentry/client-key.js.map +1 -1
  95. package/lib/test/bun.d.ts.map +1 -1
  96. package/lib/test/bun.js.map +1 -1
  97. package/lib/test/vitest.d.ts.map +1 -1
  98. package/lib/test/vitest.js.map +1 -1
  99. package/lib/util/api/client/client.gen.d.ts +1 -1
  100. package/lib/util/api/client/client.gen.js +45 -45
  101. package/lib/util/api/client/types.gen.d.ts +22 -22
  102. package/lib/util/api/client/utils.gen.d.ts +3 -3
  103. package/lib/util/api/client/utils.gen.d.ts.map +1 -1
  104. package/lib/util/api/client/utils.gen.js +34 -34
  105. package/lib/util/api/client/utils.gen.js.map +1 -1
  106. package/lib/util/api/core/auth.gen.d.ts +3 -3
  107. package/lib/util/api/core/auth.gen.js +3 -3
  108. package/lib/util/api/core/bodySerializer.gen.d.ts +1 -1
  109. package/lib/util/api/core/bodySerializer.gen.js +3 -3
  110. package/lib/util/api/core/params.gen.d.ts +3 -3
  111. package/lib/util/api/core/params.gen.js +7 -7
  112. package/lib/util/api/core/pathSerializer.gen.d.ts +3 -3
  113. package/lib/util/api/core/pathSerializer.gen.js +36 -36
  114. package/lib/util/api/core/serverSentEvents.gen.d.ts +3 -3
  115. package/lib/util/api/core/serverSentEvents.gen.js +18 -18
  116. package/lib/util/api/core/types.gen.d.ts +4 -4
  117. package/lib/util/api/core/utils.gen.d.ts +1 -1
  118. package/lib/util/api/core/utils.gen.js +17 -17
  119. package/lib/util/camel-to-snake.d.ts.map +1 -1
  120. package/lib/util/find-workspace-root.d.ts +3 -0
  121. package/lib/util/find-workspace-root.d.ts.map +1 -0
  122. package/lib/util/find-workspace-root.js +94 -0
  123. package/lib/util/find-workspace-root.js.map +1 -0
  124. package/lib/util/idempotent-spawn.d.ts.map +1 -1
  125. package/lib/util/idempotent-spawn.js +1 -1
  126. package/lib/util/idempotent-spawn.js.map +1 -1
  127. package/lib/util/peer.d.ts.map +1 -1
  128. package/lib/util/peer.js.map +1 -1
  129. package/package.json +1 -1
  130. package/src/alchemy.ts +4 -3
  131. package/src/apply.ts +16 -1
  132. package/src/aws/control/types.ts +87107 -85281
  133. package/src/clickhouse/api/sdk.gen.ts +1 -3
  134. package/src/cloudflare/account-api-token.ts +3 -1
  135. package/src/cloudflare/bound.ts +64 -65
  136. package/src/cloudflare/bucket.ts +4 -7
  137. package/src/cloudflare/cloudflare-env-proxy.ts +2 -4
  138. package/src/cloudflare/compatibility-date.gen.ts +1 -1
  139. package/src/cloudflare/d1-database.ts +0 -9
  140. package/src/cloudflare/dns-records.ts +3 -1
  141. package/src/cloudflare/hyperdrive.ts +0 -1
  142. package/src/cloudflare/miniflare/delete.ts +3 -0
  143. package/src/cloudflare/miniflare/paths.ts +4 -25
  144. package/src/cloudflare/nuxt/plugin.ts +1 -4
  145. package/src/cloudflare/queue-consumer.ts +0 -2
  146. package/src/cloudflare/react-router/plugin.ts +0 -1
  147. package/src/cloudflare/vite/plugin.ts +1 -3
  148. package/src/cloudflare/website.ts +0 -5
  149. package/src/cloudflare/worker-assets.ts +1 -6
  150. package/src/cloudflare/worker-metadata.ts +5 -3
  151. package/src/cloudflare/worker-tail.ts +3 -1
  152. package/src/cloudflare/worker.ts +3 -1
  153. package/src/cloudflare/wrangler.json.ts +0 -1
  154. package/src/cloudflare/zone.ts +6 -38
  155. package/src/coinbase/evm-account.ts +3 -1
  156. package/src/coinbase/evm-smart-account.ts +3 -1
  157. package/src/docker/api.ts +3 -1
  158. package/src/github/secret.ts +5 -1
  159. package/src/neon/api/sdk.gen.ts +1 -3
  160. package/src/os/exec.ts +3 -1
  161. package/src/planetscale/api/sdk.gen.ts +1 -3
  162. package/src/prisma-postgres/api/sdk.gen.ts +1 -3
  163. package/src/scope.ts +2 -2
  164. package/src/sentry/client-key.ts +1 -5
  165. package/src/test/bun.ts +3 -1
  166. package/src/test/vitest.ts +3 -1
  167. package/src/util/api/client/client.gen.ts +49 -49
  168. package/src/util/api/client/types.gen.ts +43 -43
  169. package/src/util/api/client/utils.gen.ts +47 -42
  170. package/src/util/api/core/auth.gen.ts +6 -6
  171. package/src/util/api/core/bodySerializer.gen.ts +4 -4
  172. package/src/util/api/core/params.gen.ts +10 -10
  173. package/src/util/api/core/pathSerializer.gen.ts +39 -39
  174. package/src/util/api/core/serverSentEvents.gen.ts +22 -22
  175. package/src/util/api/core/types.gen.ts +12 -12
  176. package/src/util/api/core/utils.gen.ts +18 -18
  177. package/src/util/camel-to-snake.ts +12 -10
  178. package/src/util/find-workspace-root.ts +112 -0
  179. package/src/util/idempotent-spawn.ts +1 -5
  180. package/src/util/peer.ts +3 -1
  181. package/templates/astro/astro.config.mjs +3 -3
  182. package/templates/astro/src/pages/api/hello.ts +16 -13
  183. package/templates/bun-spa/bun-env.d.ts +0 -1
  184. package/templates/bun-spa/eslint.config.js +11 -12
  185. package/templates/bun-spa/src/App.tsx +0 -1
  186. package/templates/bun-spa/src/frontend.tsx +0 -1
  187. package/templates/hono/src/index.ts +13 -13
  188. package/templates/nextjs/alchemy.run.ts +1 -1
  189. package/templates/nextjs/eslint.config.mjs +1 -1
  190. package/templates/nextjs/next-env.d.ts +1 -1
  191. package/templates/nextjs/next.config.ts +1 -1
  192. package/templates/nextjs/open-next.config.ts +1 -1
  193. package/templates/nextjs/src/app/api/hello/route.ts +2 -2
  194. package/templates/nextjs/src/app/layout.tsx +1 -1
  195. package/templates/nextjs/src/app/page.tsx +14 -15
  196. package/templates/nextjs/types/env.d.ts +4 -4
  197. package/templates/nuxt/server/middleware/auth.ts +1 -1
  198. package/templates/nuxt/server/middleware/hello.ts +2 -2
  199. package/templates/react-router/app/entry.server.tsx +2 -2
  200. package/templates/react-router/vite.config.ts +1 -1
  201. package/templates/react-router/workers/app.ts +2 -2
  202. package/templates/rwsdk/alchemy.run.ts +6 -3
  203. package/templates/sveltekit/src/app.d.ts +7 -7
  204. package/templates/sveltekit/svelte.config.js +4 -4
  205. package/templates/sveltekit/vite.config.ts +3 -3
  206. package/templates/tanstack-start/src/components/Header.tsx +2 -2
  207. package/templates/tanstack-start/src/router.tsx +4 -4
  208. package/templates/tanstack-start/src/routes/__root.tsx +10 -10
  209. package/templates/tanstack-start/src/routes/api.demo-names.ts +6 -6
  210. package/templates/tanstack-start/src/routes/demo.start.api-request.tsx +11 -11
  211. package/templates/tanstack-start/src/routes/demo.start.server-funcs.tsx +30 -30
  212. package/templates/tanstack-start/src/routes/index.tsx +5 -5
  213. package/templates/tanstack-start/vite.config.ts +9 -9
  214. package/templates/typescript/src/worker.ts +5 -1
  215. package/templates/vite/eslint.config.js +12 -12
  216. package/templates/vite/src/App.tsx +7 -7
  217. package/templates/vite/src/main.tsx +6 -6
  218. package/templates/vite/src/worker.ts +11 -12
  219. package/templates/vite/vite.config.ts +2 -2
  220. package/workers/tunnel-proxy.js +1 -1
  221. package/bin/services/find-workspace-root.ts +0 -48
  222. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts +0 -2
  223. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts.map +0 -1
  224. package/lib/cloudflare/miniflare/symlink-miniflare-state.js +0 -18
  225. package/lib/cloudflare/miniflare/symlink-miniflare-state.js.map +0 -1
  226. package/src/cloudflare/miniflare/symlink-miniflare-state.ts +0 -18
@@ -200,9 +200,7 @@ export type Options<
200
200
  class _HeyApiClient {
201
201
  protected _client: Client = client;
202
202
 
203
- constructor(args?: {
204
- client?: Client;
205
- }) {
203
+ constructor(args?: { client?: Client }) {
206
204
  if (args?.client) {
207
205
  this._client = args.client;
208
206
  }
@@ -360,7 +360,9 @@ export const AccountApiToken = Resource(
360
360
  }));
361
361
 
362
362
  throw new Error(
363
- `Error ${this.phase === "update" ? "updating" : "creating"} token '${tokenName}': ${
363
+ `Error ${
364
+ this.phase === "update" ? "updating" : "creating"
365
+ } token '${tokenName}': ${
364
366
  errorData.errors?.[0]?.message || response.statusText
365
367
  }`,
366
368
  );
@@ -37,69 +37,68 @@ type BoundWorker<
37
37
  >]: Rpc.Provider<RPC, "fetch" | "connect">[property];
38
38
  };
39
39
 
40
- export type Bound<T extends Binding> = T extends _DurableObjectNamespace<
41
- infer O
42
- >
43
- ? DurableObjectNamespace<O & Rpc.DurableObjectBranded>
44
- : T extends { type: "kv_namespace" }
45
- ? KVNamespace
46
- : T extends WorkerStub<infer RPC>
47
- ? BoundWorker<RPC>
48
- : T extends _Worker<any, infer RPC> | WorkerRef<infer RPC>
40
+ export type Bound<T extends Binding> =
41
+ T extends _DurableObjectNamespace<infer O>
42
+ ? DurableObjectNamespace<O & Rpc.DurableObjectBranded>
43
+ : T extends { type: "kv_namespace" }
44
+ ? KVNamespace
45
+ : T extends WorkerStub<infer RPC>
49
46
  ? BoundWorker<RPC>
50
- : T extends { type: "service" }
51
- ? Service
52
- : T extends _R2Bucket
53
- ? R2Bucket
54
- : T extends _Hyperdrive | HyperdriveRef
55
- ? Hyperdrive
56
- : T extends Secret
57
- ? string
58
- : T extends CloudflareSecret | CloudflareSecretRef
59
- ? SecretsStoreSecret
60
- : T extends SecretKey
61
- ? CryptoKey
62
- : T extends Assets
63
- ? Service
64
- : T extends _Workflow<infer P>
65
- ? Workflow<P>
66
- : T extends _D1Database
67
- ? D1Database
68
- : T extends DispatchNamespace
69
- ? DispatchNamespace
70
- : T extends _WorkerLoader
71
- ? WorkerLoader
72
- : T extends _VectorizeIndex
73
- ? VectorizeIndex
74
- : T extends _Queue<infer Body>
75
- ? Queue<Body>
76
- : T extends _AnalyticsEngineDataset
77
- ? AnalyticsEngineDataset
78
- : T extends _Pipeline<infer R>
79
- ? Pipeline<R>
80
- : T extends _RateLimit
81
- ? RateLimit
82
- : T extends string
83
- ? T
84
- : T extends BrowserRendering
85
- ? Fetcher
86
- : T extends _Ai<infer M>
87
- ? Ai<M>
88
- : T extends _Images
89
- ? ImagesBinding
90
- : T extends _VersionMetadata
91
- ? WorkerVersionMetadata
92
- : T extends Self
93
- ? Service
94
- : T extends Json<infer T>
95
- ? T
96
- : T extends _Container<
97
- infer Obj
98
- >
99
- ? DurableObjectNamespace<
100
- Obj &
101
- Rpc.DurableObjectBranded
102
- >
103
- : T extends undefined
104
- ? undefined
105
- : Service;
47
+ : T extends _Worker<any, infer RPC> | WorkerRef<infer RPC>
48
+ ? BoundWorker<RPC>
49
+ : T extends { type: "service" }
50
+ ? Service
51
+ : T extends _R2Bucket
52
+ ? R2Bucket
53
+ : T extends _Hyperdrive | HyperdriveRef
54
+ ? Hyperdrive
55
+ : T extends Secret
56
+ ? string
57
+ : T extends CloudflareSecret | CloudflareSecretRef
58
+ ? SecretsStoreSecret
59
+ : T extends SecretKey
60
+ ? CryptoKey
61
+ : T extends Assets
62
+ ? Service
63
+ : T extends _Workflow<infer P>
64
+ ? Workflow<P>
65
+ : T extends _D1Database
66
+ ? D1Database
67
+ : T extends DispatchNamespace
68
+ ? DispatchNamespace
69
+ : T extends _WorkerLoader
70
+ ? WorkerLoader
71
+ : T extends _VectorizeIndex
72
+ ? VectorizeIndex
73
+ : T extends _Queue<infer Body>
74
+ ? Queue<Body>
75
+ : T extends _AnalyticsEngineDataset
76
+ ? AnalyticsEngineDataset
77
+ : T extends _Pipeline<infer R>
78
+ ? Pipeline<R>
79
+ : T extends _RateLimit
80
+ ? RateLimit
81
+ : T extends string
82
+ ? T
83
+ : T extends BrowserRendering
84
+ ? Fetcher
85
+ : T extends _Ai<infer M>
86
+ ? Ai<M>
87
+ : T extends _Images
88
+ ? ImagesBinding
89
+ : T extends _VersionMetadata
90
+ ? WorkerVersionMetadata
91
+ : T extends Self
92
+ ? Service
93
+ : T extends Json<infer T>
94
+ ? T
95
+ : T extends _Container<
96
+ infer Obj
97
+ >
98
+ ? DurableObjectNamespace<
99
+ Obj &
100
+ Rpc.DurableObjectBranded
101
+ >
102
+ : T extends undefined
103
+ ? undefined
104
+ : Service;
@@ -1007,7 +1007,9 @@ export async function listBuckets(
1007
1007
  }
1008
1008
 
1009
1009
  // Build URL with query parameters
1010
- const path = `/accounts/${api.accountId}/r2/buckets${params.toString() ? `?${params.toString()}` : ""}`;
1010
+ const path = `/accounts/${api.accountId}/r2/buckets${
1011
+ params.toString() ? `?${params.toString()}` : ""
1012
+ }`;
1011
1013
 
1012
1014
  // Make the API request
1013
1015
  const result = await extractCloudflareResult<{
@@ -1262,12 +1264,7 @@ function mapHeadersToHttpMetadata(headers: Headers): R2HTTPMetadata {
1262
1264
 
1263
1265
  export async function putObject(
1264
1266
  api: CloudflareApi,
1265
- {
1266
- bucketName,
1267
- key,
1268
- object,
1269
- options,
1270
- }: {
1267
+ { bucketName, key, object, options }: {
1271
1268
  bucketName: string;
1272
1269
  key: string;
1273
1270
  object: PutObjectObject;
@@ -3,7 +3,6 @@ import {
3
3
  getDefaultConfigPath,
4
4
  getDefaultPersistPath,
5
5
  validateConfigPath,
6
- validatePersistPath,
7
6
  } from "./miniflare/paths.ts";
8
7
 
9
8
  export const getCloudflareEnvProxy = async <E>(
@@ -22,12 +21,11 @@ export const getPlatformProxyOptions = (
22
21
  input.persist === false
23
22
  ? false
24
23
  : {
25
- path: validatePersistPath(
24
+ path:
26
25
  typeof input.persist === "object" &&
27
- typeof input.persist.path === "string"
26
+ typeof input.persist.path === "string"
28
27
  ? input.persist.path
29
28
  : getDefaultPersistPath(),
30
- ),
31
29
  };
32
30
  if (!persist) {
33
31
  const message =
@@ -4,4 +4,4 @@
4
4
  /**
5
5
  * The default Cloudflare Workers compatibility date, set based on the latest workerd release at the time of build.
6
6
  */
7
- export const DEFAULT_COMPATIBILITY_DATE = "2025-10-11";
7
+ export const DEFAULT_COMPATIBILITY_DATE = "2025-10-14";
@@ -318,7 +318,6 @@ const _D1Database = Resource(
318
318
  // after that, the ID will remain the UUID for the lifetime of the database
319
319
  !this.output?.id
320
320
  ) {
321
- logger.log("Creating D1 database:", databaseName);
322
321
  try {
323
322
  dbData = await createDatabase(api, databaseName, props);
324
323
 
@@ -354,9 +353,6 @@ const _D1Database = Resource(
354
353
 
355
354
  // Update the database with the provided properties
356
355
  if (props.readReplication) {
357
- logger.log(
358
- `Updating adopted database ${databaseName} with new properties`,
359
- );
360
356
  dbData = await updateDatabase(api, existingDb.id, props);
361
357
  }
362
358
  } else {
@@ -374,15 +370,10 @@ const _D1Database = Resource(
374
370
  `Cannot update primaryLocationHint from '${this.output.primaryLocationHint}' to '${props.primaryLocationHint}' after database creation.`,
375
371
  );
376
372
  }
377
- logger.log("Updating D1 database:", databaseName);
378
373
  // Update the database with new properties
379
374
  dbData = await updateDatabase(api, this.output.id, props);
380
375
  } else {
381
376
  // If no ID exists, fall back to creating a new database
382
- logger.log(
383
- "No existing database ID found, creating new D1 database:",
384
- databaseName,
385
- );
386
377
  dbData = await createDatabase(api, databaseName, props);
387
378
  }
388
379
 
@@ -314,7 +314,9 @@ async function createOrUpdateRecord(
314
314
  }
315
315
 
316
316
  throw new Error(
317
- `Failed to ${existingId ? "update" : "create"} DNS record ${record.name}: ${response.statusText}\nResponse: ${errorBody}`,
317
+ `Failed to ${
318
+ existingId ? "update" : "create"
319
+ } DNS record ${record.name}: ${response.statusText}\nResponse: ${errorBody}`,
318
320
  );
319
321
  }
320
322
 
@@ -167,7 +167,6 @@ export interface HyperdriveProps extends CloudflareApiOptions {
167
167
  /**
168
168
  * UUID of the hyperdrive (only used for update/delete operations)
169
169
  * This is provided by Cloudflare and is different from the resource ID
170
- * @internal
171
170
  */
172
171
  hyperdriveId?: string;
173
172
 
@@ -38,6 +38,9 @@ export async function deleteMiniflareBinding(
38
38
  .catch(() => []);
39
39
  await Promise.all(files.map((file) => fs.rm(path.join(bindingPath, file))));
40
40
 
41
+ // if running E2E tests, do not delete the data directory to prevent race conditions in smoke tests
42
+ if (process.env.ALCHEMY_E2E) return;
43
+
41
44
  // delete data directory, if present
42
45
  await removeDirectory(path.join(persistRoot, type, id), {
43
46
  recursive: true,
@@ -1,7 +1,8 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
2
  // biome-ignore lint/style/noRestrictedImports: I/O is acceptable here
3
- import { existsSync, readlinkSync, statSync } from "node:fs";
3
+ import { existsSync } from "node:fs";
4
4
  import path from "pathe";
5
+ import { findWorkspaceRootSync } from "../../util/find-workspace-root.ts";
5
6
  import { ALCHEMY_ROOT } from "../../util/root-dir.ts";
6
7
 
7
8
  const dynamicImportContext = new AsyncLocalStorage<boolean>();
@@ -18,7 +19,8 @@ export const getDefaultConfigPath = (rootDir: string = process.cwd()) => {
18
19
  };
19
20
 
20
21
  export const getDefaultPersistPath = (rootDir: string = ALCHEMY_ROOT) => {
21
- return path.join(rootDir, ".alchemy", "miniflare", "v3");
22
+ const workspaceRoot = findWorkspaceRootSync(rootDir);
23
+ return path.join(workspaceRoot, ".alchemy", "miniflare", "v3");
22
24
  };
23
25
 
24
26
  export const validateConfigPath = (path: string, throws = true) => {
@@ -31,29 +33,6 @@ export const validateConfigPath = (path: string, throws = true) => {
31
33
  return path;
32
34
  };
33
35
 
34
- const DEFAULT_VALIDATE_PERSIST =
35
- process.env.NODE_ENV === "development" ||
36
- !process.argv.some((arg) => ["build", "prepare", "typegen"].includes(arg));
37
-
38
- export const validatePersistPath = (
39
- path: string,
40
- throws = DEFAULT_VALIDATE_PERSIST,
41
- ) => {
42
- try {
43
- const stat = statSync(path);
44
- if (stat.isSymbolicLink()) {
45
- return readlinkSync(path);
46
- }
47
- return path;
48
- } catch {
49
- warnOrThrow(
50
- `The Alchemy data path, "${path}", could not be resolved. This is required for Cloudflare bindings during development. Please run \`alchemy dev\` to create it.`,
51
- throws,
52
- );
53
- return path;
54
- }
55
- };
56
-
57
36
  const warned = new Set<string>();
58
37
 
59
38
  const warnOrThrow = (message: string, throws: boolean) => {
@@ -3,7 +3,6 @@ import {
3
3
  getDefaultConfigPath,
4
4
  getDefaultPersistPath,
5
5
  validateConfigPath,
6
- validatePersistPath,
7
6
  } from "../miniflare/paths.ts";
8
7
 
9
8
  const alchemy = (
@@ -15,9 +14,7 @@ const alchemy = (
15
14
  configPath: validateConfigPath(
16
15
  options.dev?.configPath ?? getDefaultConfigPath(),
17
16
  ),
18
- persistDir: validatePersistPath(
19
- options.dev?.persistDir ?? getDefaultPersistPath(),
20
- ),
17
+ persistDir: options.dev?.persistDir ?? getDefaultPersistPath(),
21
18
  ...options.dev,
22
19
  },
23
20
  ...options,
@@ -1,6 +1,5 @@
1
1
  import type { Context } from "../context.ts";
2
2
  import { Resource } from "../resource.ts";
3
- import { logger } from "../util/logger.ts";
4
3
  import { CloudflareApiError, handleApiError } from "./api-error.ts";
5
4
  import {
6
5
  createCloudflareApi,
@@ -174,7 +173,6 @@ export const QueueConsumer = Resource(
174
173
  const api = await createCloudflareApi(props);
175
174
 
176
175
  if (this.phase === "delete") {
177
- logger.log(`Deleting Queue Consumer for queue ${queueId}`);
178
176
  if (props.delete !== false && this.output?.id) {
179
177
  // Delete the consumer
180
178
  await deleteQueueConsumer(api, queueId, this.output.id);
@@ -1,5 +1,4 @@
1
1
  import type { PluginConfig } from "@cloudflare/vite-plugin";
2
- // biome-ignore lint/style/noRestrictedImports: I/O is acceptable here
3
2
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
4
3
  import { dirname } from "pathe";
5
4
  import { getDefaultConfigPath } from "../miniflare/paths.ts";
@@ -5,17 +5,15 @@ import {
5
5
  getDefaultConfigPath,
6
6
  getDefaultPersistPath,
7
7
  validateConfigPath,
8
- validatePersistPath,
9
8
  } from "../miniflare/paths.ts";
10
9
 
11
10
  const alchemy = (config?: PluginConfig): PluginOption => {
12
11
  const persistState = config?.persistState ?? {
13
- path: validatePersistPath(
12
+ path:
14
13
  typeof config?.persistState === "object"
15
14
  ? config.persistState.path
16
15
  : // persist path should default to the /.alchemy/miniflare/v3
17
16
  getDefaultPersistPath(),
18
- ),
19
17
  };
20
18
  if (typeof persistState === "object" && persistState.path.endsWith("v3")) {
21
19
  persistState.path = path.dirname(persistState.path);
@@ -9,7 +9,6 @@ import { Assets } from "./assets.ts";
9
9
  import type { Bindings } from "./bindings.ts";
10
10
  import { DEFAULT_COMPATIBILITY_DATE } from "./compatibility-date.gen.ts";
11
11
  import { unionCompatibilityFlags } from "./compatibility-presets.ts";
12
- import { writeMiniflareSymlink } from "./miniflare/symlink-miniflare-state.ts";
13
12
  import {
14
13
  extractStringAndSecretBindings,
15
14
  unencryptSecrets,
@@ -263,10 +262,6 @@ export async function Website<B extends Bindings>(
263
262
  await fs.writeFile(paths.entrypoint, content);
264
263
  }
265
264
 
266
- if (Scope.current.local) {
267
- await writeMiniflareSymlink(Scope.current.rootDir, paths.cwd);
268
- }
269
-
270
265
  await WranglerJson({
271
266
  path: path.relative(paths.cwd, paths.wrangler.path),
272
267
  worker,
@@ -30,12 +30,7 @@ interface FileMetadata {
30
30
  */
31
31
  export async function uploadAssets(
32
32
  api: CloudflareApi,
33
- {
34
- workerName,
35
- assets,
36
- assetConfig,
37
- namespace,
38
- }: {
33
+ { workerName, assets, assetConfig, namespace }: {
39
34
  workerName: string;
40
35
  assets: Assets;
41
36
  assetConfig?: WorkerProps["assets"];
@@ -239,9 +239,11 @@ export async function prepareWorkerMetadata(
239
239
  };
240
240
  },
241
241
  ): Promise<WorkerMetadata> {
242
- const oldSettings = await (props.unstable_cacheWorkerSettings
243
- ? getWorkerSettingsWithCache
244
- : getWorkerSettings)(api, props.workerName);
242
+ const oldSettings = await (
243
+ props.unstable_cacheWorkerSettings
244
+ ? getWorkerSettingsWithCache
245
+ : getWorkerSettings
246
+ )(api, props.workerName);
245
247
  const oldTags: string[] | undefined = Array.from(
246
248
  new Set([
247
249
  ...(oldSettings?.default_environment?.script?.tags ?? []),
@@ -110,7 +110,9 @@ class TailClient {
110
110
  const status = event.response?.status ?? 500;
111
111
  // TODO: make this look nicer
112
112
  logger.log(
113
- `${prefix} ${pc.gray(event.request.method)} ${url.pathname} ${pc.dim(">")} ${status >= 200 && status < 300 ? pc.green(status) : pc.red(status)} ${pc.gray(`(cpu: ${Math.round(data.cpuTime)}ms, wall: ${Math.round(data.wallTime)}ms)`)}`,
113
+ `${prefix} ${pc.gray(event.request.method)} ${url.pathname} ${pc.dim(">")} ${
114
+ status >= 200 && status < 300 ? pc.green(status) : pc.red(status)
115
+ } ${pc.gray(`(cpu: ${Math.round(data.cpuTime)}ms, wall: ${Math.round(data.wallTime)}ms)`)}`,
114
116
  );
115
117
  }
116
118
  for (const log of data.logs) {
@@ -831,7 +831,9 @@ const _Worker = Resource(
831
831
  ) {
832
832
  let adopt = props.adopt ?? this.scope.adopt;
833
833
  const workerName =
834
- props.name ?? this.output?.name ?? this.scope.createPhysicalName(id);
834
+ props.name ??
835
+ this.output?.name ??
836
+ this.scope.createPhysicalName(id).toLowerCase();
835
837
  if (this.phase === "create" && !props.adopt) {
836
838
  // it is possible that this worker already exists and was created by the old Website wrapper with a nested scope
837
839
  // we need to detect this and set adopt=true so that the previous version will be adopted seamlessly
@@ -861,7 +861,6 @@ function processBindings(
861
861
  });
862
862
  } else {
863
863
  console.log("binding", binding);
864
- // biome-ignore lint/correctness/noVoidTypeReturn: it returns never
865
864
  return assertNever(binding);
866
865
  }
867
866
  }
@@ -2,6 +2,7 @@ import type { Context } from "../context.ts";
2
2
  import { Resource } from "../resource.ts";
3
3
  import { logger } from "../util/logger.ts";
4
4
  import { handleApiError } from "./api-error.ts";
5
+ import { extractCloudflareResult } from "./api-response.ts";
5
6
  import {
6
7
  createCloudflareApi,
7
8
  type CloudflareApi,
@@ -568,45 +569,12 @@ async function getZoneSettings(
568
569
  export async function getZoneByDomain(
569
570
  api: CloudflareApi,
570
571
  domainName: string,
571
- ): Promise<ZoneData | null> {
572
- const response = await api.get(
573
- `/zones?name=${encodeURIComponent(domainName)}`,
572
+ ): Promise<CloudflareZone | undefined> {
573
+ const [zone] = await extractCloudflareResult<CloudflareZone[]>(
574
+ `get zone for ${domainName}`,
575
+ api.get(`/zones?name=${encodeURIComponent(domainName)}`),
574
576
  );
575
-
576
- if (!response.ok) {
577
- throw new Error(
578
- `Error fetching zone for '${domainName}': ${response.statusText}`,
579
- );
580
- }
581
-
582
- const zones = ((await response.json()) as { result: CloudflareZone[] })
583
- .result;
584
-
585
- if (zones.length === 0) {
586
- return null;
587
- }
588
-
589
- const zoneData = zones[0];
590
-
591
- // Get zone settings
592
- const settings = await getZoneSettings(api, zoneData.id);
593
-
594
- return {
595
- id: zoneData.id,
596
- name: zoneData.name,
597
- type: zoneData.type,
598
- status: zoneData.status,
599
- paused: zoneData.paused,
600
- accountId: zoneData.account.id,
601
- nameservers: zoneData.name_servers,
602
- originalNameservers: zoneData.original_name_servers,
603
- createdAt: new Date(zoneData.created_on).getTime(),
604
- modifiedAt: new Date(zoneData.modified_on).getTime(),
605
- activatedAt: zoneData.activated_on
606
- ? new Date(zoneData.activated_on).getTime()
607
- : null,
608
- settings,
609
- };
577
+ return zone;
610
578
  }
611
579
 
612
580
  /**
@@ -207,7 +207,9 @@ export const EvmAccount = Resource(
207
207
  );
208
208
 
209
209
  console.log(
210
- `💧 Requested ${toFund.length} new faucet fund${toFund.length === 1 ? "" : "s"} for ${this.output.address}`,
210
+ `💧 Requested ${toFund.length} new faucet fund${
211
+ toFund.length === 1 ? "" : "s"
212
+ } for ${this.output.address}`,
211
213
  );
212
214
  }
213
215
  } catch (error: any) {
@@ -234,7 +234,9 @@ export const EvmSmartAccount = Resource(
234
234
  );
235
235
 
236
236
  console.log(
237
- `💧 Requested ${toFund.length} new faucet fund${toFund.length === 1 ? "" : "s"} for smart account ${this.output.address}`,
237
+ `💧 Requested ${toFund.length} new faucet fund${
238
+ toFund.length === 1 ? "" : "s"
239
+ } for smart account ${this.output.address}`,
238
240
  );
239
241
  }
240
242
  } catch (error: any) {
package/src/docker/api.ts CHANGED
@@ -159,7 +159,9 @@ export class DockerApi {
159
159
  return true;
160
160
  } catch (error) {
161
161
  console.log(
162
- `Docker daemon not running: ${error instanceof Error ? error.message : String(error)}`,
162
+ `Docker daemon not running: ${
163
+ error instanceof Error ? error.message : String(error)
164
+ }`,
163
165
  );
164
166
  return false;
165
167
  }
@@ -190,7 +190,11 @@ export const GitHubSecret = Resource(
190
190
  // If secret type changed, we need to delete the old one first
191
191
  if (secretTypeChanged) {
192
192
  logger.log(
193
- `Secret type changed from ${wasEnvironmentSecret ? "environment" : "repository"} to ${isEnvironmentSecret ? "environment" : "repository"} secret. Deleting the old secret first.`,
193
+ `Secret type changed from ${
194
+ wasEnvironmentSecret ? "environment" : "repository"
195
+ } to ${
196
+ isEnvironmentSecret ? "environment" : "repository"
197
+ } secret. Deleting the old secret first.`,
194
198
  );
195
199
 
196
200
  try {
@@ -338,9 +338,7 @@ export type Options<
338
338
  class _HeyApiClient {
339
339
  protected _client: Client = client;
340
340
 
341
- constructor(args?: {
342
- client?: Client;
343
- }) {
341
+ constructor(args?: { client?: Client }) {
344
342
  if (args?.client) {
345
343
  this._client = args.client;
346
344
  }
package/src/os/exec.ts CHANGED
@@ -356,7 +356,9 @@ export async function exec(
356
356
  } else {
357
357
  reject(
358
358
  new Error(
359
- `Command failed with exit code ${code}${stderr ? `: ${stderr}` : ""}`,
359
+ `Command failed with exit code ${code}${
360
+ stderr ? `: ${stderr}` : ""
361
+ }`,
360
362
  ),
361
363
  );
362
364
  }
@@ -355,9 +355,7 @@ export type Options<
355
355
  class _HeyApiClient {
356
356
  protected _client: Client = client;
357
357
 
358
- constructor(args?: {
359
- client?: Client;
360
- }) {
358
+ constructor(args?: { client?: Client }) {
361
359
  if (args?.client) {
362
360
  this._client = args.client;
363
361
  }
@@ -86,9 +86,7 @@ export type Options<
86
86
  class _HeyApiClient {
87
87
  protected _client: Client = client;
88
88
 
89
- constructor(args?: {
90
- client?: Client;
91
- }) {
89
+ constructor(args?: { client?: Client }) {
92
90
  if (args?.client) {
93
91
  this._client = args.client;
94
92
  }
package/src/scope.ts CHANGED
@@ -173,8 +173,8 @@ export class Scope {
173
173
 
174
174
  public static readonly KIND = "alchemy::Scope" as const;
175
175
 
176
- public static storage = (globalThis.__ALCHEMY_STORAGE__ ??=
177
- new AsyncLocalStorage<Scope>());
176
+ public static storage = globalThis.__ALCHEMY_STORAGE__ ??=
177
+ new AsyncLocalStorage<Scope>();
178
178
 
179
179
  public static getScope(): Scope | undefined {
180
180
  return Scope.storage.getStore();