alchemy 0.75.0 → 0.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/bin/alchemy.js +302 -287
  2. package/bin/commands/util.ts +8 -4
  3. package/bin/services/execute-alchemy.ts +4 -2
  4. package/bin/services/github-workflow.ts +2 -3
  5. package/bin/services/package-manager.ts +1 -5
  6. package/lib/alchemy.d.ts +1 -1
  7. package/lib/alchemy.d.ts.map +1 -1
  8. package/lib/alchemy.js +1 -1
  9. package/lib/alchemy.js.map +1 -1
  10. package/lib/apply.js +10 -0
  11. package/lib/apply.js.map +1 -1
  12. package/lib/aws/control/types.d.ts.map +1 -1
  13. package/lib/aws/control/types.js.map +1 -1
  14. package/lib/clickhouse/api/sdk.gen.d.ts.map +1 -1
  15. package/lib/clickhouse/api/sdk.gen.js.map +1 -1
  16. package/lib/cloudflare/account-api-token.d.ts.map +1 -1
  17. package/lib/cloudflare/account-api-token.js.map +1 -1
  18. package/lib/cloudflare/bound.d.ts.map +1 -1
  19. package/lib/cloudflare/bucket.d.ts +1 -1
  20. package/lib/cloudflare/bucket.d.ts.map +1 -1
  21. package/lib/cloudflare/bucket.js +1 -1
  22. package/lib/cloudflare/bucket.js.map +1 -1
  23. package/lib/cloudflare/cloudflare-env-proxy.d.ts.map +1 -1
  24. package/lib/cloudflare/cloudflare-env-proxy.js +3 -3
  25. package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
  26. package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
  27. package/lib/cloudflare/compatibility-date.gen.js +1 -1
  28. package/lib/cloudflare/d1-database.d.ts.map +1 -1
  29. package/lib/cloudflare/d1-database.js +0 -4
  30. package/lib/cloudflare/d1-database.js.map +1 -1
  31. package/lib/cloudflare/dns-records.js.map +1 -1
  32. package/lib/cloudflare/hyperdrive.d.ts +0 -1
  33. package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
  34. package/lib/cloudflare/hyperdrive.js.map +1 -1
  35. package/lib/cloudflare/miniflare/delete.d.ts.map +1 -1
  36. package/lib/cloudflare/miniflare/delete.js +3 -0
  37. package/lib/cloudflare/miniflare/delete.js.map +1 -1
  38. package/lib/cloudflare/miniflare/paths.d.ts +0 -1
  39. package/lib/cloudflare/miniflare/paths.d.ts.map +1 -1
  40. package/lib/cloudflare/miniflare/paths.js +4 -17
  41. package/lib/cloudflare/miniflare/paths.js.map +1 -1
  42. package/lib/cloudflare/nuxt/plugin.d.ts.map +1 -1
  43. package/lib/cloudflare/nuxt/plugin.js +2 -2
  44. package/lib/cloudflare/nuxt/plugin.js.map +1 -1
  45. package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
  46. package/lib/cloudflare/queue-consumer.js +0 -2
  47. package/lib/cloudflare/queue-consumer.js.map +1 -1
  48. package/lib/cloudflare/react-router/plugin.d.ts.map +1 -1
  49. package/lib/cloudflare/react-router/plugin.js +0 -1
  50. package/lib/cloudflare/react-router/plugin.js.map +1 -1
  51. package/lib/cloudflare/vite/plugin.d.ts.map +1 -1
  52. package/lib/cloudflare/vite/plugin.js +3 -3
  53. package/lib/cloudflare/vite/plugin.js.map +1 -1
  54. package/lib/cloudflare/website.d.ts.map +1 -1
  55. package/lib/cloudflare/website.js +0 -4
  56. package/lib/cloudflare/website.js.map +1 -1
  57. package/lib/cloudflare/worker-assets.d.ts +1 -1
  58. package/lib/cloudflare/worker-assets.d.ts.map +1 -1
  59. package/lib/cloudflare/worker-assets.js +1 -1
  60. package/lib/cloudflare/worker-assets.js.map +1 -1
  61. package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
  62. package/lib/cloudflare/worker-metadata.js.map +1 -1
  63. package/lib/cloudflare/worker-tail.d.ts.map +1 -1
  64. package/lib/cloudflare/worker-tail.js.map +1 -1
  65. package/lib/cloudflare/worker.d.ts.map +1 -1
  66. package/lib/cloudflare/worker.js +3 -1
  67. package/lib/cloudflare/worker.js.map +1 -1
  68. package/lib/cloudflare/wrangler.json.js +0 -1
  69. package/lib/cloudflare/wrangler.json.js.map +1 -1
  70. package/lib/cloudflare/zone.d.ts +1 -1
  71. package/lib/cloudflare/zone.d.ts.map +1 -1
  72. package/lib/cloudflare/zone.js +3 -28
  73. package/lib/cloudflare/zone.js.map +1 -1
  74. package/lib/coinbase/evm-account.d.ts.map +1 -1
  75. package/lib/coinbase/evm-account.js.map +1 -1
  76. package/lib/coinbase/evm-smart-account.d.ts.map +1 -1
  77. package/lib/coinbase/evm-smart-account.js.map +1 -1
  78. package/lib/docker/api.d.ts.map +1 -1
  79. package/lib/docker/api.js.map +1 -1
  80. package/lib/github/secret.d.ts.map +1 -1
  81. package/lib/github/secret.js.map +1 -1
  82. package/lib/neon/api/sdk.gen.d.ts.map +1 -1
  83. package/lib/neon/api/sdk.gen.js.map +1 -1
  84. package/lib/os/exec.d.ts.map +1 -1
  85. package/lib/os/exec.js.map +1 -1
  86. package/lib/planetscale/api/sdk.gen.d.ts.map +1 -1
  87. package/lib/planetscale/api/sdk.gen.js.map +1 -1
  88. package/lib/prisma-postgres/api/sdk.gen.d.ts.map +1 -1
  89. package/lib/prisma-postgres/api/sdk.gen.js.map +1 -1
  90. package/lib/scope.d.ts.map +1 -1
  91. package/lib/scope.js +2 -2
  92. package/lib/scope.js.map +1 -1
  93. package/lib/sentry/client-key.js +1 -1
  94. package/lib/sentry/client-key.js.map +1 -1
  95. package/lib/test/bun.d.ts.map +1 -1
  96. package/lib/test/bun.js.map +1 -1
  97. package/lib/test/vitest.d.ts.map +1 -1
  98. package/lib/test/vitest.js.map +1 -1
  99. package/lib/util/api/client/client.gen.d.ts +1 -1
  100. package/lib/util/api/client/client.gen.js +45 -45
  101. package/lib/util/api/client/types.gen.d.ts +22 -22
  102. package/lib/util/api/client/utils.gen.d.ts +3 -3
  103. package/lib/util/api/client/utils.gen.d.ts.map +1 -1
  104. package/lib/util/api/client/utils.gen.js +34 -34
  105. package/lib/util/api/client/utils.gen.js.map +1 -1
  106. package/lib/util/api/core/auth.gen.d.ts +3 -3
  107. package/lib/util/api/core/auth.gen.js +3 -3
  108. package/lib/util/api/core/bodySerializer.gen.d.ts +1 -1
  109. package/lib/util/api/core/bodySerializer.gen.js +3 -3
  110. package/lib/util/api/core/params.gen.d.ts +3 -3
  111. package/lib/util/api/core/params.gen.js +7 -7
  112. package/lib/util/api/core/pathSerializer.gen.d.ts +3 -3
  113. package/lib/util/api/core/pathSerializer.gen.js +36 -36
  114. package/lib/util/api/core/serverSentEvents.gen.d.ts +3 -3
  115. package/lib/util/api/core/serverSentEvents.gen.js +18 -18
  116. package/lib/util/api/core/types.gen.d.ts +4 -4
  117. package/lib/util/api/core/utils.gen.d.ts +1 -1
  118. package/lib/util/api/core/utils.gen.js +17 -17
  119. package/lib/util/camel-to-snake.d.ts.map +1 -1
  120. package/lib/util/find-workspace-root.d.ts +3 -0
  121. package/lib/util/find-workspace-root.d.ts.map +1 -0
  122. package/lib/util/find-workspace-root.js +94 -0
  123. package/lib/util/find-workspace-root.js.map +1 -0
  124. package/lib/util/idempotent-spawn.d.ts.map +1 -1
  125. package/lib/util/idempotent-spawn.js +1 -1
  126. package/lib/util/idempotent-spawn.js.map +1 -1
  127. package/lib/util/peer.d.ts.map +1 -1
  128. package/lib/util/peer.js.map +1 -1
  129. package/package.json +1 -1
  130. package/src/alchemy.ts +4 -3
  131. package/src/apply.ts +16 -1
  132. package/src/aws/control/types.ts +87107 -85281
  133. package/src/clickhouse/api/sdk.gen.ts +1 -3
  134. package/src/cloudflare/account-api-token.ts +3 -1
  135. package/src/cloudflare/bound.ts +64 -65
  136. package/src/cloudflare/bucket.ts +4 -7
  137. package/src/cloudflare/cloudflare-env-proxy.ts +2 -4
  138. package/src/cloudflare/compatibility-date.gen.ts +1 -1
  139. package/src/cloudflare/d1-database.ts +0 -9
  140. package/src/cloudflare/dns-records.ts +3 -1
  141. package/src/cloudflare/hyperdrive.ts +0 -1
  142. package/src/cloudflare/miniflare/delete.ts +3 -0
  143. package/src/cloudflare/miniflare/paths.ts +4 -25
  144. package/src/cloudflare/nuxt/plugin.ts +1 -4
  145. package/src/cloudflare/queue-consumer.ts +0 -2
  146. package/src/cloudflare/react-router/plugin.ts +0 -1
  147. package/src/cloudflare/vite/plugin.ts +1 -3
  148. package/src/cloudflare/website.ts +0 -5
  149. package/src/cloudflare/worker-assets.ts +1 -6
  150. package/src/cloudflare/worker-metadata.ts +5 -3
  151. package/src/cloudflare/worker-tail.ts +3 -1
  152. package/src/cloudflare/worker.ts +3 -1
  153. package/src/cloudflare/wrangler.json.ts +0 -1
  154. package/src/cloudflare/zone.ts +6 -38
  155. package/src/coinbase/evm-account.ts +3 -1
  156. package/src/coinbase/evm-smart-account.ts +3 -1
  157. package/src/docker/api.ts +3 -1
  158. package/src/github/secret.ts +5 -1
  159. package/src/neon/api/sdk.gen.ts +1 -3
  160. package/src/os/exec.ts +3 -1
  161. package/src/planetscale/api/sdk.gen.ts +1 -3
  162. package/src/prisma-postgres/api/sdk.gen.ts +1 -3
  163. package/src/scope.ts +2 -2
  164. package/src/sentry/client-key.ts +1 -5
  165. package/src/test/bun.ts +3 -1
  166. package/src/test/vitest.ts +3 -1
  167. package/src/util/api/client/client.gen.ts +49 -49
  168. package/src/util/api/client/types.gen.ts +43 -43
  169. package/src/util/api/client/utils.gen.ts +47 -42
  170. package/src/util/api/core/auth.gen.ts +6 -6
  171. package/src/util/api/core/bodySerializer.gen.ts +4 -4
  172. package/src/util/api/core/params.gen.ts +10 -10
  173. package/src/util/api/core/pathSerializer.gen.ts +39 -39
  174. package/src/util/api/core/serverSentEvents.gen.ts +22 -22
  175. package/src/util/api/core/types.gen.ts +12 -12
  176. package/src/util/api/core/utils.gen.ts +18 -18
  177. package/src/util/camel-to-snake.ts +12 -10
  178. package/src/util/find-workspace-root.ts +112 -0
  179. package/src/util/idempotent-spawn.ts +1 -5
  180. package/src/util/peer.ts +3 -1
  181. package/templates/astro/astro.config.mjs +3 -3
  182. package/templates/astro/src/pages/api/hello.ts +16 -13
  183. package/templates/bun-spa/bun-env.d.ts +0 -1
  184. package/templates/bun-spa/eslint.config.js +11 -12
  185. package/templates/bun-spa/src/App.tsx +0 -1
  186. package/templates/bun-spa/src/frontend.tsx +0 -1
  187. package/templates/hono/src/index.ts +13 -13
  188. package/templates/nextjs/alchemy.run.ts +1 -1
  189. package/templates/nextjs/eslint.config.mjs +1 -1
  190. package/templates/nextjs/next-env.d.ts +1 -1
  191. package/templates/nextjs/next.config.ts +1 -1
  192. package/templates/nextjs/open-next.config.ts +1 -1
  193. package/templates/nextjs/src/app/api/hello/route.ts +2 -2
  194. package/templates/nextjs/src/app/layout.tsx +1 -1
  195. package/templates/nextjs/src/app/page.tsx +14 -15
  196. package/templates/nextjs/types/env.d.ts +4 -4
  197. package/templates/nuxt/server/middleware/auth.ts +1 -1
  198. package/templates/nuxt/server/middleware/hello.ts +2 -2
  199. package/templates/react-router/app/entry.server.tsx +2 -2
  200. package/templates/react-router/vite.config.ts +1 -1
  201. package/templates/react-router/workers/app.ts +2 -2
  202. package/templates/rwsdk/alchemy.run.ts +6 -3
  203. package/templates/sveltekit/src/app.d.ts +7 -7
  204. package/templates/sveltekit/svelte.config.js +4 -4
  205. package/templates/sveltekit/vite.config.ts +3 -3
  206. package/templates/tanstack-start/src/components/Header.tsx +2 -2
  207. package/templates/tanstack-start/src/router.tsx +4 -4
  208. package/templates/tanstack-start/src/routes/__root.tsx +10 -10
  209. package/templates/tanstack-start/src/routes/api.demo-names.ts +6 -6
  210. package/templates/tanstack-start/src/routes/demo.start.api-request.tsx +11 -11
  211. package/templates/tanstack-start/src/routes/demo.start.server-funcs.tsx +30 -30
  212. package/templates/tanstack-start/src/routes/index.tsx +5 -5
  213. package/templates/tanstack-start/vite.config.ts +9 -9
  214. package/templates/typescript/src/worker.ts +5 -1
  215. package/templates/vite/eslint.config.js +12 -12
  216. package/templates/vite/src/App.tsx +7 -7
  217. package/templates/vite/src/main.tsx +6 -6
  218. package/templates/vite/src/worker.ts +11 -12
  219. package/templates/vite/vite.config.ts +2 -2
  220. package/workers/tunnel-proxy.js +1 -1
  221. package/bin/services/find-workspace-root.ts +0 -48
  222. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts +0 -2
  223. package/lib/cloudflare/miniflare/symlink-miniflare-state.d.ts.map +0 -1
  224. package/lib/cloudflare/miniflare/symlink-miniflare-state.js +0 -18
  225. package/lib/cloudflare/miniflare/symlink-miniflare-state.js.map +0 -1
  226. package/src/cloudflare/miniflare/symlink-miniflare-state.ts +0 -18
