From faac313392f3b2fc9a98d0d2d275a05522c006d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Str=C3=BCbing?= Date: Sat, 7 Feb 2026 12:09:48 +0000 Subject: [PATCH] chore: regenerate --- settings | 2 +- src/gen/.openapi-generator/COMMIT | 4 +- src/gen/.openapi-generator/VERSION | 2 +- src/gen/README.md | 80 ++++++++++++++++++++++++++++++ src/gen/http/http.ts | 19 ++++--- src/gen/http/isomorphic-fetch.ts | 7 +-- 6 files changed, 99 insertions(+), 15 deletions(-) create mode 100644 src/gen/README.md diff --git a/settings b/settings index 88b18c470b..8711628a48 100644 --- a/settings +++ b/settings @@ -30,4 +30,4 @@ export CLIENT_VERSION="0.8-SNAPSHOT" # Name of the release package export PACKAGE_NAME="@kubernetes/node-client" -export OPENAPI_GENERATOR_COMMIT=6e0fe098f1d9631c696135c7a3c46e4b0dc9ab3f +export OPENAPI_GENERATOR_COMMIT=9fa18d0c8102322039676a9d11107a7cd00bf6ae diff --git a/src/gen/.openapi-generator/COMMIT b/src/gen/.openapi-generator/COMMIT index 2665a3427d..cc48a20582 100644 --- a/src/gen/.openapi-generator/COMMIT +++ b/src/gen/.openapi-generator/COMMIT @@ -1,2 +1,2 @@ -Requested Commit/Tag : 6e0fe098f1d9631c696135c7a3c46e4b0dc9ab3f -Actual Commit : 6e0fe098f1d9631c696135c7a3c46e4b0dc9ab3f +Requested Commit/Tag : 9fa18d0c8102322039676a9d11107a7cd00bf6ae +Actual Commit : 9fa18d0c8102322039676a9d11107a7cd00bf6ae diff --git a/src/gen/.openapi-generator/VERSION b/src/gen/.openapi-generator/VERSION index 2fb556b606..193a12d6e8 100644 --- a/src/gen/.openapi-generator/VERSION +++ b/src/gen/.openapi-generator/VERSION @@ -1 +1 @@ -7.18.0-SNAPSHOT +7.20.0-SNAPSHOT diff --git a/src/gen/README.md b/src/gen/README.md new file mode 100644 index 0000000000..902661a251 --- /dev/null +++ b/src/gen/README.md @@ -0,0 +1,80 @@ +## kubernetes-client-typescript@0.8-SNAPSHOT + +This generator creates TypeScript/JavaScript client that utilizes fetch-api. + +### Building + +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### Publishing + +First build the package then run ```npm publish``` + +### Consuming + +Navigate to the folder of your consuming project and run one of the following commands. + +_published:_ + +``` +npm install kubernetes-client-typescript@0.8-SNAPSHOT --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save +``` + +### Usage + +Below code snippet shows exemplary usage of the configuration and the API based +on the typical `PetStore` example used for OpenAPI. + +``` +import * as your_api from 'your_api_package' + +// Covers all auth methods included in your OpenAPI yaml definition +const authConfig: your_api.AuthMethodsConfiguration = { + "api_key": "YOUR_API_KEY" +} + +// Implements a simple middleware to modify requests before (`pre`) they are sent +// and after (`post`) they have been received +class Test implements your_api.Middleware { + pre(context: your_api.RequestContext): Promise { + // Modify context here and return + return Promise.resolve(context); + } + + post(context: your_api.ResponseContext): Promise { + return Promise.resolve(context); + } + +} + +// Create configuration parameter object +const configurationParameters = { + httpApi: new your_api.JQueryHttpLibrary(), // Can also be ignored - default is usually fine + baseServer: your_api.servers[0], // First server is default + authMethods: authConfig, // No auth is default + promiseMiddleware: [new Test()], +} + +// Convert to actual configuration +const config = your_api.createConfiguration(configurationParameters); + +// Use configuration with your_api +const api = new your_api.PetApi(config); +your_api.Pet p = new your_api.Pet(); +p.name = "My new pet"; +p.photoUrls = []; +p.tags = []; +p.status = "available"; +Promise createdPet = api.addPet(p); + +``` diff --git a/src/gen/http/http.ts b/src/gen/http/http.ts index 7be4c92d30..71aa728d7e 100644 --- a/src/gen/http/http.ts +++ b/src/gen/http/http.ts @@ -1,8 +1,7 @@ // TODO: evaluate if we can easily get rid of this library import FormData from "form-data"; import { URL, URLSearchParams } from 'url'; -import * as http from 'http'; -import * as https from 'https'; +import { type Dispatcher } from 'undici'; import { Observable, from } from '../rxjsStub.js'; export * from './isomorphic-fetch.js'; @@ -60,7 +59,7 @@ export class RequestContext { private body: RequestBody = undefined; private url: URL; private signal: AbortSignal | undefined = undefined; - private agent: http.Agent | https.Agent | undefined = undefined; + private dispatcher: Dispatcher | undefined = undefined; /** * Creates the request context using a http method and request resource url @@ -153,19 +152,19 @@ export class RequestContext { return this.signal; } - - public setAgent(agent: http.Agent | https.Agent) { - this.agent = agent; + public setDispatcher(dispatcher: Dispatcher): void { + this.dispatcher = dispatcher; } - public getAgent(): http.Agent | https.Agent | undefined { - return this.agent; + public getDispatcher(): Dispatcher | undefined { + return this.dispatcher; } } export interface ResponseBody { text(): Promise; binary(): Promise; + stream(): ReadableStream | null; } /** @@ -182,6 +181,10 @@ export class SelfDecodingBody implements ResponseBody { const data: Buffer = await this.dataSource; return data.toString(); } + + stream(): ReadableStream | null { + return null; + } } export class ResponseContext { diff --git a/src/gen/http/isomorphic-fetch.ts b/src/gen/http/isomorphic-fetch.ts index 2d3d6179aa..9744869b7c 100644 --- a/src/gen/http/isomorphic-fetch.ts +++ b/src/gen/http/isomorphic-fetch.ts @@ -1,6 +1,6 @@ import {HttpLibrary, RequestContext, ResponseContext} from './http.js'; import { from, Observable } from '../rxjsStub.js'; -import fetch from "node-fetch"; +import { fetch } from 'undici'; export class IsomorphicFetchHttpLibrary implements HttpLibrary { @@ -13,7 +13,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { body: body as any, headers: request.getHeaders(), signal: request.getSignal(), - agent: request.getAgent(), + dispatcher: request.getDispatcher(), }).then((resp: any) => { const headers: { [name: string]: string } = {}; resp.headers.forEach((value: string, name: string) => { @@ -22,7 +22,8 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { const body = { text: () => resp.text(), - binary: () => resp.buffer() + binary: () => resp.buffer(), + stream: () => resp.body }; return new ResponseContext(resp.status, headers, body); });