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
|
@@ -8,15 +8,15 @@ export interface Auth {
|
|
|
8
8
|
*
|
|
9
9
|
* @default 'header'
|
|
10
10
|
*/
|
|
11
|
-
in?:
|
|
11
|
+
in?: "header" | "query" | "cookie";
|
|
12
12
|
/**
|
|
13
13
|
* Header or query parameter name.
|
|
14
14
|
*
|
|
15
15
|
* @default 'Authorization'
|
|
16
16
|
*/
|
|
17
17
|
name?: string;
|
|
18
|
-
scheme?:
|
|
19
|
-
type:
|
|
18
|
+
scheme?: "basic" | "bearer";
|
|
19
|
+
type: "apiKey" | "http";
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const getAuthToken = async (
|
|
@@ -24,17 +24,17 @@ export const getAuthToken = async (
|
|
|
24
24
|
callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,
|
|
25
25
|
): Promise<string | undefined> => {
|
|
26
26
|
const token =
|
|
27
|
-
typeof callback ===
|
|
27
|
+
typeof callback === "function" ? await callback(auth) : callback;
|
|
28
28
|
|
|
29
29
|
if (!token) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
if (auth.scheme ===
|
|
33
|
+
if (auth.scheme === "bearer") {
|
|
34
34
|
return `Bearer ${token}`;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if (auth.scheme ===
|
|
37
|
+
if (auth.scheme === "basic") {
|
|
38
38
|
return `Basic ${btoa(token)}`;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
ArrayStyle,
|
|
5
5
|
ObjectStyle,
|
|
6
6
|
SerializerOptions,
|
|
7
|
-
} from
|
|
7
|
+
} from "./pathSerializer.gen";
|
|
8
8
|
|
|
9
9
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ const serializeFormDataPair = (
|
|
|
21
21
|
key: string,
|
|
22
22
|
value: unknown,
|
|
23
23
|
): void => {
|
|
24
|
-
if (typeof value ===
|
|
24
|
+
if (typeof value === "string" || value instanceof Blob) {
|
|
25
25
|
data.append(key, value);
|
|
26
26
|
} else if (value instanceof Date) {
|
|
27
27
|
data.append(key, value.toISOString());
|
|
@@ -35,7 +35,7 @@ const serializeUrlSearchParamsPair = (
|
|
|
35
35
|
key: string,
|
|
36
36
|
value: unknown,
|
|
37
37
|
): void => {
|
|
38
|
-
if (typeof value ===
|
|
38
|
+
if (typeof value === "string") {
|
|
39
39
|
data.append(key, value);
|
|
40
40
|
} else {
|
|
41
41
|
data.append(key, JSON.stringify(value));
|
|
@@ -66,7 +66,7 @@ export const formDataBodySerializer = {
|
|
|
66
66
|
export const jsonBodySerializer = {
|
|
67
67
|
bodySerializer: <T>(body: T): string =>
|
|
68
68
|
JSON.stringify(body, (_key, value) =>
|
|
69
|
-
typeof value ===
|
|
69
|
+
typeof value === "bigint" ? value.toString() : value,
|
|
70
70
|
),
|
|
71
71
|
};
|
|
72
72
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
|
-
type Slot =
|
|
3
|
+
type Slot = "body" | "headers" | "path" | "query";
|
|
4
4
|
|
|
5
5
|
export type Field =
|
|
6
6
|
| {
|
|
7
|
-
in: Exclude<Slot,
|
|
7
|
+
in: Exclude<Slot, "body">;
|
|
8
8
|
/**
|
|
9
9
|
* Field name. This is the name we want the user to see and use.
|
|
10
10
|
*/
|
|
@@ -16,7 +16,7 @@ export type Field =
|
|
|
16
16
|
map?: string;
|
|
17
17
|
}
|
|
18
18
|
| {
|
|
19
|
-
in: Extract<Slot,
|
|
19
|
+
in: Extract<Slot, "body">;
|
|
20
20
|
/**
|
|
21
21
|
* Key isn't required for bodies.
|
|
22
22
|
*/
|
|
@@ -32,10 +32,10 @@ export interface Fields {
|
|
|
32
32
|
export type FieldsConfig = ReadonlyArray<Field | Fields>;
|
|
33
33
|
|
|
34
34
|
const extraPrefixesMap: Record<string, Slot> = {
|
|
35
|
-
$body_:
|
|
36
|
-
$headers_:
|
|
37
|
-
$path_:
|
|
38
|
-
$query_:
|
|
35
|
+
$body_: "body",
|
|
36
|
+
$headers_: "headers",
|
|
37
|
+
$path_: "path",
|
|
38
|
+
$query_: "query",
|
|
39
39
|
};
|
|
40
40
|
const extraPrefixes = Object.entries(extraPrefixesMap);
|
|
41
41
|
|
|
@@ -53,7 +53,7 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
for (const config of fields) {
|
|
56
|
-
if (
|
|
56
|
+
if ("in" in config) {
|
|
57
57
|
if (config.key) {
|
|
58
58
|
map.set(config.key, {
|
|
59
59
|
in: config.in,
|
|
@@ -77,7 +77,7 @@ interface Params {
|
|
|
77
77
|
|
|
78
78
|
const stripEmptySlots = (params: Params) => {
|
|
79
79
|
for (const [slot, value] of Object.entries(params)) {
|
|
80
|
-
if (value && typeof value ===
|
|
80
|
+
if (value && typeof value === "object" && !Object.keys(value).length) {
|
|
81
81
|
delete params[slot as Slot];
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -107,7 +107,7 @@ export const buildClientParams = (
|
|
|
107
107
|
continue;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
if (
|
|
110
|
+
if ("in" in config) {
|
|
111
111
|
if (config.key) {
|
|
112
112
|
const field = map.get(config.key)!;
|
|
113
113
|
const name = field.map || config.key;
|
|
@@ -17,10 +17,10 @@ export interface SerializerOptions<T> {
|
|
|
17
17
|
style: T;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type ArrayStyle =
|
|
20
|
+
export type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited";
|
|
21
21
|
export type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
|
|
22
|
-
type MatrixStyle =
|
|
23
|
-
export type ObjectStyle =
|
|
22
|
+
type MatrixStyle = "label" | "matrix" | "simple";
|
|
23
|
+
export type ObjectStyle = "form" | "deepObject";
|
|
24
24
|
type ObjectSeparatorStyle = ObjectStyle | MatrixStyle;
|
|
25
25
|
|
|
26
26
|
interface SerializePrimitiveParam extends SerializePrimitiveOptions {
|
|
@@ -29,40 +29,40 @@ interface SerializePrimitiveParam extends SerializePrimitiveOptions {
|
|
|
29
29
|
|
|
30
30
|
export const separatorArrayExplode = (style: ArraySeparatorStyle) => {
|
|
31
31
|
switch (style) {
|
|
32
|
-
case
|
|
33
|
-
return
|
|
34
|
-
case
|
|
35
|
-
return
|
|
36
|
-
case
|
|
37
|
-
return
|
|
32
|
+
case "label":
|
|
33
|
+
return ".";
|
|
34
|
+
case "matrix":
|
|
35
|
+
return ";";
|
|
36
|
+
case "simple":
|
|
37
|
+
return ",";
|
|
38
38
|
default:
|
|
39
|
-
return
|
|
39
|
+
return "&";
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {
|
|
44
44
|
switch (style) {
|
|
45
|
-
case
|
|
46
|
-
return
|
|
47
|
-
case
|
|
48
|
-
return
|
|
49
|
-
case
|
|
50
|
-
return
|
|
45
|
+
case "form":
|
|
46
|
+
return ",";
|
|
47
|
+
case "pipeDelimited":
|
|
48
|
+
return "|";
|
|
49
|
+
case "spaceDelimited":
|
|
50
|
+
return "%20";
|
|
51
51
|
default:
|
|
52
|
-
return
|
|
52
|
+
return ",";
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
export const separatorObjectExplode = (style: ObjectSeparatorStyle) => {
|
|
57
57
|
switch (style) {
|
|
58
|
-
case
|
|
59
|
-
return
|
|
60
|
-
case
|
|
61
|
-
return
|
|
62
|
-
case
|
|
63
|
-
return
|
|
58
|
+
case "label":
|
|
59
|
+
return ".";
|
|
60
|
+
case "matrix":
|
|
61
|
+
return ";";
|
|
62
|
+
case "simple":
|
|
63
|
+
return ",";
|
|
64
64
|
default:
|
|
65
|
-
return
|
|
65
|
+
return "&";
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -80,11 +80,11 @@ export const serializeArrayParam = ({
|
|
|
80
80
|
allowReserved ? value : value.map((v) => encodeURIComponent(v as string))
|
|
81
81
|
).join(separatorArrayNoExplode(style));
|
|
82
82
|
switch (style) {
|
|
83
|
-
case
|
|
83
|
+
case "label":
|
|
84
84
|
return `.${joinedValues}`;
|
|
85
|
-
case
|
|
85
|
+
case "matrix":
|
|
86
86
|
return `;${name}=${joinedValues}`;
|
|
87
|
-
case
|
|
87
|
+
case "simple":
|
|
88
88
|
return joinedValues;
|
|
89
89
|
default:
|
|
90
90
|
return `${name}=${joinedValues}`;
|
|
@@ -94,7 +94,7 @@ export const serializeArrayParam = ({
|
|
|
94
94
|
const separator = separatorArrayExplode(style);
|
|
95
95
|
const joinedValues = value
|
|
96
96
|
.map((v) => {
|
|
97
|
-
if (style ===
|
|
97
|
+
if (style === "label" || style === "simple") {
|
|
98
98
|
return allowReserved ? v : encodeURIComponent(v as string);
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -105,7 +105,7 @@ export const serializeArrayParam = ({
|
|
|
105
105
|
});
|
|
106
106
|
})
|
|
107
107
|
.join(separator);
|
|
108
|
-
return style ===
|
|
108
|
+
return style === "label" || style === "matrix"
|
|
109
109
|
? separator + joinedValues
|
|
110
110
|
: joinedValues;
|
|
111
111
|
};
|
|
@@ -116,12 +116,12 @@ export const serializePrimitiveParam = ({
|
|
|
116
116
|
value,
|
|
117
117
|
}: SerializePrimitiveParam) => {
|
|
118
118
|
if (value === undefined || value === null) {
|
|
119
|
-
return
|
|
119
|
+
return "";
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
if (typeof value ===
|
|
122
|
+
if (typeof value === "object") {
|
|
123
123
|
throw new Error(
|
|
124
|
-
|
|
124
|
+
"Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.",
|
|
125
125
|
);
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -143,7 +143,7 @@ export const serializeObjectParam = ({
|
|
|
143
143
|
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
if (style !==
|
|
146
|
+
if (style !== "deepObject" && !explode) {
|
|
147
147
|
let values: string[] = [];
|
|
148
148
|
Object.entries(value).forEach(([key, v]) => {
|
|
149
149
|
values = [
|
|
@@ -152,13 +152,13 @@ export const serializeObjectParam = ({
|
|
|
152
152
|
allowReserved ? (v as string) : encodeURIComponent(v as string),
|
|
153
153
|
];
|
|
154
154
|
});
|
|
155
|
-
const joinedValues = values.join(
|
|
155
|
+
const joinedValues = values.join(",");
|
|
156
156
|
switch (style) {
|
|
157
|
-
case
|
|
157
|
+
case "form":
|
|
158
158
|
return `${name}=${joinedValues}`;
|
|
159
|
-
case
|
|
159
|
+
case "label":
|
|
160
160
|
return `.${joinedValues}`;
|
|
161
|
-
case
|
|
161
|
+
case "matrix":
|
|
162
162
|
return `;${name}=${joinedValues}`;
|
|
163
163
|
default:
|
|
164
164
|
return joinedValues;
|
|
@@ -170,12 +170,12 @@ export const serializeObjectParam = ({
|
|
|
170
170
|
.map(([key, v]) =>
|
|
171
171
|
serializePrimitiveParam({
|
|
172
172
|
allowReserved,
|
|
173
|
-
name: style ===
|
|
173
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
174
174
|
value: v as string,
|
|
175
175
|
}),
|
|
176
176
|
)
|
|
177
177
|
.join(separator);
|
|
178
|
-
return style ===
|
|
178
|
+
return style === "label" || style === "matrix"
|
|
179
179
|
? separator + joinedValues
|
|
180
180
|
: joinedValues;
|
|
181
181
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
|
-
import type { Config } from
|
|
3
|
+
import type { Config } from "./types.gen";
|
|
4
4
|
|
|
5
5
|
export type ServerSentEventsOptions<TData = unknown> = Omit<
|
|
6
6
|
RequestInit,
|
|
7
|
-
|
|
7
|
+
"method"
|
|
8
8
|
> &
|
|
9
|
-
Pick<Config,
|
|
9
|
+
Pick<Config, "method" | "responseTransformer" | "responseValidator"> & {
|
|
10
10
|
/**
|
|
11
11
|
* Fetch API implementation. You can use this option to provide a custom
|
|
12
12
|
* fetch instance.
|
|
@@ -35,7 +35,7 @@ export type ServerSentEventsOptions<TData = unknown> = Omit<
|
|
|
35
35
|
* @returns Nothing (void).
|
|
36
36
|
*/
|
|
37
37
|
onSseEvent?: (event: StreamEvent<TData>) => void;
|
|
38
|
-
serializedBody?: RequestInit[
|
|
38
|
+
serializedBody?: RequestInit["body"];
|
|
39
39
|
/**
|
|
40
40
|
* Default retry delay in milliseconds.
|
|
41
41
|
*
|
|
@@ -121,12 +121,12 @@ export const createSseClient = <TData = unknown>({
|
|
|
121
121
|
: new Headers(options.headers as Record<string, string> | undefined);
|
|
122
122
|
|
|
123
123
|
if (lastEventId !== undefined) {
|
|
124
|
-
headers.set(
|
|
124
|
+
headers.set("Last-Event-ID", lastEventId);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
try {
|
|
128
128
|
const requestInit: RequestInit = {
|
|
129
|
-
redirect:
|
|
129
|
+
redirect: "follow",
|
|
130
130
|
...options,
|
|
131
131
|
body: options.serializedBody,
|
|
132
132
|
headers,
|
|
@@ -146,13 +146,13 @@ export const createSseClient = <TData = unknown>({
|
|
|
146
146
|
`SSE failed: ${response.status} ${response.statusText}`,
|
|
147
147
|
);
|
|
148
148
|
|
|
149
|
-
if (!response.body) throw new Error(
|
|
149
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
150
150
|
|
|
151
151
|
const reader = response.body
|
|
152
152
|
.pipeThrough(new TextDecoderStream())
|
|
153
153
|
.getReader();
|
|
154
154
|
|
|
155
|
-
let buffer =
|
|
155
|
+
let buffer = "";
|
|
156
156
|
|
|
157
157
|
const abortHandler = () => {
|
|
158
158
|
try {
|
|
@@ -162,7 +162,7 @@ export const createSseClient = <TData = unknown>({
|
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
-
signal.addEventListener(
|
|
165
|
+
signal.addEventListener("abort", abortHandler);
|
|
166
166
|
|
|
167
167
|
try {
|
|
168
168
|
while (true) {
|
|
@@ -170,24 +170,24 @@ export const createSseClient = <TData = unknown>({
|
|
|
170
170
|
if (done) break;
|
|
171
171
|
buffer += value;
|
|
172
172
|
|
|
173
|
-
const chunks = buffer.split(
|
|
174
|
-
buffer = chunks.pop() ??
|
|
173
|
+
const chunks = buffer.split("\n\n");
|
|
174
|
+
buffer = chunks.pop() ?? "";
|
|
175
175
|
|
|
176
176
|
for (const chunk of chunks) {
|
|
177
|
-
const lines = chunk.split(
|
|
177
|
+
const lines = chunk.split("\n");
|
|
178
178
|
const dataLines: Array<string> = [];
|
|
179
179
|
let eventName: string | undefined;
|
|
180
180
|
|
|
181
181
|
for (const line of lines) {
|
|
182
|
-
if (line.startsWith(
|
|
183
|
-
dataLines.push(line.replace(/^data:\s*/,
|
|
184
|
-
} else if (line.startsWith(
|
|
185
|
-
eventName = line.replace(/^event:\s*/,
|
|
186
|
-
} else if (line.startsWith(
|
|
187
|
-
lastEventId = line.replace(/^id:\s*/,
|
|
188
|
-
} else if (line.startsWith(
|
|
182
|
+
if (line.startsWith("data:")) {
|
|
183
|
+
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
184
|
+
} else if (line.startsWith("event:")) {
|
|
185
|
+
eventName = line.replace(/^event:\s*/, "");
|
|
186
|
+
} else if (line.startsWith("id:")) {
|
|
187
|
+
lastEventId = line.replace(/^id:\s*/, "");
|
|
188
|
+
} else if (line.startsWith("retry:")) {
|
|
189
189
|
const parsed = Number.parseInt(
|
|
190
|
-
line.replace(/^retry:\s*/,
|
|
190
|
+
line.replace(/^retry:\s*/, ""),
|
|
191
191
|
10,
|
|
192
192
|
);
|
|
193
193
|
if (!Number.isNaN(parsed)) {
|
|
@@ -200,7 +200,7 @@ export const createSseClient = <TData = unknown>({
|
|
|
200
200
|
let parsedJson = false;
|
|
201
201
|
|
|
202
202
|
if (dataLines.length) {
|
|
203
|
-
const rawData = dataLines.join(
|
|
203
|
+
const rawData = dataLines.join("\n");
|
|
204
204
|
try {
|
|
205
205
|
data = JSON.parse(rawData);
|
|
206
206
|
parsedJson = true;
|
|
@@ -232,7 +232,7 @@ export const createSseClient = <TData = unknown>({
|
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
} finally {
|
|
235
|
-
signal.removeEventListener(
|
|
235
|
+
signal.removeEventListener("abort", abortHandler);
|
|
236
236
|
reader.releaseLock();
|
|
237
237
|
}
|
|
238
238
|
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
|
-
import type { Auth, AuthToken } from
|
|
3
|
+
import type { Auth, AuthToken } from "./auth.gen";
|
|
4
4
|
import type {
|
|
5
5
|
BodySerializer,
|
|
6
6
|
QuerySerializer,
|
|
7
7
|
QuerySerializerOptions,
|
|
8
|
-
} from
|
|
8
|
+
} from "./bodySerializer.gen";
|
|
9
9
|
|
|
10
10
|
export type HttpMethod =
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
11
|
+
| "connect"
|
|
12
|
+
| "delete"
|
|
13
|
+
| "get"
|
|
14
|
+
| "head"
|
|
15
|
+
| "options"
|
|
16
|
+
| "patch"
|
|
17
|
+
| "post"
|
|
18
|
+
| "put"
|
|
19
|
+
| "trace";
|
|
20
20
|
|
|
21
21
|
export type Client<
|
|
22
22
|
RequestFn = never,
|
|
@@ -56,7 +56,7 @@ export interface Config {
|
|
|
56
56
|
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
57
57
|
*/
|
|
58
58
|
headers?:
|
|
59
|
-
| RequestInit[
|
|
59
|
+
| RequestInit["headers"]
|
|
60
60
|
| Record<
|
|
61
61
|
string,
|
|
62
62
|
| string
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
|
-
import type { BodySerializer, QuerySerializer } from
|
|
3
|
+
import type { BodySerializer, QuerySerializer } from "./bodySerializer.gen";
|
|
4
4
|
import {
|
|
5
5
|
type ArraySeparatorStyle,
|
|
6
6
|
serializeArrayParam,
|
|
7
7
|
serializeObjectParam,
|
|
8
8
|
serializePrimitiveParam,
|
|
9
|
-
} from
|
|
9
|
+
} from "./pathSerializer.gen";
|
|
10
10
|
|
|
11
11
|
export interface PathSerializer {
|
|
12
12
|
path: Record<string, unknown>;
|
|
@@ -22,19 +22,19 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
|
|
|
22
22
|
for (const match of matches) {
|
|
23
23
|
let explode = false;
|
|
24
24
|
let name = match.substring(1, match.length - 1);
|
|
25
|
-
let style: ArraySeparatorStyle =
|
|
25
|
+
let style: ArraySeparatorStyle = "simple";
|
|
26
26
|
|
|
27
|
-
if (name.endsWith(
|
|
27
|
+
if (name.endsWith("*")) {
|
|
28
28
|
explode = true;
|
|
29
29
|
name = name.substring(0, name.length - 1);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
if (name.startsWith(
|
|
32
|
+
if (name.startsWith(".")) {
|
|
33
33
|
name = name.substring(1);
|
|
34
|
-
style =
|
|
35
|
-
} else if (name.startsWith(
|
|
34
|
+
style = "label";
|
|
35
|
+
} else if (name.startsWith(";")) {
|
|
36
36
|
name = name.substring(1);
|
|
37
|
-
style =
|
|
37
|
+
style = "matrix";
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const value = path[name];
|
|
@@ -51,7 +51,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
|
|
|
51
51
|
continue;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
if (typeof value ===
|
|
54
|
+
if (typeof value === "object") {
|
|
55
55
|
url = url.replace(
|
|
56
56
|
match,
|
|
57
57
|
serializeObjectParam({
|
|
@@ -65,7 +65,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
|
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
if (style ===
|
|
68
|
+
if (style === "matrix") {
|
|
69
69
|
url = url.replace(
|
|
70
70
|
match,
|
|
71
71
|
`;${serializePrimitiveParam({
|
|
@@ -77,7 +77,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
const replaceValue = encodeURIComponent(
|
|
80
|
-
style ===
|
|
80
|
+
style === "label" ? `.${value as string}` : (value as string),
|
|
81
81
|
);
|
|
82
82
|
url = url.replace(match, replaceValue);
|
|
83
83
|
}
|
|
@@ -98,13 +98,13 @@ export const getUrl = ({
|
|
|
98
98
|
querySerializer: QuerySerializer;
|
|
99
99
|
url: string;
|
|
100
100
|
}) => {
|
|
101
|
-
const pathUrl = _url.startsWith(
|
|
102
|
-
let url = (baseUrl ??
|
|
101
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
102
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
103
103
|
if (path) {
|
|
104
104
|
url = defaultPathSerializer({ path, url });
|
|
105
105
|
}
|
|
106
|
-
let search = query ? querySerializer(query) :
|
|
107
|
-
if (search.startsWith(
|
|
106
|
+
let search = query ? querySerializer(query) : "";
|
|
107
|
+
if (search.startsWith("?")) {
|
|
108
108
|
search = search.substring(1);
|
|
109
109
|
}
|
|
110
110
|
if (search) {
|
|
@@ -122,15 +122,15 @@ export function getValidRequestBody(options: {
|
|
|
122
122
|
const isSerializedBody = hasBody && options.bodySerializer;
|
|
123
123
|
|
|
124
124
|
if (isSerializedBody) {
|
|
125
|
-
if (
|
|
125
|
+
if ("serializedBody" in options) {
|
|
126
126
|
const hasSerializedBody =
|
|
127
|
-
options.serializedBody !== undefined && options.serializedBody !==
|
|
127
|
+
options.serializedBody !== undefined && options.serializedBody !== "";
|
|
128
128
|
|
|
129
129
|
return hasSerializedBody ? options.serializedBody : null;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
// not all clients implement a serializedBody property (i.e. client-axios)
|
|
133
|
-
return options.body !==
|
|
133
|
+
return options.body !== "" ? options.body : null;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
// plain/text body
|
|
@@ -25,18 +25,20 @@ export function camelToSnakeObjectDeep<T extends object | undefined>(
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// Helper to check if a character is uppercase
|
|
28
|
-
type IsUpper<C extends string> =
|
|
29
|
-
|
|
30
|
-
?
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
type IsUpper<C extends string> =
|
|
29
|
+
C extends Uppercase<C>
|
|
30
|
+
? C extends Lowercase<C>
|
|
31
|
+
? false // Not a letter
|
|
32
|
+
: true // Uppercase letter
|
|
33
|
+
: false;
|
|
33
34
|
|
|
34
35
|
// Helper to check if a character is lowercase
|
|
35
|
-
type IsLower<C extends string> =
|
|
36
|
-
|
|
37
|
-
?
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
type IsLower<C extends string> =
|
|
37
|
+
C extends Lowercase<C>
|
|
38
|
+
? C extends Uppercase<C>
|
|
39
|
+
? false // Not a letter
|
|
40
|
+
: true // Lowercase letter
|
|
41
|
+
: false;
|
|
40
42
|
|
|
41
43
|
// Convert a camelCase string to snake_case at the type level
|
|
42
44
|
type CamelToSnakeString<
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import fs from "node:fs
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import fsp from "node:fs/promises";
|
|
2
3
|
import path from "pathe";
|
|
3
4
|
|
|
5
|
+
export function findWorkspaceRootSync(dir: string = process.cwd()) {
|
|
6
|
+
if (fs.statSync(dir).isDirectory()) {
|
|
7
|
+
if (fs.existsSync(path.join(dir, ".git"))) {
|
|
8
|
+
return dir;
|
|
9
|
+
} else if (readSync(dir, "package.json")?.workspaces) {
|
|
10
|
+
return dir;
|
|
11
|
+
} else if (rootFiles.some((file) => fs.existsSync(path.join(dir, file)))) {
|
|
12
|
+
return dir;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return findWorkspaceRootSync(path.resolve(dir, ".."));
|
|
16
|
+
}
|
|
17
|
+
|
|
4
18
|
export async function findWorkspaceRoot(dir: string = process.cwd()) {
|
|
5
|
-
if ((await
|
|
19
|
+
if ((await fsp.stat(dir)).isDirectory()) {
|
|
6
20
|
if (await exists(dir, ".git")) {
|
|
7
21
|
// the root of the git repo is usually the workspace root and we should always stop here
|
|
8
22
|
return dir;
|
|
@@ -17,13 +31,21 @@ export async function findWorkspaceRoot(dir: string = process.cwd()) {
|
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
const read = (...p: string[]): Promise<any> =>
|
|
20
|
-
|
|
34
|
+
fsp
|
|
21
35
|
.readFile(path.join(...p), "utf8")
|
|
22
36
|
.then(JSON.parse)
|
|
23
37
|
.catch(() => undefined);
|
|
24
38
|
|
|
39
|
+
const readSync = (...p: string[]): any => {
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(fs.readFileSync(path.join(...p), "utf8"));
|
|
42
|
+
} catch {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
25
47
|
const exists = (...p: string[]) =>
|
|
26
|
-
|
|
48
|
+
fsp
|
|
27
49
|
.access(path.join(...p))
|
|
28
50
|
.then(() => true)
|
|
29
51
|
.catch(() => false);
|
|
@@ -158,11 +158,7 @@ export async function idempotentSpawn({
|
|
|
158
158
|
// Follow a file from persisted offset and mirror to a sink (stdout/stderr)
|
|
159
159
|
async function followFilePersisted(
|
|
160
160
|
logPath: string,
|
|
161
|
-
{
|
|
162
|
-
write,
|
|
163
|
-
chunkSize = 64 * 1024,
|
|
164
|
-
tickMs = 100,
|
|
165
|
-
}: {
|
|
161
|
+
{ write, chunkSize = 64 * 1024, tickMs = 100 }: {
|
|
166
162
|
stateKey: string;
|
|
167
163
|
write: (buf: Buffer) => boolean;
|
|
168
164
|
chunkSize?: number;
|