alchemy 0.22.4 → 0.23.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.
- package/lib/aws/bucket.d.ts.map +1 -1
- package/lib/aws/bucket.js +13 -12
- package/lib/aws/bucket.js.map +1 -1
- package/lib/aws/control/client.d.ts.map +1 -1
- package/lib/aws/control/client.js +5 -3
- package/lib/aws/control/client.js.map +1 -1
- package/lib/aws/control/resource.d.ts.map +1 -1
- package/lib/aws/control/resource.js +13 -4
- package/lib/aws/control/resource.js.map +1 -1
- package/lib/aws/control/types.d.ts +85129 -0
- package/lib/aws/function.d.ts.map +1 -1
- package/lib/aws/function.js +51 -42
- package/lib/aws/function.js.map +1 -1
- package/lib/aws/index.d.ts +1 -0
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +1 -0
- package/lib/aws/index.js.map +1 -1
- package/lib/aws/policy-attachment.d.ts.map +1 -1
- package/lib/aws/policy-attachment.js +5 -4
- package/lib/aws/policy-attachment.js.map +1 -1
- package/lib/aws/policy.d.ts.map +1 -1
- package/lib/aws/policy.js +21 -20
- package/lib/aws/policy.js.map +1 -1
- package/lib/aws/queue.d.ts.map +1 -1
- package/lib/aws/queue.js +19 -15
- package/lib/aws/queue.js.map +1 -1
- package/lib/aws/retry.d.ts +5 -0
- package/lib/aws/retry.d.ts.map +1 -0
- package/lib/aws/retry.js +27 -0
- package/lib/aws/retry.js.map +1 -0
- package/lib/aws/role.d.ts.map +1 -1
- package/lib/aws/role.js +31 -30
- package/lib/aws/role.js.map +1 -1
- package/lib/aws/ses.d.ts.map +1 -1
- package/lib/aws/ses.js +27 -26
- package/lib/aws/ses.js.map +1 -1
- package/lib/aws/ssm-parameter.d.ts +150 -0
- package/lib/aws/ssm-parameter.d.ts.map +1 -0
- package/lib/aws/ssm-parameter.js +184 -0
- package/lib/aws/ssm-parameter.js.map +1 -0
- package/lib/aws/table.d.ts.map +1 -1
- package/lib/aws/table.js +9 -27
- package/lib/aws/table.js.map +1 -1
- package/lib/cloudflare/account-id.d.ts +1 -0
- package/lib/cloudflare/account-id.d.ts.map +1 -1
- package/lib/cloudflare/account-id.js.map +1 -1
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +22 -2
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/index.d.ts +2 -1
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +2 -1
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/queue.d.ts.map +1 -1
- package/lib/cloudflare/queue.js +1 -0
- package/lib/cloudflare/queue.js.map +1 -1
- package/lib/cloudflare/route.d.ts +7 -0
- package/lib/cloudflare/route.d.ts.map +1 -1
- package/lib/cloudflare/route.js +44 -2
- package/lib/cloudflare/route.js.map +1 -1
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
- package/lib/cloudflare/worker-metadata.js +1 -2
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker.d.ts +2 -1
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +17 -8
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/workflow.d.ts +7 -0
- package/lib/cloudflare/workflow.d.ts.map +1 -1
- package/lib/cloudflare/workflow.js +2 -0
- package/lib/cloudflare/workflow.js.map +1 -1
- package/lib/cloudflare/wrangler.json.d.ts +1 -0
- package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
- package/lib/cloudflare/wrangler.json.js +1 -0
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/destroy.js +1 -1
- package/lib/destroy.js.map +1 -1
- package/lib/dns/godaddy.d.ts.map +1 -1
- package/lib/dns/godaddy.js +2 -1
- package/lib/dns/godaddy.js.map +1 -1
- package/lib/fs/file-system-state-store.d.ts.map +1 -1
- package/lib/fs/file-system-state-store.js +14 -2
- package/lib/fs/file-system-state-store.js.map +1 -1
- package/lib/github/secret.d.ts.map +1 -1
- package/lib/github/secret.js +1 -0
- package/lib/github/secret.js.map +1 -1
- package/lib/neon/api.d.ts.map +1 -1
- package/lib/neon/api.js +2 -1
- package/lib/neon/api.js.map +1 -1
- package/lib/runtime/shims.d.ts +6 -0
- package/lib/runtime/shims.d.ts.map +1 -0
- package/lib/runtime/shims.js +27 -0
- package/lib/runtime/shims.js.map +1 -0
- package/lib/sentry/api.d.ts.map +1 -1
- package/lib/sentry/api.js +2 -1
- package/lib/sentry/api.js.map +1 -1
- package/lib/test/bun.d.ts.map +1 -1
- package/lib/test/bun.js +1 -7
- package/lib/test/bun.js.map +1 -1
- package/lib/test/prune.d.ts +2 -1
- package/lib/test/prune.d.ts.map +1 -1
- package/lib/test/prune.js +29 -5
- package/lib/test/prune.js.map +1 -1
- package/lib/test/vitest.d.ts +92 -0
- package/lib/test/vitest.d.ts.map +1 -0
- package/lib/test/vitest.js +94 -0
- package/lib/test/vitest.js.map +1 -0
- package/lib/upstash/api.d.ts.map +1 -1
- package/lib/upstash/api.js +2 -1
- package/lib/upstash/api.js.map +1 -1
- package/lib/util/retry.js +2 -2
- package/lib/util/retry.js.map +1 -1
- package/lib/util/safe-fetch.d.ts +2 -0
- package/lib/util/safe-fetch.d.ts.map +1 -0
- package/lib/util/safe-fetch.js +48 -0
- package/lib/util/safe-fetch.js.map +1 -0
- package/lib/vercel/api.d.ts.map +1 -1
- package/lib/vercel/api.js +2 -1
- package/lib/vercel/api.js.map +1 -1
- package/lib/web/vitepress/process-front-matter-files.d.ts.map +1 -1
- package/lib/web/vitepress/process-front-matter-files.js +11 -7
- package/lib/web/vitepress/process-front-matter-files.js.map +1 -1
- package/package.json +10 -6
- package/src/alchemy.ts +2 -2
- package/src/aws/bucket.ts +55 -36
- package/src/aws/control/client.ts +13 -13
- package/src/aws/control/resource.ts +19 -3
- package/src/aws/function.ts +233 -178
- package/src/aws/index.ts +1 -0
- package/src/aws/policy-attachment.ts +15 -10
- package/src/aws/policy.ts +75 -54
- package/src/aws/queue.ts +53 -36
- package/src/aws/retry.ts +38 -0
- package/src/aws/role.ts +121 -90
- package/src/aws/ses.ts +101 -73
- package/src/aws/ssm-parameter.ts +315 -0
- package/src/aws/table.ts +61 -90
- package/src/cloudflare/account-id.ts +2 -0
- package/src/cloudflare/api.ts +26 -3
- package/src/cloudflare/index.ts +2 -1
- package/src/cloudflare/queue.ts +2 -0
- package/src/cloudflare/route.ts +86 -2
- package/src/cloudflare/worker-metadata.ts +1 -2
- package/src/cloudflare/worker.ts +21 -9
- package/src/cloudflare/workflow.ts +8 -0
- package/src/cloudflare/wrangler.json.ts +8 -1
- package/src/destroy.ts +1 -1
- package/src/dns/godaddy.ts +3 -1
- package/src/fs/file-system-state-store.ts +16 -2
- package/src/github/secret.ts +2 -0
- package/src/neon/api.ts +2 -1
- package/src/sentry/api.ts +2 -1
- package/src/test/bun.ts +1 -7
- package/src/test/prune.ts +31 -4
- package/src/test/vitest.ts +209 -0
- package/src/upstash/api.ts +2 -1
- package/src/util/retry.ts +3 -3
- package/src/util/safe-fetch.ts +61 -0
- package/src/vercel/api.ts +2 -1
- package/src/web/vitepress/process-front-matter-files.ts +15 -7
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Agent } from "undici";
|
|
2
|
+
|
|
3
|
+
export async function safeFetch(
|
|
4
|
+
url: string | URL | Request,
|
|
5
|
+
options: RequestInit = {},
|
|
6
|
+
retries = 3,
|
|
7
|
+
) {
|
|
8
|
+
let latestErr: any;
|
|
9
|
+
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
10
|
+
try {
|
|
11
|
+
return await fetch(url, {
|
|
12
|
+
...options,
|
|
13
|
+
// Type assertion to work around Cloudflare Workers type definitions
|
|
14
|
+
dispatcher: await dispatcher(),
|
|
15
|
+
} as RequestInit);
|
|
16
|
+
} catch (err: any) {
|
|
17
|
+
latestErr = err;
|
|
18
|
+
const shouldRetry =
|
|
19
|
+
err?.code === "UND_ERR_SOCKET" ||
|
|
20
|
+
err?.code === "ECONNRESET" ||
|
|
21
|
+
err?.name === "FetchError";
|
|
22
|
+
|
|
23
|
+
if (!shouldRetry || attempt === retries) {
|
|
24
|
+
throw err;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
console.warn(`Retry ${attempt}/${retries} for ${url}: ${err.code}`);
|
|
28
|
+
await new Promise((r) => setTimeout(r, 250 * attempt)); // exponential backoff
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
throw latestErr;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let agent:
|
|
35
|
+
| {
|
|
36
|
+
value: Agent | undefined;
|
|
37
|
+
}
|
|
38
|
+
| undefined;
|
|
39
|
+
|
|
40
|
+
async function dispatcher() {
|
|
41
|
+
if (agent) {
|
|
42
|
+
return agent.value;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
// undici not available in all runtimes
|
|
46
|
+
const { Agent } = await import("undici");
|
|
47
|
+
|
|
48
|
+
if (!agent) {
|
|
49
|
+
// Configure agent with connection limits to avoid socket errors
|
|
50
|
+
agent = {
|
|
51
|
+
value: new Agent({
|
|
52
|
+
pipelining: 0, // Disable pipelining to avoid connection issues
|
|
53
|
+
// connections: 5, // Limit concurrent connections per host
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
agent = { value: undefined };
|
|
59
|
+
}
|
|
60
|
+
return agent.value;
|
|
61
|
+
}
|
package/src/vercel/api.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { alchemy } from "../alchemy.ts";
|
|
2
2
|
import type { Secret } from "../secret.ts";
|
|
3
|
+
import { safeFetch } from "../util/safe-fetch.ts";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Options for Vercel API requests
|
|
@@ -85,7 +86,7 @@ export class VercelApi {
|
|
|
85
86
|
delete headers["Content-Type"];
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
const response = await
|
|
89
|
+
const response = await safeFetch(`${this.baseUrl}${path}`, {
|
|
89
90
|
...init,
|
|
90
91
|
headers,
|
|
91
92
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { parse as parseYaml } from "yaml";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Process markdown files with frontmatter to generate navigation items
|
|
@@ -56,14 +57,21 @@ export async function processFrontmatterFiles(
|
|
|
56
57
|
let title;
|
|
57
58
|
|
|
58
59
|
if (frontmatterMatch) {
|
|
59
|
-
const frontmatter = frontmatterMatch[1];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const frontmatter = parseYaml(frontmatterMatch[1]);
|
|
61
|
+
|
|
62
|
+
// Parse order as a number (supports both integers and floats)
|
|
63
|
+
if (frontmatter.order !== undefined) {
|
|
64
|
+
if (typeof frontmatter.order !== "number") {
|
|
65
|
+
throw new Error(
|
|
66
|
+
`Invalid order field in ${fullPath}: expected number, got ${typeof frontmatter.order}`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
order = frontmatter.order;
|
|
63
70
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
|
|
72
|
+
// Get title from frontmatter
|
|
73
|
+
if (frontmatter.title) {
|
|
74
|
+
title = String(frontmatter.title).trim();
|
|
67
75
|
}
|
|
68
76
|
}
|
|
69
77
|
|