@@ -1,15 +1,20 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
 
3
- import { getAuthToken } from '../core/auth.gen';
4
- import type { QuerySerializerOptions } from '../core/bodySerializer.gen';
5
- import { jsonBodySerializer } from '../core/bodySerializer.gen';
3
+ import { getAuthToken } from "../core/auth.gen";
4
+ import type { QuerySerializerOptions } from "../core/bodySerializer.gen";
5
+ import { jsonBodySerializer } from "../core/bodySerializer.gen";
6
6
  import {
7
7
  serializeArrayParam,
8
8
  serializeObjectParam,
9
9
  serializePrimitiveParam,
10
- } from '../core/pathSerializer.gen';
11
- import { getUrl } from '../core/utils.gen';
12
- import type { Client, ClientOptions, Config, RequestOptions } from './types.gen';
10
+ } from "../core/pathSerializer.gen";
11
+ import { getUrl } from "../core/utils.gen";
12
+ import type {
13
+ Client,
14
+ ClientOptions,
15
+ Config,
16
+ RequestOptions,
17
+ } from "./types.gen";
13
18
 
14
19
  export const createQuerySerializer = <T = unknown>({
15
20
  allowReserved,
@@ -18,7 +23,7 @@ export const createQuerySerializer = <T = unknown>({
18
23
  }: QuerySerializerOptions = {}) => {
19
24
  const querySerializer = (queryParams: T) => {
20
25
  const search: string[] = [];
21
- if (queryParams && typeof queryParams === 'object') {
26
+ if (queryParams && typeof queryParams === "object") {
22
27
  for (const name in queryParams) {
23
28
  const value = queryParams[name];
24
29
 
@@ -31,17 +36,17 @@ export const createQuerySerializer = <T = unknown>({
31
36
  allowReserved,
32
37
  explode: true,
33
38
  name,
34
- style: 'form',
39
+ style: "form",
35
40
  value,
36
41
  ...array,
37
42
  });
38
43
  if (serializedArray) search.push(serializedArray);
39
- } else if (typeof value === 'object') {
44
+ } else if (typeof value === "object") {
40
45
  const serializedObject = serializeObjectParam({
41
46
  allowReserved,
42
47
  explode: true,
43
48
  name,
44
- style: 'deepObject',
49
+ style: "deepObject",
45
50
  value: value as Record<string, unknown>,
46
51
  ...object,
47
52
  });
@@ -56,7 +61,7 @@ export const createQuerySerializer = <T = unknown>({
56
61
  }
57
62
  }
58
63
  }
59
- return search.join('&');
64
+ return search.join("&");
60
65
  };
61
66
  return querySerializer;
62
67
  };
@@ -66,47 +71,47 @@ export const createQuerySerializer = <T = unknown>({
66
71
  */
67
72
  export const getParseAs = (
68
73
  contentType: string | null,
69
- ): Exclude<Config['parseAs'], 'auto'> => {
74
+ ): Exclude<Config["parseAs"], "auto"> => {
70
75
  if (!contentType) {
71
76
  // If no Content-Type header is provided, the best we can do is return the raw response body,
72
77
  // which is effectively the same as the 'stream' option.
73
- return 'stream';
78
+ return "stream";
74
79
  }
75
80
 
76
- const cleanContent = contentType.split(';')[0]?.trim();
81
+ const cleanContent = contentType.split(";")[0]?.trim();
77
82
 
78
83
  if (!cleanContent) {
79
84
  return;
80
85
  }
81
86
 
82
87
  if (
83
- cleanContent.startsWith('application/json') ||
84
- cleanContent.endsWith('+json')
88
+ cleanContent.startsWith("application/json") ||
89
+ cleanContent.endsWith("+json")
85
90
  ) {
86
- return 'json';
91
+ return "json";
87
92
  }
88
93
 
89
- if (cleanContent === 'multipart/form-data') {
90
- return 'formData';
94
+ if (cleanContent === "multipart/form-data") {
95
+ return "formData";
91
96
  }
92
97
 
93
98
  if (
94
- ['application/', 'audio/', 'image/', 'video/'].some((type) =>
99
+ ["application/", "audio/", "image/", "video/"].some((type) =>
95
100
  cleanContent.startsWith(type),
96
101
  )
97
102
  ) {
98
- return 'blob';
103
+ return "blob";
99
104
  }
100
105
 
101
- if (cleanContent.startsWith('text/')) {
102
- return 'text';
106
+ if (cleanContent.startsWith("text/")) {
107
+ return "text";
103
108
  }
104
109
 
105
110
  return;
106
111
  };
107
112
 
108
113
  const checkForExistence = (
109
- options: Pick<RequestOptions, 'auth' | 'query'> & {
114
+ options: Pick<RequestOptions, "auth" | "query"> & {
110
115
  headers: Headers;
111
116
  },
112
117
  name?: string,
@@ -117,7 +122,7 @@ const checkForExistence = (
117
122
  if (
118
123
  options.headers.has(name) ||
119
124
  options.query?.[name] ||
120
- options.headers.get('Cookie')?.includes(`${name}=`)
125
+ options.headers.get("Cookie")?.includes(`${name}=`)
121
126
  ) {
122
127
  return true;
123
128
  }
@@ -127,8 +132,8 @@ const checkForExistence = (
127
132
  export const setAuthParams = async ({
128
133
  security,
129
134
  ...options
130
- }: Pick<Required<RequestOptions>, 'security'> &
131
- Pick<RequestOptions, 'auth' | 'query'> & {
135
+ }: Pick<Required<RequestOptions>, "security"> &
136
+ Pick<RequestOptions, "auth" | "query"> & {
132
137
  headers: Headers;
133
138
  }) => {
134
139
  for (const auth of security) {
@@ -142,19 +147,19 @@ export const setAuthParams = async ({
142
147
  continue;
143
148
  }
144
149
 
145
- const name = auth.name ?? 'Authorization';
150
+ const name = auth.name ?? "Authorization";
146
151
 
147
152
  switch (auth.in) {
148
- case 'query':
153
+ case "query":
149
154
  if (!options.query) {
150
155
  options.query = {};
151
156
  }
152
157
  options.query[name] = token;
153
158
  break;
154
- case 'cookie':
155
- options.headers.append('Cookie', `${name}=${token}`);
159
+ case "cookie":
160
+ options.headers.append("Cookie", `${name}=${token}`);
156
161
  break;
157
- case 'header':
162
+ case "header":
158
163
  default:
159
164
  options.headers.set(name, token);
160
165
  break;
@@ -162,13 +167,13 @@ export const setAuthParams = async ({
162
167
  }
163
168
  };
164
169
 
165
- export const buildUrl: Client['buildUrl'] = (options) =>
170
+ export const buildUrl: Client["buildUrl"] = (options) =>
166
171
  getUrl({
167
172
  baseUrl: options.baseUrl as string,
168
173
  path: options.path,
169
174
  query: options.query,
170
175
  querySerializer:
171
- typeof options.querySerializer === 'function'
176
+ typeof options.querySerializer === "function"
172
177
  ? options.querySerializer
173
178
  : createQuerySerializer(options.querySerializer),
174
179
  url: options.url,
@@ -176,7 +181,7 @@ export const buildUrl: Client['buildUrl'] = (options) =>
176
181
 
177
182
  export const mergeConfigs = (a: Config, b: Config): Config => {
178
183
  const config = { ...a, ...b };
179
- if (config.baseUrl?.endsWith('/')) {
184
+ if (config.baseUrl?.endsWith("/")) {
180
185
  config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
181
186
  }
182
187
  config.headers = mergeHeaders(a.headers, b.headers);
@@ -192,7 +197,7 @@ const headersEntries = (headers: Headers): Array<[string, string]> => {
192
197
  };
193
198
 
194
199
  export const mergeHeaders = (
195
- ...headers: Array<Required<Config>['headers'] | undefined>
200
+ ...headers: Array<Required<Config>["headers"] | undefined>
196
201
  ): Headers => {
197
202
  const mergedHeaders = new Headers();
198
203
  for (const header of headers) {
@@ -217,7 +222,7 @@ export const mergeHeaders = (
217
222
  // content value in OpenAPI specification is 'application/json'
218
223
  mergedHeaders.set(
219
224
  key,
220
- typeof value === 'object' ? JSON.stringify(value) : (value as string),
225
+ typeof value === "object" ? JSON.stringify(value) : (value as string),
221
226
  );
222
227
  }
223
228
  }
@@ -263,7 +268,7 @@ class Interceptors<Interceptor> {
263
268
  }
264
269
 
265
270
  getInterceptorIndex(id: number | Interceptor): number {
266
- if (typeof id === 'number') {
271
+ if (typeof id === "number") {
267
272
  return this.fns[id] ? id : -1;
268
273
  }
269
274
  return this.fns.indexOf(id);
@@ -308,16 +313,16 @@ const defaultQuerySerializer = createQuerySerializer({
308
313
  allowReserved: false,
309
314
  array: {
310
315
  explode: true,
311
- style: 'form',
316
+ style: "form",
312
317
  },
313
318
  object: {
314
319
  explode: true,
315
- style: 'deepObject',
320
+ style: "deepObject",
316
321
  },
317
322
  });
318
323
 
319
324
  const defaultHeaders = {
320
- 'Content-Type': 'application/json',
325
+ "Content-Type": "application/json",
321
326
  };
322
327
 
323
328
  export const createConfig = <T extends ClientOptions = ClientOptions>(
@@ -325,7 +330,7 @@ export const createConfig = <T extends ClientOptions = ClientOptions>(
325
330
  ): Config<Omit<ClientOptions, keyof T> & T> => ({
326
331
  ...jsonBodySerializer,
327
332
  headers: defaultHeaders,
328
- parseAs: 'auto',
333
+ parseAs: "auto",
329
334
  querySerializer: defaultQuerySerializer,
330
335
  ...override,
331
336
  });
@@ -8,15 +8,15 @@ export interface Auth {
8
8
  *
9
9
  * @default 'header'
10
10
  */
11
- in?: 'header' | 'query' | 'cookie';
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?: 'basic' | 'bearer';
19
- type: 'apiKey' | 'http';
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 === 'function' ? await callback(auth) : 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 === 'bearer') {
33
+ if (auth.scheme === "bearer") {
34
34
  return `Bearer ${token}`;
35
35
  }
36
36
 
37
- if (auth.scheme === 'basic') {
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 './pathSerializer.gen';
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 === 'string' || value instanceof Blob) {
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 === 'string') {
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 === 'bigint' ? value.toString() : 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 = 'body' | 'headers' | 'path' | 'query';
3
+ type Slot = "body" | "headers" | "path" | "query";
4
4
 
5
5
  export type Field =
6
6
  | {
7
- in: Exclude<Slot, 'body'>;
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, 'body'>;
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_: 'body',
36
- $headers_: 'headers',
37
- $path_: 'path',
38
- $query_: '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 ('in' in config) {
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 === 'object' && !Object.keys(value).length) {
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 ('in' in config) {
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 = 'form' | 'spaceDelimited' | 'pipeDelimited';
20
+ export type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited";
21
21
  export type ArraySeparatorStyle = ArrayStyle | MatrixStyle;
22
- type MatrixStyle = 'label' | 'matrix' | 'simple';
23
- export type ObjectStyle = 'form' | 'deepObject';
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 'label':
33
- return '.';
34
- case 'matrix':
35
- return ';';
36
- case 'simple':
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 'form':
46
- return ',';
47
- case 'pipeDelimited':
48
- return '|';
49
- case 'spaceDelimited':
50
- return '%20';
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 'label':
59
- return '.';
60
- case 'matrix':
61
- return ';';
62
- case 'simple':
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 'label':
83
+ case "label":
84
84
  return `.${joinedValues}`;
85
- case 'matrix':
85
+ case "matrix":
86
86
  return `;${name}=${joinedValues}`;
87
- case 'simple':
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 === 'label' || style === 'simple') {
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 === 'label' || style === 'matrix'
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 === 'object') {
122
+ if (typeof value === "object") {
123
123
  throw new Error(
124
- 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.',
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 !== 'deepObject' && !explode) {
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 'form':
157
+ case "form":
158
158
  return `${name}=${joinedValues}`;
159
- case 'label':
159
+ case "label":
160
160
  return `.${joinedValues}`;
161
- case 'matrix':
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 === 'deepObject' ? `${name}[${key}]` : key,
173
+ name: style === "deepObject" ? `${name}[${key}]` : key,
174
174
  value: v as string,
175
175
  }),
176
176
  )
177
177
  .join(separator);
178
- return style === 'label' || style === 'matrix'
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 './types.gen';
3
+ import type { Config } from "./types.gen";
4
4
 
5
5
  export type ServerSentEventsOptions<TData = unknown> = Omit<
6
6
  RequestInit,
7
- 'method'
7
+ "method"
8
8
  > &
9
- Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & {
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['body'];
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('Last-Event-ID', lastEventId);
124
+ headers.set("Last-Event-ID", lastEventId);
125
125
  }
126
126
 
127
127
  try {
128
128
  const requestInit: RequestInit = {
129
- redirect: 'follow',
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('No body in SSE response');
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('abort', abortHandler);
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('\n\n');
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('\n');
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('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:')) {
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('\n');
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('abort', abortHandler);
235
+ signal.removeEventListener("abort", abortHandler);
236
236
  reader.releaseLock();
237
237
  }
238
238