@xutest1/sdk 0.1.5 → 0.1.7

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/client.js CHANGED
@@ -1,11 +1,71 @@
1
- export * from "./gen/types.gen.js";
2
- export { OpencodeClient };
3
- export { OpencodeClient as A3codeClient };
4
- import { createClient } from "./gen/client/client.gen.js";
5
- import { OpencodeClient } from "./gen/sdk.gen.js";
6
- export function createOpencodeClient(config) {
7
- const client = createClient(config);
8
- return new OpencodeClient({ client });
1
+ import { createClient } from "@hey-api/client-fetch";
2
+
3
+ export function createA3codeClient(options) {
4
+ const client = createClient({
5
+ baseUrl: options?.baseUrl ?? "http://localhost:4096",
6
+ });
7
+
8
+ return {
9
+ session: {
10
+ async create(opts) {
11
+ return client.post({ url: "/session", body: opts?.body ?? {} });
12
+ },
13
+ async get(opts) {
14
+ return client.get({ url: `/session/${opts.path.id}` });
15
+ },
16
+ async list() {
17
+ return client.get({ url: "/session" });
18
+ },
19
+ async delete(opts) {
20
+ return client.delete({ url: `/session/${opts.path.id}` });
21
+ },
22
+ async prompt(opts) {
23
+ return client.post({ url: `/session/${opts.path.id}/message`, body: opts.body });
24
+ },
25
+ async messages(opts) {
26
+ return client.get({ url: `/session/${opts.path.id}/message` });
27
+ },
28
+ async abort(opts) {
29
+ return client.post({ url: `/session/${opts.path.id}/abort` });
30
+ },
31
+ },
32
+ config: {
33
+ async get() {
34
+ return client.get({ url: "/config" });
35
+ },
36
+ async update(opts) {
37
+ return client.patch({ url: "/config", body: opts?.body });
38
+ },
39
+ async providers() {
40
+ return client.get({ url: "/config/providers" });
41
+ },
42
+ },
43
+ event: {
44
+ async subscribe() {
45
+ return client.get({ url: "/event" });
46
+ },
47
+ },
48
+ file: {
49
+ async list(opts) {
50
+ return client.get({ url: "/file", query: opts?.query });
51
+ },
52
+ async read(opts) {
53
+ return client.get({ url: "/file/content", query: opts?.query });
54
+ },
55
+ },
56
+ mcp: {
57
+ async status() {
58
+ return client.get({ url: "/mcp" });
59
+ },
60
+ async refresh() {
61
+ return client.post({ url: "/mcp/refresh" });
62
+ },
63
+ async enable(opts) {
64
+ return client.post({ url: `/mcp/${opts.path.name}/enable` });
65
+ },
66
+ async disable(opts) {
67
+ return client.post({ url: `/mcp/${opts.path.name}/disable` });
68
+ },
69
+ },
70
+ };
9
71
  }
10
- // A3code alias
11
- export const createA3codeClient = createOpencodeClient;
package/index.d.ts CHANGED
@@ -1,15 +1,50 @@
1
1
  export * from "./client.js";
2
2
  export * from "./server.js";
3
- import { createOpencodeClient } from "./client.js";
4
- import { createOpencodeServer } from "./server.js";
5
- import type { ServerOptions } from "./server.js";
6
- export declare function createA3code(options?: ServerOptions): Promise<{
7
- client: import("./client.js").OpencodeClient;
8
- server: {
9
- url: string;
10
- close(): void;
3
+
4
+ export interface A3codeOptions {
5
+ port?: number;
6
+ config?: Record<string, any>;
7
+ }
8
+
9
+ export interface A3codeServer {
10
+ url: string;
11
+ stop(): void;
12
+ }
13
+
14
+ export interface A3codeClient {
15
+ session: {
16
+ create(opts?: { body?: Record<string, any> }): Promise<any>;
17
+ get(opts: { path: { id: string } }): Promise<any>;
18
+ list(): Promise<any>;
19
+ delete(opts: { path: { id: string } }): Promise<any>;
20
+ prompt(opts: { path: { id: string }; body: any }): Promise<any>;
21
+ messages(opts: { path: { id: string } }): Promise<any>;
22
+ abort(opts: { path: { id: string } }): Promise<any>;
11
23
  };
24
+ config: {
25
+ get(): Promise<any>;
26
+ update(opts?: { body?: Record<string, any> }): Promise<any>;
27
+ providers(): Promise<any>;
28
+ };
29
+ event: {
30
+ subscribe(): Promise<any>;
31
+ };
32
+ file: {
33
+ list(opts?: { query?: Record<string, any> }): Promise<any>;
34
+ read(opts?: { query?: Record<string, any> }): Promise<any>;
35
+ };
36
+ mcp: {
37
+ status(): Promise<any>;
38
+ refresh(): Promise<any>;
39
+ enable(opts: { path: { name: string } }): Promise<any>;
40
+ disable(opts: { path: { name: string } }): Promise<any>;
41
+ };
42
+ }
43
+
44
+ export function createA3code(options?: A3codeOptions): Promise<{
45
+ client: A3codeClient;
46
+ server: A3codeServer;
12
47
  }>;
13
- export declare const createOpencode: typeof createA3code;
14
- export { createOpencodeClient as createA3codeClient };
15
- export { createOpencodeServer as createA3codeServer };
48
+
49
+ export function createA3codeClient(options?: { baseUrl?: string }): A3codeClient;
50
+ export function createA3CodeServer(options?: A3codeOptions): Promise<A3codeServer>;
package/index.js CHANGED
@@ -1,13 +1,18 @@
1
1
  export * from "./client.js";
2
2
  export * from "./server.js";
3
- import { createOpencodeClient } from "./client.js";
4
- import { createOpencodeServer } from "./server.js";
5
- // Main function - spawns server + creates client
3
+ import { createA3codeClient } from "./client.js";
4
+ import { createA3CodeServer } from "./server.js";
5
+
6
+ /**
7
+ * Create an A3CODE instance with server and client
8
+ * @param {Object} options - Configuration options
9
+ * @param {number} [options.port] - Port number (default: random available port)
10
+ * @param {Object} [options.config] - A3CODE configuration
11
+ * @returns {Promise<{client: Object, server: Object}>}
12
+ */
6
13
  export async function createA3code(options) {
7
- const server = await createOpencodeServer({
8
- ...options,
9
- });
10
- const client = createOpencodeClient({
14
+ const server = await createA3CodeServer(options);
15
+ const client = createA3codeClient({
11
16
  baseUrl: server.url,
12
17
  });
13
18
  return {
@@ -15,8 +20,3 @@ export async function createA3code(options) {
15
20
  server,
16
21
  };
17
22
  }
18
- // Alias for backward compatibility
19
- export const createOpencode = createA3code;
20
- // Re-export with A3code naming
21
- export { createOpencodeClient as createA3codeClient };
22
- export { createOpencodeServer as createA3codeServer };
package/package.json CHANGED
@@ -1,16 +1,33 @@
1
1
  {
2
2
  "name": "@xutest1/sdk",
3
- "version": "0.1.5",
4
- "description": "Type-safe SDK for A3Code AI coding agent",
5
- "author": "A3Code",
6
- "license": "MIT",
7
- "keywords": ["a3code", "ai", "sdk", "coding", "agent", "vllm"],
8
- "type": "module",
3
+ "version": "0.1.7",
4
+ "description": "A3CODE SDK - AI coding assistant SDK",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
9
7
  "exports": {
10
- ".": {"import": "./index.js", "types": "./index.d.ts"},
11
- "./client": {"import": "./client.js", "types": "./client.d.ts"},
12
- "./server": {"import": "./server.js", "types": "./server.d.ts"}
8
+ ".": {
9
+ "import": "./index.js",
10
+ "require": "./index.cjs",
11
+ "types": "./index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "*.js",
16
+ "*.cjs",
17
+ "*.d.ts"
18
+ ],
19
+ "keywords": ["a3code", "ai", "sdk", "coding", "assistant"],
20
+ "author": "A3CODE",
21
+ "license": "MIT",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/a3code/sdk"
13
25
  },
14
- "main": "./index.js",
15
- "types": "./index.d.ts"
26
+ "optionalDependencies": {
27
+ "@xutest1/darwin-arm64": "0.1.7",
28
+ "@xutest1/darwin-x64": "0.1.7",
29
+ "@xutest1/linux-arm64": "0.1.7",
30
+ "@xutest1/linux-x64": "0.1.7",
31
+ "@xutest1/windows-x64": "0.1.7"
32
+ }
16
33
  }
package/server.js CHANGED
@@ -3,20 +3,17 @@ import { existsSync } from "node:fs";
3
3
  import { join, dirname } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { platform, arch } from "node:os";
6
- // ES module equivalent of __dirname
6
+
7
7
  const __filename = fileURLToPath(import.meta.url);
8
8
  const __dirname = dirname(__filename);
9
- /**
10
- * Find the ae3code binary - checks node_modules first, then falls back to PATH
11
- */
9
+
12
10
  function findBinary() {
13
11
  const os = platform();
14
12
  const cpu = arch();
15
- // Map Node.js platform/arch to package names
16
13
  const platformMap = {
17
14
  darwin: "darwin",
18
15
  linux: "linux",
19
- win32: "win32",
16
+ win32: "windows",
20
17
  };
21
18
  const archMap = {
22
19
  arm64: "arm64",
@@ -25,13 +22,10 @@ function findBinary() {
25
22
  const pkgPlatform = platformMap[os];
26
23
  const pkgArch = archMap[cpu];
27
24
  if (pkgPlatform && pkgArch) {
28
- // Try to find in node_modules/@xutest1/{platform}-{arch}/bin/ae3code
29
25
  const binaryName = os === "win32" ? "ae3code.exe" : "ae3code";
30
26
  const possiblePaths = [
31
- // Relative to cwd
32
27
  join(process.cwd(), "node_modules", "@xutest1", `${pkgPlatform}-${pkgArch}`, "bin", binaryName),
33
- // Relative to this file (for when SDK is in node_modules)
34
- join(__dirname, "..", `@xutest1`, `${pkgPlatform}-${pkgArch}`, "bin", binaryName),
28
+ join(__dirname, "..", `${pkgPlatform}-${pkgArch}`, "bin", binaryName),
35
29
  ];
36
30
  for (const binPath of possiblePaths) {
37
31
  if (existsSync(binPath)) {
@@ -39,15 +33,16 @@ function findBinary() {
39
33
  }
40
34
  }
41
35
  }
42
- // Fall back to PATH
43
36
  return "ae3code";
44
37
  }
45
- export async function createOpencodeServer(options) {
38
+
39
+ export async function createA3CodeServer(options) {
46
40
  options = Object.assign({
47
41
  hostname: "127.0.0.1",
48
- port: 4096,
49
- timeout: 5000,
42
+ port: 0,
43
+ timeout: 10000,
50
44
  }, options ?? {});
45
+
51
46
  const binaryPath = findBinary();
52
47
  const proc = spawn(binaryPath, [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`], {
53
48
  signal: options.signal,
@@ -56,6 +51,7 @@ export async function createOpencodeServer(options) {
56
51
  AE3CODE_CONFIG_CONTENT: JSON.stringify(options.config ?? {}),
57
52
  },
58
53
  });
54
+
59
55
  const url = await new Promise((resolve, reject) => {
60
56
  const id = setTimeout(() => {
61
57
  reject(new Error(`Timeout waiting for server to start after ${options.timeout}ms`));
@@ -65,10 +61,10 @@ export async function createOpencodeServer(options) {
65
61
  output += chunk.toString();
66
62
  const lines = output.split("\n");
67
63
  for (const line of lines) {
68
- if (line.startsWith("opencode server listening") || line.startsWith("ae3code server listening")) {
64
+ if (line.includes("server listening")) {
69
65
  const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
70
66
  if (!match) {
71
- throw new Error(`Failed to parse server url from output: ${line}`);
67
+ continue;
72
68
  }
73
69
  clearTimeout(id);
74
70
  resolve(match[1]);
@@ -98,38 +94,10 @@ export async function createOpencodeServer(options) {
98
94
  });
99
95
  }
100
96
  });
97
+
101
98
  return {
102
99
  url,
103
- close() {
104
- proc.kill();
105
- },
106
- };
107
- }
108
- export function createOpencodeTui(options) {
109
- const args = [];
110
- if (options?.project) {
111
- args.push(`--project=${options.project}`);
112
- }
113
- if (options?.model) {
114
- args.push(`--model=${options.model}`);
115
- }
116
- if (options?.session) {
117
- args.push(`--session=${options.session}`);
118
- }
119
- if (options?.agent) {
120
- args.push(`--agent=${options.agent}`);
121
- }
122
- const binaryPath = findBinary();
123
- const proc = spawn(binaryPath, args, {
124
- signal: options?.signal,
125
- stdio: "inherit",
126
- env: {
127
- ...process.env,
128
- AE3CODE_CONFIG_CONTENT: JSON.stringify(options?.config ?? {}),
129
- },
130
- });
131
- return {
132
- close() {
100
+ stop() {
133
101
  proc.kill();
134
102
  },
135
103
  };
package/client.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from "./gen/types.gen.js";
2
- export { type Config as OpencodeClientConfig, OpencodeClient };
3
- export { type Config as A3codeClientConfig };
4
- export { OpencodeClient as A3codeClient };
5
- import { type Config } from "./gen/client/types.gen.js";
6
- import { OpencodeClient } from "./gen/sdk.gen.js";
7
- export declare function createOpencodeClient(config?: Config): OpencodeClient;
8
- export declare const createA3codeClient: typeof createOpencodeClient;
@@ -1,2 +0,0 @@
1
- import type { Client, Config } from "./types.gen.js";
2
- export declare const createClient: (config?: Config) => Client;
@@ -1,167 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- import { createSseClient } from "../core/serverSentEvents.gen.js";
3
- import { buildUrl, createConfig, createInterceptors, getParseAs, mergeConfigs, mergeHeaders, setAuthParams, } from "./utils.gen.js";
4
- export const createClient = (config = {}) => {
5
- let _config = mergeConfigs(createConfig(), config);
6
- const getConfig = () => ({ ..._config });
7
- const setConfig = (config) => {
8
- _config = mergeConfigs(_config, config);
9
- return getConfig();
10
- };
11
- const interceptors = createInterceptors();
12
- const beforeRequest = async (options) => {
13
- const opts = {
14
- ..._config,
15
- ...options,
16
- fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
17
- headers: mergeHeaders(_config.headers, options.headers),
18
- serializedBody: undefined,
19
- };
20
- if (opts.security) {
21
- await setAuthParams({
22
- ...opts,
23
- security: opts.security,
24
- });
25
- }
26
- if (opts.requestValidator) {
27
- await opts.requestValidator(opts);
28
- }
29
- if (opts.body && opts.bodySerializer) {
30
- opts.serializedBody = opts.bodySerializer(opts.body);
31
- }
32
- // remove Content-Type header if body is empty to avoid sending invalid requests
33
- if (opts.serializedBody === undefined || opts.serializedBody === "") {
34
- opts.headers.delete("Content-Type");
35
- }
36
- const url = buildUrl(opts);
37
- return { opts, url };
38
- };
39
- const request = async (options) => {
40
- // @ts-expect-error
41
- const { opts, url } = await beforeRequest(options);
42
- const requestInit = {
43
- redirect: "follow",
44
- ...opts,
45
- body: opts.serializedBody,
46
- };
47
- let request = new Request(url, requestInit);
48
- for (const fn of interceptors.request._fns) {
49
- if (fn) {
50
- request = await fn(request, opts);
51
- }
52
- }
53
- // fetch must be assigned here, otherwise it would throw the error:
54
- // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
55
- const _fetch = opts.fetch;
56
- let response = await _fetch(request);
57
- for (const fn of interceptors.response._fns) {
58
- if (fn) {
59
- response = await fn(response, request, opts);
60
- }
61
- }
62
- const result = {
63
- request,
64
- response,
65
- };
66
- if (response.ok) {
67
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
68
- return opts.responseStyle === "data"
69
- ? {}
70
- : {
71
- data: {},
72
- ...result,
73
- };
74
- }
75
- const parseAs = (opts.parseAs === "auto"
76
- ? getParseAs(response.headers.get("Content-Type"))
77
- : opts.parseAs) ?? "json";
78
- let data;
79
- switch (parseAs) {
80
- case "arrayBuffer":
81
- case "blob":
82
- case "formData":
83
- case "json":
84
- case "text":
85
- data = await response[parseAs]();
86
- break;
87
- case "stream":
88
- return opts.responseStyle === "data"
89
- ? response.body
90
- : {
91
- data: response.body,
92
- ...result,
93
- };
94
- }
95
- if (parseAs === "json") {
96
- if (opts.responseValidator) {
97
- await opts.responseValidator(data);
98
- }
99
- if (opts.responseTransformer) {
100
- data = await opts.responseTransformer(data);
101
- }
102
- }
103
- return opts.responseStyle === "data"
104
- ? data
105
- : {
106
- data,
107
- ...result,
108
- };
109
- }
110
- const textError = await response.text();
111
- let jsonError;
112
- try {
113
- jsonError = JSON.parse(textError);
114
- }
115
- catch {
116
- // noop
117
- }
118
- const error = jsonError ?? textError;
119
- let finalError = error;
120
- for (const fn of interceptors.error._fns) {
121
- if (fn) {
122
- finalError = (await fn(error, response, request, opts));
123
- }
124
- }
125
- finalError = finalError || {};
126
- if (opts.throwOnError) {
127
- throw finalError;
128
- }
129
- // TODO: we probably want to return error and improve types
130
- return opts.responseStyle === "data"
131
- ? undefined
132
- : {
133
- error: finalError,
134
- ...result,
135
- };
136
- };
137
- const makeMethod = (method) => {
138
- const fn = (options) => request({ ...options, method });
139
- fn.sse = async (options) => {
140
- const { opts, url } = await beforeRequest(options);
141
- return createSseClient({
142
- ...opts,
143
- body: opts.body,
144
- headers: opts.headers,
145
- method,
146
- url,
147
- });
148
- };
149
- return fn;
150
- };
151
- return {
152
- buildUrl,
153
- connect: makeMethod("CONNECT"),
154
- delete: makeMethod("DELETE"),
155
- get: makeMethod("GET"),
156
- getConfig,
157
- head: makeMethod("HEAD"),
158
- interceptors,
159
- options: makeMethod("OPTIONS"),
160
- patch: makeMethod("PATCH"),
161
- post: makeMethod("POST"),
162
- put: makeMethod("PUT"),
163
- request,
164
- setConfig,
165
- trace: makeMethod("TRACE"),
166
- };
167
- };
@@ -1,7 +0,0 @@
1
- export type { Auth } from "../core/auth.gen.js";
2
- export type { QuerySerializerOptions } from "../core/bodySerializer.gen.js";
3
- export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from "../core/bodySerializer.gen.js";
4
- export { buildClientParams } from "../core/params.gen.js";
5
- export { createClient } from "./client.gen.js";
6
- export type { Client, ClientOptions, Config, CreateClientConfig, Options, OptionsLegacyParser, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from "./types.gen.js";
7
- export { createConfig, mergeHeaders } from "./utils.gen.js";
@@ -1,5 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from "../core/bodySerializer.gen.js";
3
- export { buildClientParams } from "../core/params.gen.js";
4
- export { createClient } from "./client.gen.js";
5
- export { createConfig, mergeHeaders } from "./utils.gen.js";
@@ -1,127 +0,0 @@
1
- import type { Auth } from "../core/auth.gen.js";
2
- import type { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen.js";
3
- import type { Client as CoreClient, Config as CoreConfig } from "../core/types.gen.js";
4
- import type { Middleware } from "./utils.gen.js";
5
- export type ResponseStyle = "data" | "fields";
6
- export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, "body" | "headers" | "method">, CoreConfig {
7
- /**
8
- * Base URL for all requests made by this client.
9
- */
10
- baseUrl?: T["baseUrl"];
11
- /**
12
- * Fetch API implementation. You can use this option to provide a custom
13
- * fetch instance.
14
- *
15
- * @default globalThis.fetch
16
- */
17
- fetch?: (request: Request) => ReturnType<typeof fetch>;
18
- /**
19
- * Please don't use the Fetch client for Next.js applications. The `next`
20
- * options won't have any effect.
21
- *
22
- * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
23
- */
24
- next?: never;
25
- /**
26
- * Return the response data parsed in a specified format. By default, `auto`
27
- * will infer the appropriate method from the `Content-Type` response header.
28
- * You can override this behavior with any of the {@link Body} methods.
29
- * Select `stream` if you don't want to parse response data at all.
30
- *
31
- * @default 'auto'
32
- */
33
- parseAs?: "arrayBuffer" | "auto" | "blob" | "formData" | "json" | "stream" | "text";
34
- /**
35
- * Should we return only data or multiple fields (data, error, response, etc.)?
36
- *
37
- * @default 'fields'
38
- */
39
- responseStyle?: ResponseStyle;
40
- /**
41
- * Throw an error instead of returning it in the response?
42
- *
43
- * @default false
44
- */
45
- throwOnError?: T["throwOnError"];
46
- }
47
- export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
48
- responseStyle: TResponseStyle;
49
- throwOnError: ThrowOnError;
50
- }>, Pick<ServerSentEventsOptions<TData>, "onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay"> {
51
- /**
52
- * Any body that you want to add to your request.
53
- *
54
- * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
55
- */
56
- body?: unknown;
57
- path?: Record<string, unknown>;
58
- query?: Record<string, unknown>;
59
- /**
60
- * Security mechanism(s) to use for the request.
61
- */
62
- security?: ReadonlyArray<Auth>;
63
- url: Url;
64
- }
65
- export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
66
- serializedBody?: string;
67
- }
68
- export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = "fields"> = ThrowOnError extends true ? Promise<TResponseStyle extends "data" ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
69
- data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
70
- request: Request;
71
- response: Response;
72
- }> : Promise<TResponseStyle extends "data" ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
73
- data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
74
- error: undefined;
75
- } | {
76
- data: undefined;
77
- error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
78
- }) & {
79
- request: Request;
80
- response: Response;
81
- }>;
82
- export interface ClientOptions {
83
- baseUrl?: string;
84
- responseStyle?: ResponseStyle;
85
- throwOnError?: boolean;
86
- }
87
- type MethodFnBase = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
88
- type MethodFnServerSentEvents = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">) => Promise<ServerSentEventsResult<TData, TError>>;
89
- type MethodFn = MethodFnBase & {
90
- sse: MethodFnServerSentEvents;
91
- };
92
- type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method"> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
93
- type BuildUrlFn = <TData extends {
94
- body?: unknown;
95
- path?: Record<string, unknown>;
96
- query?: Record<string, unknown>;
97
- url: string;
98
- }>(options: Pick<TData, "url"> & Options<TData>) => string;
99
- export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn> & {
100
- interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
101
- };
102
- /**
103
- * The `createClientConfig()` function will be called on client initialization
104
- * and the returned object will become the client's initial configuration.
105
- *
106
- * You may want to initialize your client this way instead of calling
107
- * `setConfig()`. This is useful for example if you're using Next.js
108
- * to ensure your client always has the correct values.
109
- */
110
- export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
111
- export interface TDataShape {
112
- body?: unknown;
113
- headers?: unknown;
114
- path?: unknown;
115
- query?: unknown;
116
- url: string;
117
- }
118
- type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
119
- export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = "fields"> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, "body" | "path" | "query" | "url"> & Omit<TData, "url">;
120
- export type OptionsLegacyParser<TData = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = "fields"> = TData extends {
121
- body?: any;
122
- } ? TData extends {
123
- headers?: any;
124
- } ? OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body" | "headers" | "url"> & TData : OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body" | "url"> & TData & Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "headers"> : TData extends {
125
- headers?: any;
126
- } ? OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "headers" | "url"> & TData & Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body"> : OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "url"> & TData;
127
- export {};
@@ -1,2 +0,0 @@
1
- // This file is auto-generated by @hey-api/openapi-ts
2
- export {};