cushin-monorepo 3.0.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.
Files changed (103) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +14 -0
  3. package/.claude/settings.local.json +44 -0
  4. package/CHANGELOG.md +93 -0
  5. package/LICENSE +0 -0
  6. package/README.md +482 -0
  7. package/biome.json +34 -0
  8. package/dist/cli.d.ts +1 -0
  9. package/dist/cli.js +1552 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/config/index.d.ts +84 -0
  12. package/dist/config/index.js +69 -0
  13. package/dist/config/index.js.map +1 -0
  14. package/dist/config/schema.d.ts +43 -0
  15. package/dist/config/schema.js +14 -0
  16. package/dist/config/schema.js.map +1 -0
  17. package/dist/index.d.ts +27 -0
  18. package/dist/index.js +1666 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/runtime/client.d.ts +40 -0
  21. package/dist/runtime/client.js +260 -0
  22. package/dist/runtime/client.js.map +1 -0
  23. package/package.json +41 -0
  24. package/packages/api-codegen/CHANGELOG.md +86 -0
  25. package/packages/api-codegen/biome.json +34 -0
  26. package/packages/api-codegen/dist/cli.js +1038 -0
  27. package/packages/api-codegen/dist/cli.js.map +1 -0
  28. package/packages/api-codegen/dist/index.d.ts +103 -0
  29. package/packages/api-codegen/dist/index.js +1026 -0
  30. package/packages/api-codegen/dist/index.js.map +1 -0
  31. package/packages/api-codegen/node_modules/.bin/acorn +21 -0
  32. package/packages/api-codegen/node_modules/.bin/conventional-changelog +21 -0
  33. package/packages/api-codegen/node_modules/.bin/conventional-commits-parser +21 -0
  34. package/packages/api-codegen/node_modules/.bin/esbuild +21 -0
  35. package/packages/api-codegen/node_modules/.bin/eslint +21 -0
  36. package/packages/api-codegen/node_modules/.bin/jiti +21 -0
  37. package/packages/api-codegen/node_modules/.bin/next +21 -0
  38. package/packages/api-codegen/node_modules/.bin/tsc +21 -0
  39. package/packages/api-codegen/node_modules/.bin/tsserver +21 -0
  40. package/packages/api-codegen/node_modules/.bin/tsup +21 -0
  41. package/packages/api-codegen/node_modules/.bin/tsup-node +21 -0
  42. package/packages/api-codegen/node_modules/.bin/vitest +21 -0
  43. package/packages/api-codegen/package.json +88 -0
  44. package/packages/api-runtime/CHANGELOG.md +46 -0
  45. package/packages/api-runtime/README.md +95 -0
  46. package/packages/api-runtime/dist/chunk-3FFXWCVP.js +17 -0
  47. package/packages/api-runtime/dist/chunk-3FFXWCVP.js.map +1 -0
  48. package/packages/api-runtime/dist/chunk-EZ5P7OPH.js +267 -0
  49. package/packages/api-runtime/dist/chunk-EZ5P7OPH.js.map +1 -0
  50. package/packages/api-runtime/dist/client.d.ts +40 -0
  51. package/packages/api-runtime/dist/client.js +13 -0
  52. package/packages/api-runtime/dist/client.js.map +1 -0
  53. package/packages/api-runtime/dist/index.d.ts +3 -0
  54. package/packages/api-runtime/dist/index.js +21 -0
  55. package/packages/api-runtime/dist/index.js.map +1 -0
  56. package/packages/api-runtime/dist/schema.d.ts +45 -0
  57. package/packages/api-runtime/dist/schema.js +11 -0
  58. package/packages/api-runtime/dist/schema.js.map +1 -0
  59. package/packages/api-runtime/node_modules/.bin/esbuild +21 -0
  60. package/packages/api-runtime/node_modules/.bin/jiti +21 -0
  61. package/packages/api-runtime/node_modules/.bin/tsc +21 -0
  62. package/packages/api-runtime/node_modules/.bin/tsserver +21 -0
  63. package/packages/api-runtime/node_modules/.bin/tsup +21 -0
  64. package/packages/api-runtime/node_modules/.bin/tsup-node +21 -0
  65. package/packages/api-runtime/package.json +54 -0
  66. package/packages/cli/CHANGELOG.md +34 -0
  67. package/packages/cli/biome.json +34 -0
  68. package/packages/cli/dist/index.d.ts +27 -0
  69. package/packages/cli/dist/index.js +183 -0
  70. package/packages/cli/dist/index.js.map +1 -0
  71. package/packages/cli/node_modules/.bin/esbuild +21 -0
  72. package/packages/cli/node_modules/.bin/jiti +21 -0
  73. package/packages/cli/node_modules/.bin/tsc +21 -0
  74. package/packages/cli/node_modules/.bin/tsserver +21 -0
  75. package/packages/cli/node_modules/.bin/tsup +21 -0
  76. package/packages/cli/node_modules/.bin/tsup-node +21 -0
  77. package/packages/cli/package.json +47 -0
  78. package/pnpm-workspace.yaml +2 -0
  79. package/test-config.js +9 -0
  80. package/test-content-type-handling.mjs +100 -0
  81. package/test-endpoints-config.mjs +144 -0
  82. package/test-formdata-content-type-protection.mjs +127 -0
  83. package/test-formdata-runtime.mjs +127 -0
  84. package/test-full-integration.mjs +90 -0
  85. package/test-headers-formdata.mjs +97 -0
  86. package/test-headers-runtime.mjs +106 -0
  87. package/test-headers.mjs +79 -0
  88. package/test-internal-calls.mjs +57 -0
  89. package/test-ky-formdata.mjs +81 -0
  90. package/test-output/actions.ts +134 -0
  91. package/test-output/client.ts +81 -0
  92. package/test-output/hooks.ts +182 -0
  93. package/test-output/index.ts +9 -0
  94. package/test-output/prefetchs.ts +25 -0
  95. package/test-output/queries.ts +78 -0
  96. package/test-output/query-keys.ts +16 -0
  97. package/test-output/query-options.ts +38 -0
  98. package/test-output/server-client.ts +32 -0
  99. package/test-output/types.ts +61 -0
  100. package/test-real-endpoints.mjs +132 -0
  101. package/test-runtime-params.mjs +160 -0
  102. package/test-simple-config.mjs +71 -0
  103. package/tsconfig.base.json +29 -0
