mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-20 01:04:22 +01:00
chore(js-sdk): Compatible with nodenext (#1667)
This commit is contained in:
@@ -12,7 +12,10 @@ await $`bun dev generate > ${dir}/openapi.json`.cwd(path.resolve(dir, "../../ope
|
|||||||
|
|
||||||
await createClient({
|
await createClient({
|
||||||
input: "./openapi.json",
|
input: "./openapi.json",
|
||||||
output: "./src/gen",
|
output: {
|
||||||
|
path: "./src/gen",
|
||||||
|
tsConfigPath: path.join(dir, 'tsconfig.json')
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
{
|
{
|
||||||
name: "@hey-api/typescript",
|
name: "@hey-api/typescript",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
import type { ClientOptions } from "./types.gen"
|
import type { ClientOptions } from "./types.gen.js"
|
||||||
import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from "./client"
|
import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from "./client/index.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `createClientConfig()` function will be called on client initialization
|
* The `createClientConfig()` function will be called on client initialization
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Client, Config, RequestOptions } from "./types"
|
import type { Client, Config, RequestOptions } from "./types.js"
|
||||||
import {
|
import {
|
||||||
buildUrl,
|
buildUrl,
|
||||||
createConfig,
|
createConfig,
|
||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
mergeConfigs,
|
mergeConfigs,
|
||||||
mergeHeaders,
|
mergeHeaders,
|
||||||
setAuthParams,
|
setAuthParams,
|
||||||
} from "./utils"
|
} from "./utils.js"
|
||||||
|
|
||||||
type ReqInit = Omit<RequestInit, "body" | "headers"> & {
|
type ReqInit = Omit<RequestInit, "body" | "headers"> & {
|
||||||
body?: any
|
body?: any
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
export type { Auth } from "../core/auth"
|
export type { Auth } from "../core/auth.js"
|
||||||
export type { QuerySerializerOptions } from "../core/bodySerializer"
|
export type { QuerySerializerOptions } from "../core/bodySerializer.js"
|
||||||
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer } from "../core/bodySerializer"
|
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer } from "../core/bodySerializer.js"
|
||||||
export { buildClientParams } from "../core/params"
|
export { buildClientParams } from "../core/params.js"
|
||||||
export { createClient } from "./client"
|
export { createClient } from "./client.js"
|
||||||
export type {
|
export type {
|
||||||
Client,
|
Client,
|
||||||
ClientOptions,
|
ClientOptions,
|
||||||
@@ -14,5 +14,5 @@ export type {
|
|||||||
RequestResult,
|
RequestResult,
|
||||||
ResponseStyle,
|
ResponseStyle,
|
||||||
TDataShape,
|
TDataShape,
|
||||||
} from "./types"
|
} from "./types.js"
|
||||||
export { createConfig, mergeHeaders } from "./utils"
|
export { createConfig, mergeHeaders } from "./utils.js"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Auth } from "../core/auth"
|
import type { Auth } from "../core/auth.js"
|
||||||
import type { Client as CoreClient, Config as CoreConfig } from "../core/types"
|
import type { Client as CoreClient, Config as CoreConfig } from "../core/types.js"
|
||||||
import type { Middleware } from "./utils"
|
import type { Middleware } from "./utils.js"
|
||||||
|
|
||||||
export type ResponseStyle = "data" | "fields"
|
export type ResponseStyle = "data" | "fields"
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { getAuthToken } from "../core/auth"
|
import { getAuthToken } from "../core/auth.js"
|
||||||
import type { QuerySerializer, QuerySerializerOptions } from "../core/bodySerializer"
|
import type { QuerySerializer, QuerySerializerOptions } from "../core/bodySerializer.js"
|
||||||
import { jsonBodySerializer } from "../core/bodySerializer"
|
import { jsonBodySerializer } from "../core/bodySerializer.js"
|
||||||
import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from "../core/pathSerializer"
|
import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from "../core/pathSerializer.js"
|
||||||
import type { Client, ClientOptions, Config, RequestOptions } from "./types"
|
import type { Client, ClientOptions, Config, RequestOptions } from "./types.js"
|
||||||
|
|
||||||
interface PathSerializer {
|
interface PathSerializer {
|
||||||
path: Record<string, unknown>
|
path: Record<string, unknown>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { ArrayStyle, ObjectStyle, SerializerOptions } from "./pathSerializer"
|
import type { ArrayStyle, ObjectStyle, SerializerOptions } from "./pathSerializer.js"
|
||||||
|
|
||||||
export type QuerySerializer = (query: Record<string, unknown>) => string
|
export type QuerySerializer = (query: Record<string, unknown>) => string
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Auth, AuthToken } from "./auth"
|
import type { Auth, AuthToken } from "./auth.js"
|
||||||
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer"
|
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.js"
|
||||||
|
|
||||||
export interface Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never> {
|
export interface Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never> {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
import type { Options as ClientOptions, TDataShape, Client } from "./client"
|
import type { Options as ClientOptions, TDataShape, Client } from "./client/index.js"
|
||||||
import type {
|
import type {
|
||||||
EventSubscribeData,
|
EventSubscribeData,
|
||||||
EventSubscribeResponses,
|
EventSubscribeResponses,
|
||||||
@@ -73,8 +73,8 @@ import type {
|
|||||||
TuiClearPromptResponses,
|
TuiClearPromptResponses,
|
||||||
TuiExecuteCommandData,
|
TuiExecuteCommandData,
|
||||||
TuiExecuteCommandResponses,
|
TuiExecuteCommandResponses,
|
||||||
} from "./types.gen"
|
} from "./types.gen.js"
|
||||||
import { client as _heyApiClient } from "./client.gen"
|
import { client as _heyApiClient } from "./client.gen.js"
|
||||||
|
|
||||||
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<
|
||||||
TData,
|
TData,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { createClient } from "./gen/client/client"
|
import { createClient } from "./gen/client/client.js"
|
||||||
import { type Config } from "./gen/client/types"
|
import { type Config } from "./gen/client/types.js"
|
||||||
import { OpencodeClient } from "./gen/sdk.gen"
|
import { OpencodeClient } from "./gen/sdk.gen.js"
|
||||||
export * from "./gen/types.gen"
|
export * from "./gen/types.gen.js"
|
||||||
|
|
||||||
export function createOpencodeClient(config?: Config) {
|
export function createOpencodeClient(config?: Config) {
|
||||||
const client = createClient(config)
|
const client = createClient(config)
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
"extends": "@tsconfig/node22/tsconfig.json",
|
"extends": "@tsconfig/node22/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"module": "preserve",
|
"module": "nodenext",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "nodenext",
|
||||||
"lib": [
|
"lib": [
|
||||||
"es2022",
|
"es2022",
|
||||||
"dom",
|
"dom",
|
||||||
|
|||||||
Reference in New Issue
Block a user