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
@@ -142,7 +142,7 @@ export const Product = Resource(
142
142
  async function (
143
143
  this: Context<Product>,
144
144
  id: string,
145
- props: ProductProps
145
+ props: ProductProps,
146
146
  ): Promise<Product> {
147
147
  // Get Stripe API key from context or environment
148
148
  const apiKey = process.env.STRIPE_API_KEY;
@@ -165,62 +165,61 @@ export const Product = Resource(
165
165
 
166
166
  // Return a minimal output for deleted state
167
167
  return this.destroy();
168
- } else {
169
- try {
170
- let product: Stripe.Product;
171
-
172
- if (this.phase === "update" && this.output?.id) {
173
- // Update existing product
174
- product = await stripe.products.update(this.output.id, {
175
- name: props.name,
176
- description: props.description,
177
- active: props.active,
178
- images: props.images,
179
- url: props.url,
180
- statement_descriptor: props.statementDescriptor,
181
- metadata: props.metadata,
182
- tax_code: props.taxCode,
183
- });
184
- } else {
185
- // Create new product
186
- product = await stripe.products.create({
187
- name: props.name,
188
- description: props.description,
189
- active: props.active,
190
- images: props.images,
191
- url: props.url,
192
- shippable: props.shippable,
193
- type: props.type as Stripe.ProductCreateParams.Type,
194
- unit_label: props.unitLabel,
195
- statement_descriptor: props.statementDescriptor,
196
- metadata: props.metadata,
197
- tax_code: props.taxCode,
198
- });
199
- }
200
-
201
- return this({
202
- id: product.id,
203
- name: product.name,
204
- description: product.description || undefined,
205
- active: product.active,
206
- images: product.images || undefined,
207
- url: product.url || undefined,
208
- shippable: product.shippable || undefined,
209
- type: product.type as ProductType,
210
- unitLabel: product.unit_label || undefined,
211
- statementDescriptor: product.statement_descriptor || undefined,
212
- metadata: product.metadata || undefined,
213
- taxCode:
214
- typeof product.tax_code === "string" ? product.tax_code : undefined,
215
- createdAt: product.created,
216
- livemode: product.livemode,
217
- updatedAt: product.updated,
218
- packageDimensions: product.package_dimensions || undefined,
168
+ }
169
+ try {
170
+ let product: Stripe.Product;
171
+
172
+ if (this.phase === "update" && this.output?.id) {
173
+ // Update existing product
174
+ product = await stripe.products.update(this.output.id, {
175
+ name: props.name,
176
+ description: props.description,
177
+ active: props.active,
178
+ images: props.images,
179
+ url: props.url,
180
+ statement_descriptor: props.statementDescriptor,
181
+ metadata: props.metadata,
182
+ tax_code: props.taxCode,
183
+ });
184
+ } else {
185
+ // Create new product
186
+ product = await stripe.products.create({
187
+ name: props.name,
188
+ description: props.description,
189
+ active: props.active,
190
+ images: props.images,
191
+ url: props.url,
192
+ shippable: props.shippable,
193
+ type: props.type as Stripe.ProductCreateParams.Type,
194
+ unit_label: props.unitLabel,
195
+ statement_descriptor: props.statementDescriptor,
196
+ metadata: props.metadata,
197
+ tax_code: props.taxCode,
219
198
  });
220
- } catch (error) {
221
- console.error("Error creating/updating product:", error);
222
- throw error;
223
199
  }
200
+
201
+ return this({
202
+ id: product.id,
203
+ name: product.name,
204
+ description: product.description || undefined,
205
+ active: product.active,
206
+ images: product.images || undefined,
207
+ url: product.url || undefined,
208
+ shippable: product.shippable || undefined,
209
+ type: product.type as ProductType,
210
+ unitLabel: product.unit_label || undefined,
211
+ statementDescriptor: product.statement_descriptor || undefined,
212
+ metadata: product.metadata || undefined,
213
+ taxCode:
214
+ typeof product.tax_code === "string" ? product.tax_code : undefined,
215
+ createdAt: product.created,
216
+ livemode: product.livemode,
217
+ updatedAt: product.updated,
218
+ packageDimensions: product.package_dimensions || undefined,
219
+ });
220
+ } catch (error) {
221
+ console.error("Error creating/updating product:", error);
222
+ throw error;
224
223
  }
225
- }
224
+ },
226
225
  );
@@ -136,7 +136,7 @@ export const WebhookEndpoint = Resource(
136
136
  async function (
137
137
  this: Context<WebhookEndpoint>,
138
138
  id: string,
139
- props: WebhookEndpointProps
139
+ props: WebhookEndpointProps,
140
140
  ) {
141
141
  // Get Stripe API key from context or environment
142
142
  const apiKey = process.env.STRIPE_API_KEY;
@@ -159,65 +159,64 @@ export const WebhookEndpoint = Resource(
159
159
  }
160
160
 
161
161
  return this.destroy();
162
- } else {
163
- try {
164
- let webhook: Stripe.WebhookEndpoint;
165
-
166
- if (this.phase === "update" && this.output?.id) {
167
- // Update existing webhook
168
- webhook = await stripe.webhookEndpoints.update(this.output.id, {
169
- url: props.url,
170
- enabled_events: props.enabledEvents,
171
- description: props.description,
172
- disabled: props.active === false,
173
- metadata: props.metadata,
174
- });
175
- } else {
176
- // Create new webhook
177
- webhook = await stripe.webhookEndpoints.create({
178
- url: props.url,
179
- enabled_events: props.enabledEvents,
180
- description: props.description,
181
- metadata: props.metadata,
182
- });
183
-
184
- // For connect parameter, need to handle it separately if it exists
185
- if (props.connect !== undefined) {
186
- // Note: connect is specified at creation time and cannot be updated
187
- console.log(
188
- "Note: 'connect' parameter will be applied at creation time only"
189
- );
190
- }
191
- }
162
+ }
163
+ try {
164
+ let webhook: Stripe.WebhookEndpoint;
165
+
166
+ if (this.phase === "update" && this.output?.id) {
167
+ // Update existing webhook
168
+ webhook = await stripe.webhookEndpoints.update(this.output.id, {
169
+ url: props.url,
170
+ enabled_events: props.enabledEvents,
171
+ description: props.description,
172
+ disabled: props.active === false,
173
+ metadata: props.metadata,
174
+ });
175
+ } else {
176
+ // Create new webhook
177
+ webhook = await stripe.webhookEndpoints.create({
178
+ url: props.url,
179
+ enabled_events: props.enabledEvents,
180
+ description: props.description,
181
+ metadata: props.metadata,
182
+ });
192
183
 
193
- // Store the secret if available
194
- let secret = "";
195
- if (webhook.secret) {
196
- secret = webhook.secret;
197
- } else if (this.phase === "update" && this.output?.secret) {
198
- secret = this.output.secret;
184
+ // For connect parameter, need to handle it separately if it exists
185
+ if (props.connect !== undefined) {
186
+ // Note: connect is specified at creation time and cannot be updated
187
+ console.log(
188
+ "Note: 'connect' parameter will be applied at creation time only",
189
+ );
199
190
  }
191
+ }
200
192
 
201
- return this({
202
- id: webhook.id,
203
- url: webhook.url,
204
- enabledEvents: webhook.enabled_events as EnabledEvent[],
205
- description: webhook.description || undefined,
206
- active: webhook.status === "enabled",
207
- apiVersion: webhook.api_version || undefined,
208
- // connect: !!webhook.connect,
209
- metadata: webhook.metadata || undefined,
210
- secret: secret,
211
- application: webhook.application || undefined,
212
- createdAt: webhook.created,
213
- livemode: webhook.livemode,
214
- updatedAt: webhook.created, // Using created timestamp as updated
215
- status: webhook.status,
216
- });
217
- } catch (error) {
218
- console.error("Error creating/updating webhook:", error);
219
- throw error;
193
+ // Store the secret if available
194
+ let secret = "";
195
+ if (webhook.secret) {
196
+ secret = webhook.secret;
197
+ } else if (this.phase === "update" && this.output?.secret) {
198
+ secret = this.output.secret;
220
199
  }
200
+
201
+ return this({
202
+ id: webhook.id,
203
+ url: webhook.url,
204
+ enabledEvents: webhook.enabled_events as EnabledEvent[],
205
+ description: webhook.description || undefined,
206
+ active: webhook.status === "enabled",
207
+ apiVersion: webhook.api_version || undefined,
208
+ // connect: !!webhook.connect,
209
+ metadata: webhook.metadata || undefined,
210
+ secret: secret,
211
+ application: webhook.application || undefined,
212
+ createdAt: webhook.created,
213
+ livemode: webhook.livemode,
214
+ updatedAt: webhook.created, // Using created timestamp as updated
215
+ status: webhook.status,
216
+ });
217
+ } catch (error) {
218
+ console.error("Error creating/updating webhook:", error);
219
+ throw error;
221
220
  }
222
- }
221
+ },
223
222
  );
package/src/test/bun.ts CHANGED
@@ -10,7 +10,7 @@ import type { StateStoreType } from "../state.js";
10
10
  /**
11
11
  * Extend the Alchemy interface to include test functionality
12
12
  */
13
- declare module "../alchemy" {
13
+ declare module "../alchemy.js" {
14
14
  interface Alchemy {
15
15
  test: typeof test;
16
16
  }
@@ -71,7 +71,7 @@ type test = {
71
71
  name: string,
72
72
  options: TestOptions,
73
73
  fn: (scope: Scope) => Promise<any>,
74
- timeout?: number
74
+ timeout?: number,
75
75
  ): void;
76
76
 
77
77
  /**
@@ -142,6 +142,7 @@ export function test(meta: ImportMeta, defaultOptions?: TestOptions): test {
142
142
  scopeName: `${defaultOptions.prefix ? `${defaultOptions.prefix}-` : ""}${path.basename(meta.filename)}`,
143
143
  // parent: globalTestScope,
144
144
  stateStore: defaultOptions?.stateStore,
145
+ phase: "up",
145
146
  });
146
147
 
147
148
  test.beforeAll = (fn: (scope: Scope) => Promise<void>) => {
@@ -173,8 +174,8 @@ export function test(meta: ImportMeta, defaultOptions?: TestOptions): test {
173
174
  obj && typeof obj === "object"
174
175
  ? Object.fromEntries(
175
176
  Object.entries(obj).flatMap(([k, v]) =>
176
- v !== undefined ? [[k, v]] : []
177
- )
177
+ v !== undefined ? [[k, v]] : [],
178
+ ),
178
179
  )
179
180
  : {};
180
181
 
@@ -198,16 +199,11 @@ export function test(meta: ImportMeta, defaultOptions?: TestOptions): test {
198
199
  parent: scope,
199
200
  },
200
201
  async (scope) => {
201
- try {
202
- // Enter test scope since bun calls from different scope
203
- await scope.run(() => fn(scope));
204
- } catch (err) {
205
- console.error(err);
206
- throw err;
207
- }
208
- }
202
+ // Enter test scope since bun calls from different scope
203
+ await scope.run(() => fn(scope));
204
+ },
209
205
  ),
210
- timeout
206
+ timeout,
211
207
  );
212
208
  }
213
209
  }
package/src/test/prune.ts CHANGED
@@ -13,7 +13,7 @@ const execAsync = promisify(exec);
13
13
  */
14
14
  export async function runChangedTests(
15
15
  directory: string,
16
- baseCommit?: string
16
+ baseCommit?: string,
17
17
  ): Promise<void> {
18
18
  const changedTests = await findChangedTestFiles(directory, baseCommit);
19
19
 
@@ -45,7 +45,7 @@ export async function runChangedTests(
45
45
  */
46
46
  export async function findChangedTestFiles(
47
47
  directory: string,
48
- baseCommit: string = "HEAD~1"
48
+ baseCommit = "HEAD~1",
49
49
  ): Promise<string[]> {
50
50
  // 1. Find all test files
51
51
  const testFiles = await findTestFiles(directory);
@@ -62,7 +62,7 @@ export async function findChangedTestFiles(
62
62
 
63
63
  // Check if any dependencies have changed
64
64
  const changedDependencies = [...dependencies].filter((dep) =>
65
- changedFiles.has(dep)
65
+ changedFiles.has(dep),
66
66
  );
67
67
 
68
68
  if (changedDependencies.length > 0) {
@@ -90,7 +90,7 @@ async function findTestFiles(directory: string): Promise<string[]> {
90
90
  async function getChangedFiles(baseCommit: string): Promise<Set<string>> {
91
91
  // Get changed files from git
92
92
  const { stdout: gitOutput } = await execAsync(
93
- `git diff --name-only ${baseCommit}`
93
+ `git diff --name-only ${baseCommit}`,
94
94
  );
95
95
 
96
96
  // Convert to set of absolute paths
@@ -19,12 +19,12 @@ export function dedent(
19
19
  ...values: any[]
20
20
  ): string {
21
21
  // Combine the template strings and values
22
- let result = strings.reduce((acc, str, i) => {
22
+ const result = strings.reduce((acc, str, i) => {
23
23
  return acc + str + (values[i] !== undefined ? values[i] : "");
24
24
  }, "");
25
25
 
26
26
  // Split into lines
27
- let lines = result.split("\n");
27
+ const lines = result.split("\n");
28
28
 
29
29
  // Remove ALL leading blank/whitespace-only lines
30
30
  while (lines.length > 0 && lines[0].trim() === "") {
@@ -48,11 +48,11 @@ export function dedent(
48
48
  const indent = line.match(/^[ \t]*/)?.[0].length || 0;
49
49
  // Handle potentially infinite min if all lines are blank (though handled by early return)
50
50
  return indent < min ? indent : min;
51
- }, Infinity);
51
+ }, Number.POSITIVE_INFINITY);
52
52
 
53
53
  // If minIndent remains Infinity (only blank lines existed), return empty string.
54
54
  // This case should be caught by the lines.length check above, but belt-and-suspenders.
55
- if (minIndent === Infinity) {
55
+ if (minIndent === Number.POSITIVE_INFINITY) {
56
56
  return "";
57
57
  }
58
58
 
package/src/web/astro.ts CHANGED
@@ -196,7 +196,7 @@ export const AstroProject = Resource(
196
196
  async function (
197
197
  this: Context<AstroProject>,
198
198
  id: string,
199
- props: AstroProjectProps
199
+ props: AstroProjectProps,
200
200
  ): Promise<AstroProject> {
201
201
  const dir = props.dir ?? props.name;
202
202
 
@@ -394,7 +394,7 @@ export const AstroProject = Resource(
394
394
  export default defineConfig({${integrationsStr}${vitePluginsStr}
395
395
  site: "https://example.com",
396
396
  output: "static"
397
- });`
397
+ });`,
398
398
  );
399
399
  }
400
400
 
@@ -425,14 +425,14 @@ pnpm-debug.log*
425
425
  # macOS-specific files
426
426
  .DS_Store
427
427
  .astro/
428
- `
428
+ `,
429
429
  );
430
430
 
431
431
  // Create .env.d.ts
432
432
  await StaticTextFile(
433
433
  path.join(dir, "src", "env.d.ts"),
434
434
  `/// <reference types="astro/client" />
435
- `
435
+ `,
436
436
  );
437
437
 
438
438
  // Create a basic layout
@@ -476,7 +476,7 @@ const { title, description = "Welcome to my Astro site" } = Astro.props;
476
476
  Bitstream Vera Sans Mono, Courier New, monospace;
477
477
  }
478
478
  </style>
479
- `
479
+ `,
480
480
  );
481
481
 
482
482
  // Create a basic index page
@@ -530,7 +530,7 @@ import Layout from '../layouts/Layout.astro';
530
530
  padding: 0.3em 0.45em;
531
531
  }
532
532
  </style>
533
- `
533
+ `,
534
534
  );
535
535
 
536
536
  // Create public/favicon.svg
@@ -546,7 +546,7 @@ import Layout from '../layouts/Layout.astro';
546
546
  </linearGradient>
547
547
  </defs>
548
548
  </svg>
549
- `
549
+ `,
550
550
  );
551
551
  }
552
552
 
@@ -588,7 +588,7 @@ import Layout from '../layouts/Layout.astro';
588
588
  `@tailwind base;
589
589
  @tailwind components;
590
590
  @tailwind utilities;
591
- `
591
+ `,
592
592
  );
593
593
  break;
594
594
  case "mdx":
@@ -618,7 +618,7 @@ import Layout from '../layouts/Layout.astro';
618
618
  const exec = (command: string) => execAsync(command, { cwd });
619
619
 
620
620
  // Install Astro and general dependencies
621
- await exec(`bun add astro`);
621
+ await exec("bun add astro");
622
622
 
623
623
  // Install dev dependencies
624
624
  const devDepsEntries = Object.entries(props.devDependencies || {});
@@ -638,5 +638,5 @@ import Layout from '../layouts/Layout.astro';
638
638
  await exec(`bun add ${depsArg}`);
639
639
  }
640
640
  }
641
- }
641
+ },
642
642
  );
@@ -44,13 +44,13 @@ export const ShadcnComponent = Resource(
44
44
  async function (
45
45
  this: Context<ShadcnComponent>,
46
46
  id: string,
47
- props: ShadcnComponentProps
47
+ props: ShadcnComponentProps,
48
48
  ): Promise<ShadcnComponent> {
49
49
  if (this.phase === "delete") {
50
50
  await ignore("ENOENT", () =>
51
51
  fs.unlink(
52
- path.join(props.cwd, "src", "components", "ui", `${props.name}.tsx`)
53
- )
52
+ path.join(props.cwd, "src", "components", "ui", `${props.name}.tsx`),
53
+ ),
54
54
  );
55
55
  return this.destroy();
56
56
  }
@@ -68,5 +68,5 @@ export const ShadcnComponent = Resource(
68
68
  await execAsync(addCommand, { cwd: props.cwd });
69
69
 
70
70
  return this(props);
71
- }
71
+ },
72
72
  );
package/src/web/shadcn.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { exec } from "child_process";
1
+ import { exec } from "node:child_process";
2
2
  import path from "node:path";
3
3
  import { promisify } from "node:util";
4
4
  import type { Context } from "../context.js";
@@ -121,14 +121,14 @@ export const ShadcnUI = Resource(
121
121
  async function (
122
122
  this: Context<ShadcnUI>,
123
123
  id: string,
124
- props: ShadcnUIProps
124
+ props: ShadcnUIProps,
125
125
  ): Promise<ShadcnUI> {
126
126
  if (this.phase === "delete") {
127
127
  // For a delete phase, we don't perform any action
128
128
  // as removing Shadcn UI would require removing many files
129
129
  // which could be destructive to the project
130
130
  console.log(
131
- "Note: ShadcnUI delete phase does not remove installed components"
131
+ "Note: ShadcnUI delete phase does not remove installed components",
132
132
  );
133
133
 
134
134
  return this.destroy();
@@ -139,11 +139,11 @@ export const ShadcnUI = Resource(
139
139
 
140
140
  // Ensure React is installed if not already
141
141
  if (!props.react) {
142
- await exec(`bun add react react-dom`);
142
+ await exec("bun add react react-dom");
143
143
  }
144
144
 
145
145
  // Install shadcn dependencies
146
- await exec(`bun add -D @types/node`);
146
+ await exec("bun add -D @types/node");
147
147
 
148
148
  // Create components.json directly instead of running shadcn init
149
149
  await StaticJsonFile(path.join(props.cwd, "components.json"), {
@@ -172,15 +172,15 @@ export const ShadcnUI = Resource(
172
172
  props.cwd,
173
173
  props.srcDir !== false ? "src" : "",
174
174
  "components",
175
- "ui"
176
- )
175
+ "ui",
176
+ ),
177
177
  );
178
178
 
179
179
  // Create lib directory
180
180
  const libPath = path.join(
181
181
  props.cwd,
182
182
  props.srcDir !== false ? "src" : "",
183
- "lib"
183
+ "lib",
184
184
  );
185
185
  const lib = await Folder(libPath);
186
186
 
@@ -197,7 +197,7 @@ export const ShadcnUI = Resource(
197
197
  await StaticTypeScriptFile(path.join(libPath, "utils.ts"), utilsContent);
198
198
 
199
199
  // Install clsx and tailwind-merge
200
- await exec(`bun add clsx tailwind-merge`);
200
+ await exec("bun add clsx tailwind-merge");
201
201
 
202
202
  // Install requested components
203
203
  if (props.components && props.components.length > 0) {
@@ -216,5 +216,5 @@ export const ShadcnUI = Resource(
216
216
  ui,
217
217
  lib,
218
218
  });
219
- }
219
+ },
220
220
  );
@@ -82,7 +82,7 @@ export const TailwindConfig = Resource(
82
82
  async function (
83
83
  this: Context<TailwindConfig>,
84
84
  id: string,
85
- props: TailwindConfigProps
85
+ props: TailwindConfigProps,
86
86
  ): Promise<TailwindConfig> {
87
87
  if (this.phase === "delete") {
88
88
  // Nothing to clean up specifically for Tailwind
@@ -139,7 +139,6 @@ export const TailwindConfig = Resource(
139
139
  return ["@astrojs/tailwind"];
140
140
  case "next":
141
141
  return [];
142
- case "standalone":
143
142
  default:
144
143
  return [];
145
144
  }
@@ -164,5 +163,5 @@ export const TailwindConfig = Resource(
164
163
  // Create CSS file with Tailwind directives
165
164
  await StaticTextFile(cssPath, tailwindDirectives);
166
165
  }
167
- }
166
+ },
168
167
  );
package/src/web/vite.ts CHANGED
@@ -138,7 +138,7 @@ export const ViteProject = Resource(
138
138
  async function (
139
139
  this: Context<ViteProject>,
140
140
  id: string,
141
- props: ViteProjectProps
141
+ props: ViteProjectProps,
142
142
  ): Promise<ViteProject> {
143
143
  const phase = this.phase;
144
144
  if (this.phase === "delete") {
@@ -157,7 +157,7 @@ export const ViteProject = Resource(
157
157
  await modifyConfig(props);
158
158
  } else {
159
159
  console.warn(
160
- "ViteProject does not support updates - the project must be recreated to change the template"
160
+ "ViteProject does not support updates - the project must be recreated to change the template",
161
161
  );
162
162
  }
163
163
  } else {
@@ -211,7 +211,7 @@ export const ViteProject = Resource(
211
211
 
212
212
  async function build() {
213
213
  // tsc -b will fail if we have not invoked tan stacks' code gen
214
- await execAsync(`bun vite build`, { cwd: props.name });
214
+ await execAsync("bun vite build", { cwd: props.name });
215
215
  }
216
216
 
217
217
  async function installTailwind() {
@@ -236,7 +236,7 @@ export default defineConfig({
236
236
  "@": path.resolve(__dirname, "./src"),
237
237
  },
238
238
  },
239
- });`
239
+ });`,
240
240
  );
241
241
  }
242
242
 
@@ -272,9 +272,9 @@ export default defineConfig({
272
272
  }
273
273
 
274
274
  async function installTanstack() {
275
- await exec(`bun add @tanstack/react-router`);
275
+ await exec("bun add @tanstack/react-router");
276
276
  await exec(
277
- `bun add -D @tanstack/router-plugin @tanstack/react-router-devtools`
277
+ "bun add -D @tanstack/router-plugin @tanstack/react-router-devtools",
278
278
  );
279
279
 
280
280
  const src = path.join(props.name, "src");
@@ -308,7 +308,7 @@ export const Route = createRootRoute({
308
308
  </div>
309
309
  ),
310
310
  });
311
- `
311
+ `,
312
312
  );
313
313
 
314
314
  // Create index route file
@@ -326,7 +326,7 @@ function Index() {
326
326
  <h3>Welcome Home!</h3>
327
327
  </div>
328
328
  )
329
- }`
329
+ }`,
330
330
  );
331
331
 
332
332
  // Create about route file
@@ -340,7 +340,7 @@ export const Route = createLazyFileRoute('/about')({
340
340
 
341
341
  function About() {
342
342
  return <div className="p-2">Hello from About!</div>
343
- }`
343
+ }`,
344
344
  );
345
345
 
346
346
  // Create main.tsx
@@ -373,7 +373,7 @@ if (!rootElement.innerHTML) {
373
373
  <RouterProvider router={router} />
374
374
  </StrictMode>,
375
375
  )
376
- }`
376
+ }`,
377
377
  );
378
378
  }
379
379
 
@@ -402,5 +402,5 @@ if (!rootElement.innerHTML) {
402
402
  });
403
403
  }
404
404
  }
405
- }
405
+ },
406
406
  );