@@ -0,0 +1,95 @@
1
+ # @cushin/api-runtime
2
+
3
+ Runtime utilities for Cushin API codegen - provides type-safe HTTP client and schema helpers that can be used in both browser and Node.js environments.
4
+
5
+ ## Features
6
+
7
+ - 🌐 **Browser-compatible** - No Node.js dependencies, works in any JavaScript environment
8
+ - 🔐 **Built-in auth** - Token management with automatic refresh
9
+ - 📝 **Type-safe** - Full TypeScript support with Zod schema validation
10
+ - 🎯 **Lightweight** - Minimal bundle size, only depends on `ky` and `zod`
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @cushin/api-runtime ky zod
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ### Define your API configuration
21
+
22
+ ```typescript
23
+ import { defineConfig, defineEndpoint } from "@cushin/api-runtime";
24
+ import { z } from "zod";
25
+
26
+ export const apiConfig = defineConfig({
27
+ baseUrl: "https://api.example.com",
28
+ endpoints: {
29
+ getUser: defineEndpoint({
30
+ path: "/users/:id",
31
+ method: "GET",
32
+ params: z.object({ id: z.string() }),
33
+ response: z.object({
34
+ id: z.string(),
35
+ name: z.string(),
36
+ email: z.string(),
37
+ }),
38
+ }),
39
+ },
40
+ });
41
+ ```
42
+
43
+ ### Create API client
44
+
45
+ ```typescript
46
+ import { createAPIClient } from "@cushin/api-runtime";
47
+ import { apiConfig } from "./api-config";
48
+
49
+ const client = createAPIClient(apiConfig, {
50
+ getTokens: async () => ({
51
+ accessToken: localStorage.getItem("token") || "",
52
+ }),
53
+ onAuthError: () => {
54
+ // Redirect to login
55
+ },
56
+ onRefreshToken: async () => {
57
+ // Refresh your token
58
+ },
59
+ });
60
+
61
+ // Use the client
62
+ const user = await client.getUser({ id: "123" });
63
+ ```
64
+
65
+ ## Key Components
66
+
67
+ ### `createAPIClient(config, authCallbacks?)`
68
+
69
+ Creates a type-safe API client with automatic token injection and refresh.
70
+
71
+ ### `defineConfig(config)`
72
+
73
+ Helper function to define your API configuration with type inference.
74
+
75
+ ### `defineEndpoint(config)`
76
+
77
+ Helper function to define individual endpoints with full type safety.
78
+
79
+ ## Why separate from @cushin/api-codegen?
80
+
81
+ The runtime code needs to be imported by your web application, while the code generation tools (`@cushin/api-codegen`) contain Node.js-specific code (file system, path manipulation, etc.) that cannot be bundled for the browser.
82
+
83
+ By separating the runtime into its own package:
84
+ - ✅ Your web app can import runtime code without bundling Node.js dependencies
85
+ - ✅ Smaller bundle size for your application
86
+ - ✅ Clear separation of concerns
87
+
88
+ ## Related Packages
89
+
90
+ - **[@cushin/api-codegen](../api-codegen)** - CLI tool to generate type-safe API clients
91
+ - **[@cushin/codegen-cli](../cli)** - Shared CLI utilities
92
+
93
+ ## License
94
+
95
+ MIT
@@ -0,0 +1,17 @@
1
+ // src/schema.ts
2
+ function defineConfig(config) {
3
+ return config;
4
+ }
5
+ function defineEndpoint(config) {
6
+ return config;
7
+ }
8
+ function defineEndpoints(endpoints) {
9
+ return endpoints;
10
+ }
11
+
12
+ export {
13
+ defineConfig,
14
+ defineEndpoint,
15
+ defineEndpoints
16
+ };
17
+ //# sourceMappingURL=chunk-3FFXWCVP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schema.ts"],"sourcesContent":["import type { z } from \"zod\";\n\nexport type HTTPMethod = \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\nexport interface APIEndpoint {\n path: string;\n method: HTTPMethod;\n baseUrl?: string;\n params?: z.ZodType<any>;\n query?: z.ZodType<any>;\n body?: z.ZodType<any>;\n response: z.ZodType<any>;\n tags?: string[];\n description?: string;\n headers?: Record<string, string | undefined | null>;\n}\n\nexport interface APIConfig {\n baseUrl?: string;\n endpoints: Record<string, APIEndpoint>;\n}\n\nexport type EndpointConfig<\n TPath extends string = string,\n TMethod extends HTTPMethod = HTTPMethod,\n TParams = undefined,\n TQuery = undefined,\n TBody = undefined,\n TResponse = any,\n> = {\n path: TPath;\n method: TMethod;\n baseUrl?: string;\n params?: z.ZodType<TParams>;\n query?: z.ZodType<TQuery>;\n body?: z.ZodType<TBody>;\n response: z.ZodType<TResponse>;\n tags?: string[];\n description?: string;\n headers?: Record<string, string | undefined | null>;\n};\n\n/**\n * Helper function to define API configuration with type safety\n */\nexport function defineConfig<T extends APIConfig>(config: T): T {\n return config;\n}\n\n/**\n * Helper function to define a single endpoint with type inference\n */\nexport function defineEndpoint<\n TPath extends string,\n TMethod extends HTTPMethod,\n TParams = undefined,\n TQuery = undefined,\n TBody = undefined,\n TResponse = any,\n>(\n config: EndpointConfig<TPath, TMethod, TParams, TQuery, TBody, TResponse>,\n): EndpointConfig<TPath, TMethod, TParams, TQuery, TBody, TResponse> {\n return config;\n}\n\n/**\n * Helper to define multiple endpoints\n */\nexport function defineEndpoints<T extends Record<string, APIEndpoint>>(\n endpoints: T,\n): T {\n return endpoints;\n}\n"],"mappings":";AA6CO,SAAS,aAAkC,QAAc;AAC9D,SAAO;AACT;AAKO,SAAS,eAQd,QACmE;AACnE,SAAO;AACT;AAKO,SAAS,gBACd,WACG;AACH,SAAO;AACT;","names":[]}
@@ -0,0 +1,267 @@
1
+ // src/client.ts
2
+ import ky, { HTTPError } from "ky";
3
+ var APIError = class extends Error {
4
+ constructor(message, status, response) {
5
+ super(message);
6
+ this.status = status;
7
+ this.response = response;
8
+ this.name = "APIError";
9
+ }
10
+ };
11
+ var AuthError = class extends APIError {
12
+ constructor(message = "Authentication failed") {
13
+ super(message, 401);
14
+ this.name = "AuthError";
15
+ }
16
+ };
17
+ var APIClient = class {
18
+ constructor(config, authCallbacks) {
19
+ this.config = config;
20
+ this.authCallbacks = authCallbacks;
21
+ this.hooks = {
22
+ beforeRequest: [
23
+ async (request) => {
24
+ const tokens = await this.authCallbacks?.getTokens();
25
+ if (tokens?.accessToken) {
26
+ request.headers.set(
27
+ "Authorization",
28
+ `Bearer ${tokens.accessToken}`
29
+ );
30
+ }
31
+ }
32
+ ],
33
+ beforeRetry: [
34
+ async ({ request, error, retryCount }) => {
35
+ if (error instanceof HTTPError && error.response.status === 401) {
36
+ if (retryCount === 1 && this.authCallbacks) {
37
+ try {
38
+ await this.refreshTokens();
39
+ const tokens = await this.authCallbacks.getTokens();
40
+ if (tokens?.accessToken) {
41
+ request.headers.set(
42
+ "Authorization",
43
+ `Bearer ${tokens.accessToken}`
44
+ );
45
+ }
46
+ } catch (refreshError) {
47
+ this.authCallbacks.onAuthError?.();
48
+ throw new AuthError();
49
+ }
50
+ } else {
51
+ this.authCallbacks?.onAuthError?.();
52
+ throw new AuthError();
53
+ }
54
+ }
55
+ }
56
+ ],
57
+ beforeError: [
58
+ async (error) => {
59
+ const { response } = error;
60
+ if (response?.body) {
61
+ try {
62
+ const body = await response.json();
63
+ error.message = body.message || `HTTP ${response.status}`;
64
+ } catch {
65
+ }
66
+ }
67
+ return error;
68
+ }
69
+ ]
70
+ };
71
+ this.client = ky.create({
72
+ prefixUrl: this.config.baseUrl,
73
+ retry: {
74
+ limit: 2,
75
+ methods: ["get", "post", "put", "delete", "patch"],
76
+ statusCodes: [401]
77
+ },
78
+ hooks: this.hooks
79
+ });
80
+ }
81
+ client;
82
+ isRefreshing = false;
83
+ refreshPromise = null;
84
+ hooks;
85
+ async refreshTokens() {
86
+ if (!this.authCallbacks) {
87
+ throw new AuthError("No auth callbacks provided");
88
+ }
89
+ if (this.isRefreshing && this.refreshPromise) {
90
+ return this.refreshPromise;
91
+ }
92
+ this.isRefreshing = true;
93
+ this.refreshPromise = (async () => {
94
+ try {
95
+ if (this.authCallbacks?.onRefreshToken) {
96
+ await this.authCallbacks.onRefreshToken();
97
+ } else {
98
+ throw new AuthError("No refresh token handler provided");
99
+ }
100
+ } catch (error) {
101
+ throw error;
102
+ } finally {
103
+ this.isRefreshing = false;
104
+ this.refreshPromise = null;
105
+ }
106
+ })();
107
+ return this.refreshPromise;
108
+ }
109
+ buildPath(path, params) {
110
+ if (!params) return path;
111
+ let finalPath = path;
112
+ Object.entries(params).forEach(([key, value]) => {
113
+ finalPath = finalPath.replace(
114
+ `:${key}`,
115
+ encodeURIComponent(String(value))
116
+ );
117
+ });
118
+ return finalPath;
119
+ }
120
+ getEndpointBaseUrl(endpoint) {
121
+ return endpoint.baseUrl || this.config.baseUrl;
122
+ }
123
+ getClientForEndpoint(endpoint) {
124
+ const endpointBaseUrl = this.getEndpointBaseUrl(endpoint);
125
+ if (endpointBaseUrl === this.config.baseUrl) {
126
+ return this.client;
127
+ }
128
+ return ky.create({
129
+ prefixUrl: endpointBaseUrl,
130
+ retry: {
131
+ limit: 2,
132
+ methods: ["get", "post", "put", "delete", "patch"],
133
+ statusCodes: [401]
134
+ },
135
+ hooks: this.hooks
136
+ });
137
+ }
138
+ async request(endpoint, params, query, body) {
139
+ try {
140
+ const path = this.buildPath(endpoint.path, params);
141
+ const client = this.getClientForEndpoint(endpoint);
142
+ const options = {
143
+ method: endpoint.method,
144
+ headers: {
145
+ "Accept-Encoding": "gzip, deflate, br"
146
+ }
147
+ };
148
+ if (query && Object.keys(query).length > 0) {
149
+ const searchParams = new URLSearchParams();
150
+ Object.entries(query).forEach(([key, value]) => {
151
+ if (value !== void 0 && value !== null) {
152
+ searchParams.append(key, String(value));
153
+ }
154
+ });
155
+ if (searchParams.toString()) {
156
+ options.searchParams = searchParams;
157
+ }
158
+ }
159
+ const isFormData = body instanceof FormData;
160
+ if (body && endpoint.method !== "GET") {
161
+ if (isFormData) {
162
+ options.body = body;
163
+ } else if (endpoint.body) {
164
+ const validatedBody = endpoint.body.parse(body);
165
+ options.json = validatedBody;
166
+ } else {
167
+ options.json = body;
168
+ }
169
+ }
170
+ if (endpoint.headers) {
171
+ Object.entries(endpoint.headers).forEach(([key, value]) => {
172
+ if (isFormData && key.toLowerCase() === "content-type") {
173
+ return;
174
+ }
175
+ if (value !== void 0 && value !== null) {
176
+ options.headers[key] = value;
177
+ } else if (value === void 0 || value === null) {
178
+ delete options.headers[key];
179
+ }
180
+ });
181
+ }
182
+ const response = await client(path, options);
183
+ const data = await response.json();
184
+ if (endpoint.response) {
185
+ return endpoint.response.parse(data);
186
+ }
187
+ return data;
188
+ } catch (error) {
189
+ if (error instanceof HTTPError) {
190
+ const errorData = await error.response.json().catch(() => ({}));
191
+ throw new APIError(
192
+ errorData.message || error.message,
193
+ error.response.status,
194
+ errorData
195
+ );
196
+ }
197
+ if (error instanceof AuthError) {
198
+ throw error;
199
+ }
200
+ throw new APIError(
201
+ error instanceof Error ? error.message : "Network error",
202
+ 0
203
+ );
204
+ }
205
+ }
206
+ updateAuthCallbacks(authCallbacks) {
207
+ this.authCallbacks = authCallbacks;
208
+ }
209
+ async refreshAuth() {
210
+ if (!this.authCallbacks) {
211
+ throw new AuthError("No auth callbacks provided");
212
+ }
213
+ await this.refreshTokens();
214
+ }
215
+ generateMethods() {
216
+ const methods = {};
217
+ Object.entries(this.config.endpoints).forEach(([name, endpoint]) => {
218
+ if (endpoint.method === "GET") {
219
+ if (endpoint.params && endpoint.query) {
220
+ methods[name] = (params, query) => {
221
+ return this.request(endpoint, params, query);
222
+ };
223
+ } else if (endpoint.params) {
224
+ methods[name] = (params) => {
225
+ return this.request(endpoint, params);
226
+ };
227
+ } else if (endpoint.query) {
228
+ methods[name] = (query) => {
229
+ return this.request(endpoint, void 0, query);
230
+ };
231
+ } else {
232
+ methods[name] = () => {
233
+ return this.request(endpoint);
234
+ };
235
+ }
236
+ } else {
237
+ if (endpoint.params) {
238
+ methods[name] = (params, body) => {
239
+ return this.request(endpoint, params, void 0, body);
240
+ };
241
+ } else {
242
+ methods[name] = (body) => {
243
+ return this.request(endpoint, void 0, void 0, body);
244
+ };
245
+ }
246
+ }
247
+ });
248
+ return methods;
249
+ }
250
+ };
251
+ function createAPIClient(config, authCallbacks) {
252
+ const instance = new APIClient(config, authCallbacks);
253
+ const methods = instance.generateMethods();
254
+ return {
255
+ ...methods,
256
+ refreshAuth: () => instance.refreshAuth(),
257
+ updateAuthCallbacks: (newCallbacks) => instance.updateAuthCallbacks(newCallbacks)
258
+ };
259
+ }
260
+
261
+ export {
262
+ APIError,
263
+ AuthError,
264
+ APIClient,
265
+ createAPIClient
266
+ };
267
+ //# sourceMappingURL=chunk-EZ5P7OPH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client.ts"],"sourcesContent":["import ky, { HTTPError } from \"ky\";\nimport type { APIConfig, APIEndpoint } from \"./schema.js\";\n\nexport interface AuthTokens {\n accessToken: string;\n refreshToken?: string;\n}\n\nexport interface AuthCallbacks {\n getTokens: () => Promise<AuthTokens | null>;\n onAuthError?: () => void;\n onRefreshToken?: () => Promise<void>;\n}\n\nexport class APIError extends Error {\n constructor(\n message: string,\n public status: number,\n public response?: any,\n ) {\n super(message);\n this.name = \"APIError\";\n }\n}\n\nexport class AuthError extends APIError {\n constructor(message: string = \"Authentication failed\") {\n super(message, 401);\n this.name = \"AuthError\";\n }\n}\n\nexport class APIClient {\n private client: typeof ky;\n private isRefreshing = false;\n private refreshPromise: Promise<void> | null = null;\n private hooks: any;\n\n constructor(\n private config: APIConfig,\n private authCallbacks?: AuthCallbacks,\n ) {\n this.hooks = {\n beforeRequest: [\n async (request: Request) => {\n const tokens = await this.authCallbacks?.getTokens();\n if (tokens?.accessToken) {\n request.headers.set(\n \"Authorization\",\n `Bearer ${tokens.accessToken}`,\n );\n }\n },\n ],\n beforeRetry: [\n async ({ request, error, retryCount }: any) => {\n if (error instanceof HTTPError && error.response.status === 401) {\n if (retryCount === 1 && this.authCallbacks) {\n try {\n await this.refreshTokens();\n const tokens = await this.authCallbacks.getTokens();\n if (tokens?.accessToken) {\n request.headers.set(\n \"Authorization\",\n `Bearer ${tokens.accessToken}`,\n );\n }\n } catch (refreshError) {\n this.authCallbacks.onAuthError?.();\n throw new AuthError();\n }\n } else {\n this.authCallbacks?.onAuthError?.();\n throw new AuthError();\n }\n }\n },\n ],\n beforeError: [\n async (error: any) => {\n const { response } = error;\n if (response?.body) {\n try {\n const body = await response.json();\n error.message =\n (body as Error).message || `HTTP ${response.status}`;\n } catch {\n // Keep original message\n }\n }\n return error;\n },\n ],\n };\n\n this.client = ky.create({\n prefixUrl: this.config.baseUrl,\n retry: {\n limit: 2,\n methods: [\"get\", \"post\", \"put\", \"delete\", \"patch\"],\n statusCodes: [401],\n },\n hooks: this.hooks,\n });\n }\n\n private async refreshTokens(): Promise<void> {\n if (!this.authCallbacks) {\n throw new AuthError(\"No auth callbacks provided\");\n }\n\n if (this.isRefreshing && this.refreshPromise) {\n return this.refreshPromise;\n }\n\n this.isRefreshing = true;\n\n this.refreshPromise = (async () => {\n try {\n if (this.authCallbacks?.onRefreshToken) {\n await this.authCallbacks.onRefreshToken();\n } else {\n throw new AuthError(\"No refresh token handler provided\");\n }\n } catch (error) {\n throw error;\n } finally {\n this.isRefreshing = false;\n this.refreshPromise = null;\n }\n })();\n\n return this.refreshPromise;\n }\n\n private buildPath(path: string, params?: Record<string, any>): string {\n if (!params) return path;\n\n let finalPath = path;\n Object.entries(params).forEach(([key, value]) => {\n finalPath = finalPath.replace(\n `:${key}`,\n encodeURIComponent(String(value)),\n );\n });\n\n return finalPath;\n }\n\n private getEndpointBaseUrl(endpoint: APIEndpoint): string {\n return endpoint.baseUrl || this.config.baseUrl!;\n }\n\n private getClientForEndpoint(endpoint: APIEndpoint): typeof ky {\n const endpointBaseUrl = this.getEndpointBaseUrl(endpoint);\n\n if (endpointBaseUrl === this.config.baseUrl) {\n return this.client;\n }\n\n return ky.create({\n prefixUrl: endpointBaseUrl,\n retry: {\n limit: 2,\n methods: [\"get\", \"post\", \"put\", \"delete\", \"patch\"],\n statusCodes: [401],\n },\n hooks: this.hooks,\n });\n }\n\n async request<T>(\n endpoint: APIEndpoint,\n params?: Record<string, any>,\n query?: Record<string, any>,\n body?: any,\n ): Promise<T> {\n try {\n const path = this.buildPath(endpoint.path, params);\n const client = this.getClientForEndpoint(endpoint);\n\n const options: Record<string, any> = {\n method: endpoint.method,\n headers: {\n \"Accept-Encoding\": \"gzip, deflate, br\",\n },\n };\n\n if (query && Object.keys(query).length > 0) {\n const searchParams = new URLSearchParams();\n Object.entries(query).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n searchParams.append(key, String(value));\n }\n });\n if (searchParams.toString()) {\n options.searchParams = searchParams;\n }\n }\n\n // Track if body is FormData to prevent Content-Type override\n const isFormData = body instanceof FormData;\n\n // Handle body and set appropriate Content-Type\n if (body && endpoint.method !== \"GET\") {\n // Check if body is FormData\n if (isFormData) {\n options.body = body;\n // DO NOT set Content-Type for FormData\n // Browser/HTTP client will automatically set multipart/form-data with boundary\n } else if (endpoint.body) {\n const validatedBody = endpoint.body.parse(body);\n options.json = validatedBody;\n // ky automatically sets Content-Type: application/json when using options.json\n } else {\n options.json = body;\n // ky automatically sets Content-Type: application/json when using options.json\n }\n }\n // Do not set Content-Type for GET requests or requests without body\n\n // Apply custom headers AFTER body processing\n // IMPORTANT: Never override Content-Type for FormData\n if (endpoint.headers) {\n Object.entries(endpoint.headers).forEach(([key, value]) => {\n // Skip Content-Type header if body is FormData\n if (\n isFormData &&\n key.toLowerCase() === \"content-type\"\n ) {\n // Ignore Content-Type header for FormData to prevent boundary issues\n return;\n }\n\n if (value !== undefined && value !== null) {\n options.headers[key] = value;\n } else if (value === undefined || value === null) {\n // Allow explicitly unsetting headers\n delete options.headers[key];\n }\n });\n }\n\n const response = await client(path, options);\n const data = await response.json();\n\n if (endpoint.response) {\n return endpoint.response.parse(data);\n }\n\n return data as T;\n } catch (error) {\n if (error instanceof HTTPError) {\n const errorData = await error.response.json().catch(() => ({}));\n throw new APIError(\n errorData.message || error.message,\n error.response.status,\n errorData,\n );\n }\n\n if (error instanceof AuthError) {\n throw error;\n }\n\n throw new APIError(\n error instanceof Error ? error.message : \"Network error\",\n 0,\n );\n }\n }\n\n updateAuthCallbacks(authCallbacks: AuthCallbacks) {\n this.authCallbacks = authCallbacks;\n }\n\n async refreshAuth(): Promise<void> {\n if (!this.authCallbacks) {\n throw new AuthError(\"No auth callbacks provided\");\n }\n await this.refreshTokens();\n }\n\n generateMethods() {\n const methods: any = {};\n\n Object.entries(this.config.endpoints).forEach(([name, endpoint]) => {\n if (endpoint.method === \"GET\") {\n if (endpoint.params && endpoint.query) {\n methods[name] = (params: any, query?: any): Promise<any> => {\n return this.request(endpoint, params, query);\n };\n } else if (endpoint.params) {\n methods[name] = (params: any): Promise<any> => {\n return this.request(endpoint, params);\n };\n } else if (endpoint.query) {\n methods[name] = (query?: any): Promise<any> => {\n return this.request(endpoint, undefined, query);\n };\n } else {\n methods[name] = (): Promise<any> => {\n return this.request(endpoint);\n };\n }\n } else {\n // For non-GET methods (POST, PUT, PATCH, DELETE)\n // Always support body parameter to allow FormData and other dynamic bodies\n if (endpoint.params) {\n methods[name] = (params: any, body?: any): Promise<any> => {\n return this.request(endpoint, params, undefined, body);\n };\n } else {\n // Always allow optional body parameter for non-GET methods\n methods[name] = (body?: any): Promise<any> => {\n return this.request(endpoint, undefined, undefined, body);\n };\n }\n }\n });\n\n return methods;\n }\n}\n\nexport function createAPIClient(\n config: APIConfig,\n authCallbacks?: AuthCallbacks,\n) {\n const instance = new APIClient(config, authCallbacks);\n const methods = instance.generateMethods();\n\n return {\n ...methods,\n refreshAuth: () => instance.refreshAuth(),\n updateAuthCallbacks: (newCallbacks: AuthCallbacks) =>\n instance.updateAuthCallbacks(newCallbacks),\n };\n}\n"],"mappings":";AAAA,OAAO,MAAM,iBAAiB;AAcvB,IAAM,WAAN,cAAuB,MAAM;AAAA,EAClC,YACE,SACO,QACA,UACP;AACA,UAAM,OAAO;AAHN;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,YAAN,cAAwB,SAAS;AAAA,EACtC,YAAY,UAAkB,yBAAyB;AACrD,UAAM,SAAS,GAAG;AAClB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,YAAN,MAAgB;AAAA,EAMrB,YACU,QACA,eACR;AAFQ;AACA;AAER,SAAK,QAAQ;AAAA,MACX,eAAe;AAAA,QACb,OAAO,YAAqB;AAC1B,gBAAM,SAAS,MAAM,KAAK,eAAe,UAAU;AACnD,cAAI,QAAQ,aAAa;AACvB,oBAAQ,QAAQ;AAAA,cACd;AAAA,cACA,UAAU,OAAO,WAAW;AAAA,YAC9B;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MACA,aAAa;AAAA,QACX,OAAO,EAAE,SAAS,OAAO,WAAW,MAAW;AAC7C,cAAI,iBAAiB,aAAa,MAAM,SAAS,WAAW,KAAK;AAC/D,gBAAI,eAAe,KAAK,KAAK,eAAe;AAC1C,kBAAI;AACF,sBAAM,KAAK,cAAc;AACzB,sBAAM,SAAS,MAAM,KAAK,cAAc,UAAU;AAClD,oBAAI,QAAQ,aAAa;AACvB,0BAAQ,QAAQ;AAAA,oBACd;AAAA,oBACA,UAAU,OAAO,WAAW;A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,CAAC;AAED,WAAO;AAAA,EACT;AACF;AAEO,SAAS,gBACd,QACA,eACA;AACA,QAAM,WAAW,IAAI,UAAU,QAAQ,aAAa;AACpD,QAAM,UAAU,SAAS,gBAAgB;AAEzC,SAAO;AAAA,IACL,GAAG;AAAA,IACH,aAAa,MAAM,SAAS,YAAY;AAAA,IACxC,qBAAqB,CAAC,iBACpB,SAAS,oBAAoB,YAAY;AAAA,EAC7C;AACF;","names":[]}
@@ -0,0 +1,40 @@
1
+ import { APIConfig, APIEndpoint } from './schema.js';
2
+ import 'zod';
3
+
4
+ interface AuthTokens {
5
+ accessToken: string;
6
+ refreshToken?: string;
7
+ }
8
+ interface AuthCallbacks {
9
+ getTokens: () => Promise<AuthTokens | null>;
10
+ onAuthError?: () => void;
11
+ onRefreshToken?: () => Promise<void>;
12
+ }
13
+ declare class APIError extends Error {
14
+ status: number;
15
+ response?: any | undefined;
16
+ constructor(message: string, status: number, response?: any | undefined);
17
+ }
18
+ declare class AuthError extends APIError {
19
+ constructor(message?: string);
20
+ }
21
+ declare class APIClient {
22
+ private config;
23
+ private authCallbacks?;
24
+ private client;
25
+ private isRefreshing;
26
+ private refreshPromise;
27
+ private hooks;
28
+ constructor(config: APIConfig, authCallbacks?: AuthCallbacks | undefined);
29
+ private refreshTokens;
30
+ private buildPath;
31
+ private getEndpointBaseUrl;
32
+ private getClientForEndpoint;
33
+ request<T>(endpoint: APIEndpoint, params?: Record<string, any>, query?: Record<string, any>, body?: any): Promise<T>;
34
+ updateAuthCallbacks(authCallbacks: AuthCallbacks): void;
35
+ refreshAuth(): Promise<void>;
36
+ generateMethods(): any;
37
+ }
38
+ declare function createAPIClient(config: APIConfig, authCallbacks?: AuthCallbacks): any;
39
+
40
+ export { APIClient, APIError, type AuthCallbacks, AuthError, type AuthTokens, createAPIClient };
@@ -0,0 +1,13 @@
1
+ import {
2
+ APIClient,
3
+ APIError,
4
+ AuthError,
5
+ createAPIClient
6
+ } from "./chunk-EZ5P7OPH.js";
7
+ export {
8
+ APIClient,
9
+ APIError,
10
+ AuthError,
11
+ createAPIClient
12
+ };
13
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,3 @@
1
+ export { APIConfig, APIEndpoint, EndpointConfig, HTTPMethod, defineConfig, defineEndpoint, defineEndpoints } from './schema.js';
2
+ export { APIClient, APIError, AuthCallbacks, AuthError, AuthTokens, createAPIClient } from './client.js';
3
+ import 'zod';
@@ -0,0 +1,21 @@
1
+ import {
2
+ APIClient,
3
+ APIError,
4
+ AuthError,
5
+ createAPIClient
6
+ } from "./chunk-EZ5P7OPH.js";
7
+ import {
8
+ defineConfig,
9
+ defineEndpoint,
10
+ defineEndpoints
11
+ } from "./chunk-3FFXWCVP.js";
12
+ export {
13
+ APIClient,
14
+ APIError,
15
+ AuthError,
16
+ createAPIClient,
17
+ defineConfig,
18
+ defineEndpoint,
19
+ defineEndpoints
20
+ };
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod';
2
+
3
+ type HTTPMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
4
+ interface APIEndpoint {
5
+ path: string;
6
+ method: HTTPMethod;
7
+ baseUrl?: string;
8
+ params?: z.ZodType<any>;
9
+ query?: z.ZodType<any>;
10
+ body?: z.ZodType<any>;
11
+ response: z.ZodType<any>;
12
+ tags?: string[];
13
+ description?: string;
14
+ headers?: Record<string, string | undefined | null>;
15
+ }
16
+ interface APIConfig {
17
+ baseUrl?: string;
18
+ endpoints: Record<string, APIEndpoint>;
19
+ }
20
+ type EndpointConfig<TPath extends string = string, TMethod extends HTTPMethod = HTTPMethod, TParams = undefined, TQuery = undefined, TBody = undefined, TResponse = any> = {
21
+ path: TPath;
22
+ method: TMethod;
23
+ baseUrl?: string;
24
+ params?: z.ZodType<TParams>;
25
+ query?: z.ZodType<TQuery>;
26
+ body?: z.ZodType<TBody>;
27
+ response: z.ZodType<TResponse>;
28
+ tags?: string[];
29
+ description?: string;
30
+ headers?: Record<string, string | undefined | null>;
31
+ };
32
+ /**
33
+ * Helper function to define API configuration with type safety
34
+ */
35
+ declare function defineConfig<T extends APIConfig>(config: T): T;
36
+ /**
37
+ * Helper function to define a single endpoint with type inference
38
+ */
39
+ declare function defineEndpoint<TPath extends string, TMethod extends HTTPMethod, TParams = undefined, TQuery = undefined, TBody = undefined, TResponse = any>(config: EndpointConfig<TPath, TMethod, TParams, TQuery, TBody, TResponse>): EndpointConfig<TPath, TMethod, TParams, TQuery, TBody, TResponse>;
40
+ /**
41
+ * Helper to define multiple endpoints
42
+ */
43
+ declare function defineEndpoints<T extends Record<string, APIEndpoint>>(endpoints: T): T;
44
+
45
+ export { type APIConfig, type APIEndpoint, type EndpointConfig, type HTTPMethod, defineConfig, defineEndpoint, defineEndpoints };
@@ -0,0 +1,11 @@
1
+ import {
2
+ defineConfig,
3
+ defineEndpoint,
4
+ defineEndpoints
5
+ } from "./chunk-3FFXWCVP.js";
6
+ export {
7
+ defineConfig,
8
+ defineEndpoint,
9
+ defineEndpoints
10
+ };
11
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/hash/work/node/codegen/node_modules/.pnpm/esbuild@0.27.0/node_modules/esbuild/bin/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/esbuild@0.27.0/node_modules/esbuild/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/esbuild@0.27.0/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/hash/work/node/codegen/node_modules/.pnpm/esbuild@0.27.0/node_modules/esbuild/bin/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/esbuild@0.27.0/node_modules/esbuild/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/esbuild@0.27.0/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/esbuild@0.27.0/node_modules/esbuild/bin/esbuild" "$@"
19
+ else
20
+ exec node "$basedir/../../../../node_modules/.pnpm/esbuild@0.27.0/node_modules/esbuild/bin/esbuild" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/hash/work/node/codegen/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/jiti@2.6.1/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/hash/work/node/codegen/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/jiti@2.6.1/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti-cli.mjs" "$@"
19
+ else
20
+ exec node "$basedir/../../../../node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti-cli.mjs" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
19
+ else
20
+ exec node "$basedir/../typescript/bin/tsc" "$@"
21
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*|*MINGW*|*MSYS*)
6
+ if command -v cygpath > /dev/null 2>&1; then
7
+ basedir=`cygpath -w "$basedir"`
8
+ fi
9
+ ;;
10
+ esac
11
+
12
+ if [ -z "$NODE_PATH" ]; then
13
+ export NODE_PATH="/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/node_modules"
14
+ else
15
+ export NODE_PATH="/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/typescript@5.9.3/node_modules:/home/hash/work/node/codegen/node_modules/.pnpm/node_modules:$NODE_PATH"
16
+ fi
17
+ if [ -x "$basedir/node" ]; then
18
+ exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
19
+ else
20
+ exec node "$basedir/../typescript/bin/tsserver" "$@"
21
+ fi