alchemy 0.75.0 → 0.75.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/alchemy.js +25 -25
- package/bin/commands/util.ts +3 -1
- package/bin/services/execute-alchemy.ts +4 -2
- package/bin/services/github-workflow.ts +2 -3
- package/bin/services/package-manager.ts +1 -5
- package/lib/alchemy.d.ts +1 -1
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js +1 -1
- package/lib/alchemy.js.map +1 -1
- package/lib/apply.js +10 -0
- package/lib/apply.js.map +1 -1
- package/lib/aws/control/types.d.ts.map +1 -1
- package/lib/aws/control/types.js.map +1 -1
- package/lib/clickhouse/api/sdk.gen.d.ts.map +1 -1
- package/lib/clickhouse/api/sdk.gen.js.map +1 -1
- package/lib/cloudflare/account-api-token.d.ts.map +1 -1
- package/lib/cloudflare/account-api-token.js.map +1 -1
- package/lib/cloudflare/bound.d.ts.map +1 -1
- package/lib/cloudflare/bucket.d.ts +1 -1
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js +1 -1
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/cloudflare-env-proxy.d.ts.map +1 -1
- package/lib/cloudflare/cloudflare-env-proxy.js +3 -3
- package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
- package/lib/cloudflare/dns-records.js.map +1 -1
- package/lib/cloudflare/miniflare/delete.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/delete.js +3 -0
- package/lib/cloudflare/miniflare/delete.js.map +1 -1
- package/lib/cloudflare/miniflare/paths.d.ts +0 -1
- package/lib/cloudflare/miniflare/paths.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/paths.js +4 -17
- package/lib/cloudflare/miniflare/paths.js.map +1 -1
- package/lib/cloudflare/nuxt/plugin.d.ts.map +1 -1
- package/lib/cloudflare/nuxt/plugin.js +2 -2
- package/lib/cloudflare/nuxt/plugin.js.map +1 -1
- package/lib/cloudflare/react-router/plugin.d.ts.map +1 -1
- package/lib/cloudflare/react-router/plugin.js +0 -1
- package/lib/cloudflare/react-router/plugin.js.map +1 -1
- package/lib/cloudflare/vite/plugin.d.ts.map +1 -1
- package/lib/cloudflare/vite/plugin.js +3 -3
- package/lib/cloudflare/vite/plugin.js.map +1 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +0 -4
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-assets.d.ts +1 -1
- package/lib/cloudflare/worker-assets.d.ts.map +1 -1
- package/lib/cloudflare/worker-assets.js +1 -1
- package/lib/cloudflare/worker-assets.js.map +1 -1
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker-tail.d.ts.map +1 -1
- package/lib/cloudflare/worker-tail.js.map +1 -1
- package/lib/cloudflare/wrangler.json.js +0 -1
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/coinbase/evm-account.d.ts.map +1 -1
- package/lib/coinbase/evm-account.js.map +1 -1
- package/lib/coinbase/evm-smart-account.d.ts.map +1 -1
- package/lib/coinbase/evm-smart-account.js.map +1 -1
- package/lib/docker/api.d.ts.map +1 -1
- package/lib/docker/api.js.map +1 -1
- package/lib/github/secret.d.ts.map +1 -1
- package/lib/github/secret.js.map +1 -1
- package/lib/neon/api/sdk.gen.d.ts.map +1 -1
- package/lib/neon/api/sdk.gen.js.map +1 -1
- package/lib/os/exec.d.ts.map +1 -1
- package/lib/os/exec.js.map +1 -1
- package/lib/planetscale/api/sdk.gen.d.ts.map +1 -1
- package/lib/planetscale/api/sdk.gen.js.map +1 -1
- package/lib/prisma-postgres/api/sdk.gen.d.ts.map +1 -1
- package/lib/prisma-postgres/api/sdk.gen.js.map +1 -1
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +2 -2
- package/lib/scope.js.map +1 -1
- package/lib/sentry/client-key.js +1 -1
- package/lib/sentry/client-key.js.map +1 -1
- package/lib/test/bun.d.ts.map +1 -1
- package/lib/test/bun.js.map +1 -1
- package/lib/test/vitest.d.ts.map +1 -1
- package/lib/test/vitest.js.map +1 -1
- package/lib/util/api/client/client.gen.d.ts +1 -1
- package/lib/util/api/client/client.gen.js +45 -45
- package/lib/util/api/client/types.gen.d.ts +22 -22
- package/lib/util/api/client/utils.gen.d.ts +3 -3
- package/lib/util/api/client/utils.gen.d.ts.map +1 -1
- package/lib/util/api/client/utils.gen.js +34 -34
- package/lib/util/api/client/utils.gen.js.map +1 -1
- package/lib/util/api/core/auth.gen.d.ts +3 -3
- package/lib/util/api/core/auth.gen.js +3 -3
- package/lib/util/api/core/bodySerializer.gen.d.ts +1 -1
- package/lib/util/api/core/bodySerializer.gen.js +3 -3
- package/lib/util/api/core/params.gen.d.ts +3 -3
- package/lib/util/api/core/params.gen.js +7 -7
- package/lib/util/api/core/pathSerializer.gen.d.ts +3 -3
- package/lib/util/api/core/pathSerializer.gen.js +36 -36
- package/lib/util/api/core/serverSentEvents.gen.d.ts +3 -3
- package/lib/util/api/core/serverSentEvents.gen.js +18 -18
- package/lib/util/api/core/types.gen.d.ts +4 -4
- package/lib/util/api/core/utils.gen.d.ts +1 -1
- package/lib/util/api/core/utils.gen.js +17 -17
- package/lib/util/camel-to-snake.d.ts.map +1 -1
- package/lib/util/find-workspace-root.d.ts +3 -0
- package/lib/util/find-workspace-root.d.ts.map +1 -0
- package/lib/util/find-workspace-root.js +64 -0
- package/lib/util/find-workspace-root.js.map +1 -0
- package/lib/util/idempotent-spawn.d.ts.map +1 -1
- package/lib/util/idempotent-spawn.js +1 -1
- package/lib/util/idempotent-spawn.js.map +1 -1
- package/lib/util/peer.d.ts.map +1 -1
- package/lib/util/peer.js.map +1 -1
- package/package.json +1 -1
- package/src/alchemy.ts +4 -3
- package/src/apply.ts +16 -1
- package/src/aws/control/types.ts +87107 -85281
- package/src/clickhouse/api/sdk.gen.ts +1 -3
- package/src/cloudflare/account-api-token.ts +3 -1
- package/src/cloudflare/bound.ts +64 -65
- package/src/cloudflare/bucket.ts +4 -7
- package/src/cloudflare/cloudflare-env-proxy.ts +2 -4
- package/src/cloudflare/dns-records.ts +3 -1
- package/src/cloudflare/miniflare/delete.ts +3 -0
- package/src/cloudflare/miniflare/paths.ts +4 -25
- package/src/cloudflare/nuxt/plugin.ts +1 -4
- package/src/cloudflare/react-router/plugin.ts +0 -1
- package/src/cloudflare/vite/plugin.ts +1 -3
- package/src/cloudflare/website.ts +0 -5
- package/src/cloudflare/worker-assets.ts +1 -6
- package/src/cloudflare/worker-metadata.ts +5 -3
- package/src/cloudflare/worker-tail.ts +3 -1
- package/src/cloudflare/wrangler.json.ts +0 -1
- package/src/coinbase/evm-account.ts +3 -1
- package/src/coinbase/evm-smart-account.ts +3 -1
- package/src/docker/api.ts +3 -1
- package/src/github/secret.ts +5 -1
- package/src/neon/api/sdk.gen.ts +1 -3
- package/src/os/exec.ts +3 -1
- package/src/planetscale/api/sdk.gen.ts +1 -3
- package/src/prisma-postgres/api/sdk.gen.ts +1 -3
- package/src/scope.ts +2 -2
- package/src/sentry/client-key.ts +1 -5
- package/src/test/bun.ts +3 -1
- package/src/test/vitest.ts +3 -1
- package/src/util/api/client/client.gen.ts +49 -49
- package/src/util/api/client/types.gen.ts +43 -43
- package/src/util/api/client/utils.gen.ts +47 -42
- package/src/util/api/core/auth.gen.ts +6 -6
- package/src/util/api/core/bodySerializer.gen.ts +4 -4
- package/src/util/api/core/params.gen.ts +10 -10
- package/src/util/api/core/pathSerializer.gen.ts +39 -39
- package/src/util/api/core/serverSentEvents.gen.ts +22 -22
- package/src/util/api/core/types.gen.ts +12 -12
- package/src/util/api/core/utils.gen.ts +18 -18
- package/src/util/camel-to-snake.ts +12 -10
- package/{bin/services → src/util}/find-workspace-root.ts +26 -4
- package/src/util/idempotent-spawn.ts +1 -5
- package/src/util/peer.ts +3 -1
- package/templates/astro/astro.config.mjs +3 -3
- package/templates/astro/src/pages/api/hello.ts +16 -13
- package/templates/bun-spa/bun-env.d.ts +0 -1
- package/templates/bun-spa/eslint.config.js +11 -12
- package/templates/bun-spa/src/App.tsx +0 -1
- package/templates/bun-spa/src/frontend.tsx +0 -1
- package/templates/hono/src/index.ts +13 -13
- package/templates/nextjs/alchemy.run.ts +1 -1
- package/templates/nextjs/eslint.config.mjs +1 -1
- package/templates/nextjs/next-env.d.ts +1 -1
- package/templates/nextjs/next.config.ts +1 -1
- package/templates/nextjs/open-next.config.ts +1 -1
- package/templates/nextjs/src/app/api/hello/route.ts +2 -2
- package/templates/nextjs/src/app/layout.tsx +1 -1
- package/templates/nextjs/src/app/page.tsx +14 -15
- package/templates/nextjs/types/env.d.ts +4 -4
- package/templates/nuxt/server/middleware/auth.ts +1 -1
- package/templates/nuxt/server/middleware/hello.ts +2 -2
- package/templates/react-router/app/entry.server.tsx +2 -2
- package/templates/react-router/vite.config.ts +1 -1
- package/templates/react-router/workers/app.ts +2 -2
- package/templates/rwsdk/alchemy.run.ts +6 -3
- package/templates/sveltekit/src/app.d.ts +7 -7
- package/templates/sveltekit/svelte.config.js +4 -4
- package/templates/sveltekit/vite.config.ts +3 -3
- package/templates/tanstack-start/src/components/Header.tsx +2 -2
- package/templates/tanstack-start/src/router.tsx +4 -4
- package/templates/tanstack-start/src/routes/__root.tsx +10 -10
- package/templates/tanstack-start/src/routes/api.demo-names.ts +6 -6
- package/templates/tanstack-start/src/routes/demo.start.api-request.tsx +11 -11
- package/templates/tanstack-start/src/routes/demo.start.server-funcs.tsx +30 -30
- package/templates/tanstack-start/src/routes/index.tsx +5 -5
- package/templates/tanstack-start/vite.config.ts +9 -9
- package/templates/typescript/src/worker.ts +5 -1
- package/templates/vite/eslint.config.js +12 -12
- package/templates/vite/src/App.tsx +7 -7
- package/templates/vite/src/main.tsx +6 -6
- package/templates/vite/src/worker.ts +11 -12
- package/templates/vite/vite.config.ts +2 -2
- package/workers/tunnel-proxy.js +1 -1
- package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts +0 -2
- package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts.map +0 -1
- package/lib/cloudflare/miniflare/symlink-miniflare-state.js +0 -18
- package/lib/cloudflare/miniflare/symlink-miniflare-state.js.map +0 -1
- 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 ${
|
|
363
|
+
`Error ${
|
|
364
|
+
this.phase === "update" ? "updating" : "creating"
|
|
365
|
+
} token '${tokenName}': ${
|
|
364
366
|
errorData.errors?.[0]?.message || response.statusText
|
|
365
367
|
}`,
|
|
366
368
|
);
|
package/src/cloudflare/bound.ts
CHANGED
|
@@ -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> =
|
|
41
|
-
infer O
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
|
51
|
-
?
|
|
52
|
-
: T extends
|
|
53
|
-
?
|
|
54
|
-
: T extends
|
|
55
|
-
?
|
|
56
|
-
: T extends
|
|
57
|
-
?
|
|
58
|
-
: T extends
|
|
59
|
-
?
|
|
60
|
-
: T extends
|
|
61
|
-
?
|
|
62
|
-
: T extends
|
|
63
|
-
?
|
|
64
|
-
: T extends
|
|
65
|
-
?
|
|
66
|
-
: T extends
|
|
67
|
-
?
|
|
68
|
-
: T extends
|
|
69
|
-
?
|
|
70
|
-
: T extends
|
|
71
|
-
?
|
|
72
|
-
: T extends
|
|
73
|
-
?
|
|
74
|
-
: T extends
|
|
75
|
-
?
|
|
76
|
-
: T extends
|
|
77
|
-
?
|
|
78
|
-
: T extends
|
|
79
|
-
?
|
|
80
|
-
: T extends
|
|
81
|
-
?
|
|
82
|
-
: T extends
|
|
83
|
-
?
|
|
84
|
-
: T extends
|
|
85
|
-
?
|
|
86
|
-
: T extends
|
|
87
|
-
?
|
|
88
|
-
: T extends
|
|
89
|
-
?
|
|
90
|
-
: T extends
|
|
91
|
-
?
|
|
92
|
-
: T extends
|
|
93
|
-
?
|
|
94
|
-
: T extends
|
|
95
|
-
?
|
|
96
|
-
: T extends
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
:
|
|
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;
|
package/src/cloudflare/bucket.ts
CHANGED
|
@@ -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${
|
|
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:
|
|
24
|
+
path:
|
|
26
25
|
typeof input.persist === "object" &&
|
|
27
|
-
|
|
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 =
|
|
@@ -314,7 +314,9 @@ async function createOrUpdateRecord(
|
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
throw new Error(
|
|
317
|
-
`Failed to ${
|
|
317
|
+
`Failed to ${
|
|
318
|
+
existingId ? "update" : "create"
|
|
319
|
+
} DNS record ${record.name}: ${response.statusText}\nResponse: ${errorBody}`,
|
|
318
320
|
);
|
|
319
321
|
}
|
|
320
322
|
|
|
@@ -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
|
|
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
|
-
|
|
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:
|
|
19
|
-
options.dev?.persistDir ?? getDefaultPersistPath(),
|
|
20
|
-
),
|
|
17
|
+
persistDir: options.dev?.persistDir ?? getDefaultPersistPath(),
|
|
21
18
|
...options.dev,
|
|
22
19
|
},
|
|
23
20
|
...options,
|
|
@@ -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:
|
|
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 (
|
|
243
|
-
|
|
244
|
-
|
|
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(">")} ${
|
|
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) {
|
|
@@ -207,7 +207,9 @@ export const EvmAccount = Resource(
|
|
|
207
207
|
);
|
|
208
208
|
|
|
209
209
|
console.log(
|
|
210
|
-
`💧 Requested ${toFund.length} new faucet fund${
|
|
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${
|
|
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: ${
|
|
162
|
+
`Docker daemon not running: ${
|
|
163
|
+
error instanceof Error ? error.message : String(error)
|
|
164
|
+
}`,
|
|
163
165
|
);
|
|
164
166
|
return false;
|
|
165
167
|
}
|
package/src/github/secret.ts
CHANGED
|
@@ -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 ${
|
|
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 {
|
package/src/neon/api/sdk.gen.ts
CHANGED
|
@@ -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
|
@@ -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
|
}
|
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 =
|
|
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();
|
package/src/sentry/client-key.ts
CHANGED
|
@@ -340,11 +340,7 @@ async function findClientKeyByName(
|
|
|
340
340
|
*/
|
|
341
341
|
async function getClientKeyName(
|
|
342
342
|
api: SentryApi,
|
|
343
|
-
{
|
|
344
|
-
organization,
|
|
345
|
-
project,
|
|
346
|
-
keyId,
|
|
347
|
-
}: {
|
|
343
|
+
{ organization, project, keyId }: {
|
|
348
344
|
organization: string;
|
|
349
345
|
project: string;
|
|
350
346
|
keyId: string;
|
package/src/test/bun.ts
CHANGED
|
@@ -98,7 +98,9 @@ export function test(meta: ImportMeta, defaultOptions?: TestOptions): test {
|
|
|
98
98
|
// Create local test scope based on filename
|
|
99
99
|
const scope = new Scope({
|
|
100
100
|
parent: undefined,
|
|
101
|
-
scopeName: `${
|
|
101
|
+
scopeName: `${
|
|
102
|
+
defaultOptions.prefix ? `${defaultOptions.prefix}-` : ""
|
|
103
|
+
}${path.basename(meta.filename)}`,
|
|
102
104
|
// parent: globalTestScope,
|
|
103
105
|
stateStore: defaultOptions?.stateStore,
|
|
104
106
|
phase: "up",
|
package/src/test/vitest.ts
CHANGED
|
@@ -128,7 +128,9 @@ export function test(
|
|
|
128
128
|
|
|
129
129
|
const scope = new Scope({
|
|
130
130
|
parent: undefined,
|
|
131
|
-
scopeName: `${
|
|
131
|
+
scopeName: `${
|
|
132
|
+
defaultOptions.prefix ? `${defaultOptions.prefix}-` : ""
|
|
133
|
+
}${path.basename(meta.filename)}`,
|
|
132
134
|
stateStore: defaultOptions?.stateStore,
|
|
133
135
|
phase: "up",
|
|
134
136
|
noTrack: true,
|