@azure/core-client

中文文档
1.11.2发布于 2026/11/08MITTypeScriptESM + CJS近 30 天下载 8945.4万

Core library for interfacing with AutoRest generated code

原始使用文档
文档目录10 节
  1. Getting started
  2. Currently supported environments
  3. Installation
  4. Key concepts
  5. ServiceClient
  6. createClientPipeline
  7. Mappers / createSerializer
  8. Next steps
  9. Troubleshooting
  10. Contributing

Azure Core Service client library for JavaScript

This library is primarily intended to be used in code generated by AutoRest and autorest.typescript.

Getting started

Currently supported environments

See our support policy for more details.

Installation

This package is primarily used in generated code and not meant to be consumed directly by end users.

Key concepts

ServiceClient

This is the common base class for generated clients. It provides the methods sendOperationRequest and sendRequest.

sendRequest simply makes an HTTP request using a Pipeline (see @azure/core-rest-pipeline for details.)

sendOperationRequest is used by generated code to make a request using an OperationSpec and OperationArguments. An OperationSpec is a translation of request requirements from the OpenAPI/Swagger file that describes the service.

createClientPipeline

This method is used to create a Pipeline instance that is customized with extra policies that perform serialization and deserialization. The bulk of the work is in converting requests into the right HTTP message that a service expects and then converting the HTTP response payload into the response shape described by the service's OpenAPI specification file.

Mappers / createSerializer

Mappers are used to encode and decode data into HTTP headers and bodies. They describe all request and response fields. They are referenced by OperationSpecs.

The method createSerializer creates a Serializer that is used to do the bulk of the work transforming data when making a request or processing a response. Given a corpus of Mappers and the appropriate OperationSpec it can manufacture an HTTP request object from a user provided input or convert an HTTP response object into a user-friendly form.

Next steps

You can build and run the tests locally by executing npm run test. Explore the test folder to see advanced usage and behavior of the public classes.

Learn more about the TypeSpec @azure-tools/typespec-ts emitter for generating a compatible client on top of this package.

Troubleshooting

If you run into issues while using this library, please feel free to file an issue.

Contributing

If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.

版本与发布记录

@azure/core-client 共发布 463 个版本,首次发布于 2020/09/26;过去 12 个月发布了 33 个版本。

版本发布日期距今
1.11.2latest2026/11/08今天
1.11.12026/09/042 个月前
1.11.02026/07/143 个月前
1.10.22026/06/055 个月前
1.10.2-alpha.20260311.2dev2026/03/127 个月前
1.10.2-alpha.20260306.42026/03/078 个月前

关于 @azure/core-client 的常见问题

@azure/core-client 是什么?

Core library for interfacing with AutoRest generated code

如何安装 @azure/core-client?

在项目目录运行 npm install @azure/core-client,或使用 pnpm add / yarn add / bun add。

@azure/core-client 支持 TypeScript 吗?

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

@azure/core-client 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@azure/core-client 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@azure/core-client 可以商用吗?

@azure/core-client 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@azure/core-client 的下载量有多少?

根据 npm 官方下载统计,@azure/core-client 在 2026/10/08 – 2026/11/06 这 30 天内被下载 89,454,232 次,日均约 2,981,808 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@azure/core-client 还在维护吗?

最新版本 1.11.2 发布于 2026/11/08(今天);至今共发布 463 个版本,其中过去 12 个月发布了 33 个;首次发布于 2020/09/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。