@devfile/api

中文文档
2.3.0-1757407014发布于 2025/09/09Apache-2.0TypeScriptCommonJS近 30 天下载 7549

Typescript types for devfile api

原始使用文档
文档目录4 节
  1. kubernetes-client-typescript@false
  2. Building
  3. Publishing
  4. Consuming

kubernetes-client-typescript@false

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@false --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<your_api.RequestContext> { // Modify context here and return return Promise.resolve(context); }

post(context: your_api.ResponseContext): Promise<your_api.ResponseContext> {
    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<your_api.Pet> createdPet = api.addPet(p);

版本与发布记录

@devfile/api 共发布 115 个版本,首次发布于 2021/03/25;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.3.0-1757407014latest2025/09/091.2 年前
2.3.0-17544173732025/08/061.3 年前
2.3.0-17525317182025/07/151.3 年前
2.3.0-17478434752025/05/221.5 年前
2.3.0-17466443302025/05/081.5 年前
2.3.0-17411793682025/03/051.7 年前

关于 @devfile/api 的常见问题

@devfile/api 是什么?

Typescript types for devfile api

如何安装 @devfile/api?

在项目目录运行 npm install @devfile/api,或使用 pnpm add / yarn add / bun add。

@devfile/api 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@devfile/api 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@devfile/api 可以商用吗?

@devfile/api 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@devfile/api 的下载量有多少?

根据 npm 官方下载统计,@devfile/api 在 2026/10/12 – 2026/11/10 这 30 天内被下载 7,549 次,日均约 252 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@devfile/api 还在维护吗?

最新版本 2.3.0-1757407014 发布于 2025/09/09(1.2 年前);至今共发布 115 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/03/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。