diff options
| author | Cole Leavitt <[email protected]> | 2026-01-16 10:11:07 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-16 11:11:07 -0600 |
| commit | d075c097acce5ef34f52b4758b039eec232bba0b (patch) | |
| tree | 9e20425ab2b4f35beed68bcd0b7fcc5ecd9ab7e2 /packages | |
| parent | 88fd6a294b3ad88d50cb8e1853589ee4e68dc74e (diff) | |
| download | opencode-d075c097acce5ef34f52b4758b039eec232bba0b.tar.gz opencode-d075c097acce5ef34f52b4758b039eec232bba0b.zip | |
chore(sdk): update @hey-api/openapi-ts to 0.90.4 (#8921)
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/sdk/js/package.json | 2 | ||||
| -rw-r--r-- | packages/sdk/js/src/v2/gen/client/client.gen.ts | 9 | ||||
| -rw-r--r-- | packages/sdk/js/src/v2/gen/core/serverSentEvents.gen.ts | 2 | ||||
| -rw-r--r-- | packages/sdk/js/src/v2/gen/sdk.gen.ts | 223 |
4 files changed, 167 insertions, 69 deletions
diff --git a/packages/sdk/js/package.json b/packages/sdk/js/package.json index ec9391a49..37b324f34 100644 --- a/packages/sdk/js/package.json +++ b/packages/sdk/js/package.json @@ -20,7 +20,7 @@ "dist" ], "devDependencies": { - "@hey-api/openapi-ts": "0.88.1", + "@hey-api/openapi-ts": "0.90.4", "@tsconfig/node22": "catalog:", "@types/node": "catalog:", "typescript": "catalog:", diff --git a/packages/sdk/js/src/v2/gen/client/client.gen.ts b/packages/sdk/js/src/v2/gen/client/client.gen.ts index 47f140342..627e98ec4 100644 --- a/packages/sdk/js/src/v2/gen/client/client.gen.ts +++ b/packages/sdk/js/src/v2/gen/client/client.gen.ts @@ -162,10 +162,16 @@ export const createClient = (config: Config = {}): Client => { case "arrayBuffer": case "blob": case "formData": - case "json": case "text": data = await response[parseAs]() break + case "json": { + // Some servers return 200 with no Content-Length and empty body. + // response.json() would throw; read as text and parse if non-empty. + const text = await response.text() + data = text ? JSON.parse(text) : {} + break + } case "stream": return opts.responseStyle === "data" ? response.body @@ -244,6 +250,7 @@ export const createClient = (config: Config = {}): Client => { } return request }, + serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined, url, }) } diff --git a/packages/sdk/js/src/v2/gen/core/serverSentEvents.gen.ts b/packages/sdk/js/src/v2/gen/core/serverSentEvents.gen.ts index 09ef3fb39..056a81259 100644 --- a/packages/sdk/js/src/v2/gen/core/serverSentEvents.gen.ts +++ b/packages/sdk/js/src/v2/gen/core/serverSentEvents.gen.ts @@ -151,6 +151,8 @@ export const createSseClient = <TData = unknown>({ const { done, value } = await reader.read() if (done) break buffer += value + // Normalize line endings: CRLF -> LF, then CR -> LF + buffer = buffer.replace(/\r\n/g, "\n").replace(/\r/g, "\n") const chunks = buffer.split("\n\n") buffer = chunks.pop() ?? "" diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts index 697dac7ee..09b193c7c 100644 --- a/packages/sdk/js/src/v2/gen/sdk.gen.ts +++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts @@ -7,7 +7,7 @@ import type { AppAgentsResponses, AppLogErrors, AppLogResponses, - Auth as Auth2, + Auth as Auth3, AuthSetErrors, AuthSetResponses, CommandListResponses, @@ -2023,7 +2023,10 @@ export class Provider extends HeyApiClient { }) } - oauth = new Oauth({ client: this.client }) + private _oauth?: Oauth + get oauth(): Oauth { + return (this._oauth ??= new Oauth({ client: this.client })) + } } export class Find extends HeyApiClient { @@ -2398,43 +2401,6 @@ export class Auth extends HeyApiClient { }, ) } - - /** - * Set auth credentials - * - * Set authentication credentials - */ - public set<ThrowOnError extends boolean = false>( - parameters: { - providerID: string - directory?: string - auth?: Auth2 - }, - options?: Options<never, ThrowOnError>, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "providerID" }, - { in: "query", key: "directory" }, - { key: "auth", map: "body" }, - ], - }, - ], - ) - return (options?.client ?? this.client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({ - url: "/auth/{providerID}", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } } export class Mcp extends HeyApiClient { @@ -2550,7 +2516,10 @@ export class Mcp extends HeyApiClient { }) } - auth = new Auth({ client: this.client }) + private _auth?: Auth + get auth(): Auth { + return (this._auth ??= new Auth({ client: this.client })) + } } export class Resource extends HeyApiClient { @@ -2575,7 +2544,10 @@ export class Resource extends HeyApiClient { } export class Experimental extends HeyApiClient { - resource = new Resource({ client: this.client }) + private _resource?: Resource + get resource(): Resource { + return (this._resource ??= new Resource({ client: this.client })) + } } export class Lsp extends HeyApiClient { @@ -2952,7 +2924,49 @@ export class Tui extends HeyApiClient { }) } - control = new Control({ client: this.client }) + private _control?: Control + get control(): Control { + return (this._control ??= new Control({ client: this.client })) + } +} + +export class Auth2 extends HeyApiClient { + /** + * Set auth credentials + * + * Set authentication credentials + */ + public set<ThrowOnError extends boolean = false>( + parameters: { + providerID: string + directory?: string + auth?: Auth3 + }, + options?: Options<never, ThrowOnError>, + ) { + const params = buildClientParams( + [parameters], + [ + { + args: [ + { in: "path", key: "providerID" }, + { in: "query", key: "directory" }, + { key: "auth", map: "body" }, + ], + }, + ], + ) + return (options?.client ?? this.client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({ + url: "/auth/{providerID}", + ...options, + ...params, + headers: { + "Content-Type": "application/json", + ...options?.headers, + ...params.headers, + }, + }) + } } export class Event extends HeyApiClient { @@ -2984,53 +2998,128 @@ export class OpencodeClient extends HeyApiClient { OpencodeClient.__registry.set(this, args?.key) } - global = new Global({ client: this.client }) + private _global?: Global + get global(): Global { + return (this._global ??= new Global({ client: this.client })) + } - project = new Project({ client: this.client }) + private _project?: Project + get project(): Project { + return (this._project ??= new Project({ client: this.client })) + } - pty = new Pty({ client: this.client }) + private _pty?: Pty + get pty(): Pty { + return (this._pty ??= new Pty({ client: this.client })) + } - config = new Config({ client: this.client }) + private _config?: Config + get config(): Config { + return (this._config ??= new Config({ client: this.client })) + } - tool = new Tool({ client: this.client }) + private _tool?: Tool + get tool(): Tool { + return (this._tool ??= new Tool({ client: this.client })) + } - instance = new Instance({ client: this.client }) + private _instance?: Instance + get instance(): Instance { + return (this._instance ??= new Instance({ client: this.client })) + } - path = new Path({ client: this.client }) + private _path?: Path + get path(): Path { + return (this._path ??= new Path({ client: this.client })) + } - worktree = new Worktree({ client: this.client }) + private _worktree?: Worktree + get worktree(): Worktree { + return (this._worktree ??= new Worktree({ client: this.client })) + } - vcs = new Vcs({ client: this.client }) + private _vcs?: Vcs + get vcs(): Vcs { + return (this._vcs ??= new Vcs({ client: this.client })) + } - session = new Session({ client: this.client }) + private _session?: Session + get session(): Session { + return (this._session ??= new Session({ client: this.client })) + } - part = new Part({ client: this.client }) + private _part?: Part + get part(): Part { + return (this._part ??= new Part({ client: this.client })) + } - permission = new Permission({ client: this.client }) + private _permission?: Permission + get permission(): Permission { + return (this._permission ??= new Permission({ client: this.client })) + } - question = new Question({ client: this.client }) + private _question?: Question + get question(): Question { + return (this._question ??= new Question({ client: this.client })) + } - command = new Command({ client: this.client }) + private _command?: Command + get command(): Command { + return (this._command ??= new Command({ client: this.client })) + } - provider = new Provider({ client: this.client }) + private _provider?: Provider + get provider(): Provider { + return (this._provider ??= new Provider({ client: this.client })) + } - find = new Find({ client: this.client }) + private _find?: Find + get find(): Find { + return (this._find ??= new Find({ client: this.client })) + } - file = new File({ client: this.client }) + private _file?: File + get file(): File { + return (this._file ??= new File({ client: this.client })) + } - app = new App({ client: this.client }) + private _app?: App + get app(): App { + return (this._app ??= new App({ client: this.client })) + } - mcp = new Mcp({ client: this.client }) + private _mcp?: Mcp + get mcp(): Mcp { + return (this._mcp ??= new Mcp({ client: this.client })) + } - experimental = new Experimental({ client: this.client }) + private _experimental?: Experimental + get experimental(): Experimental { + return (this._experimental ??= new Experimental({ client: this.client })) + } - lsp = new Lsp({ client: this.client }) + private _lsp?: Lsp + get lsp(): Lsp { + return (this._lsp ??= new Lsp({ client: this.client })) + } - formatter = new Formatter({ client: this.client }) + private _formatter?: Formatter + get formatter(): Formatter { + return (this._formatter ??= new Formatter({ client: this.client })) + } - tui = new Tui({ client: this.client }) + private _tui?: Tui + get tui(): Tui { + return (this._tui ??= new Tui({ client: this.client })) + } - auth = new Auth({ client: this.client }) + private _auth?: Auth2 + get auth(): Auth2 { + return (this._auth ??= new Auth2({ client: this.client })) + } - event = new Event({ client: this.client }) + private _event?: Event + get event(): Event { + return (this._event ??= new Event({ client: this.client })) + } } |
