title: "@dynatrace-sdk/shared-client-utils"
description:
@dynatrace-sdk/shared-client-utils
npm install @dynatrace-sdk/shared-client-utils
Functions
apiGatewayErrorsHandler
apiGatewayErrorsHandler(response): Promise<void>
Handles errors from API Gateway responses.
Throws an ApiGatewayError if the response source is 'API Gateway'.
Parameters
| Name | Type | Description |
| response*required | HttpClientResponse | The HTTP response to check for API Gateway errors. |
getErrorMessage
getErrorMessage(errorBody,defaultMessage): [string](https://developer.mozilla.org/en-US/docs/Glossary/String)
Returns a user-friendly error message from an error body object.
Parameters
| Name | Type | Description |
| errorBody*required | unknown | The error object or response body to extract the message from. |
| defaultMessage*required | string | The default message to use if no error message is found. |
Returns
| Return type | Description |
| string | The extracted or default error message, possibly including details. |
mimeTypeToEncoding
mimeTypeToEncoding(mimeType,defaultEncoding?): Encoding
Maps a MIME type string to an Encoding.
Parameters
| Name | Type | Description |
| mimeType*required | string | The MIME type to convert (e.g., 'application/json'). |
| defaultEncoding | Encoding | The encoding to return if the MIME type isn't recognized. |
Returns
| Return type | Description |
| Encoding | The corresponding Encoding enum value, or the defaultEncoding if not recognized. |
toQueryString
toQueryString(rawQuery?,flags?): [string](https://developer.mozilla.org/en-US/docs/Glossary/String)
Converts an object of query parameters into a URL query string.
Parameters
| Name | Type | Description |
| rawQuery | QueryParamsType | The object containing query parameters. |
| flags | ParametersFlags | Flags to control parameter formatting (e.g., explode arrays). |
Returns
| Description |
| The resulting query string. |
transformFromFormData(formData,fields): T
Converts form data and field definitions into a typed object, applying transformations for JSON fields.
Parameters
| Name | Type | Description |
| formData*required | FormDataResponseBody | The form data to convert. |
| fields*required | Record<string | FormDataResponseFieldDefinition> | The field definitions for the form data. |
Returns
| Return type | Description |
| T | The resulting typed object. |
transformRequest(object,rules): T
Transforms an object by applying transformation rules before sending it in a request.
Parameters
| Name | Type | Description |
| object*required | T | The object to transform. |
| rules*required | TransformRulesParam | The transformation rules to apply. |
Returns
| Return type | Description |
| T | The transformed object. |
transformResponse(object,rules): T
Transforms an object by applying transformation rules after receiving it in a response.
Parameters
| Name | Type | Description |
| object*required | T | The object to transform. |
| rules*required | TransformRulesParam | The transformation rules to apply. |
Returns
| Return type | Description |
| T | The transformed object. |
transformToFormData(value,fields): FormDataRequestBody
Converts an object to a FormDataRequestBody using field definitions.
Parameters
| Name | Type | Description |
| value*required | T | The object to convert. |
| fields*required | Array<FormDataRequestFieldDefinition> | The field definitions for the form data. |
Returns
| Return type | Description |
| FormDataRequestBody | The resulting form data body. |
transformToFormDataField(value,field): FormDataRequestField | null
Converts a value to a FormDataRequestField based on the field definition.
Parameters
Returns
| Return type | Description |
| FormDataRequestField | null | The resulting form data field or null if not required and undefined. |
Interfaces
ApiClientOptions
Configuration for the API client.
Properties
| Name | Type |
| transformDates*required | boolean |
Properties
| Name | Type |
| key*required | string |
| required*required | boolean |
| type*required | "text" | "json" | "binary" |
Properties
| Name | Type |
| type*required | "text" | "binary" |
Properties
| Name | Type |
| transformations*required | Array<string | > |
| type*required | "json" |
ParametersFlags
Properties
关于 @dynatrace-sdk/shared-client-utils 的常见问题
@dynatrace-sdk/shared-client-utils 是什么?
--- title: "@dynatrace-sdk/shared-client-utils" description: ---注意:该包已被作者标记为弃用——Deprecated
如何安装 @dynatrace-sdk/shared-client-utils?
在项目目录运行 npm install @dynatrace-sdk/shared-client-utils,或使用 pnpm add / yarn add / bun add。
@dynatrace-sdk/shared-client-utils 支持 TypeScript 吗?
支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。
@dynatrace-sdk/shared-client-utils 支持 ESM 还是 CommonJS?
同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。
@dynatrace-sdk/shared-client-utils 可以商用吗?
@dynatrace-sdk/shared-client-utils 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。
@dynatrace-sdk/shared-client-utils 的下载量有多少?
根据 npm 官方下载统计,@dynatrace-sdk/shared-client-utils 在 2026/10/13 – 2026/11/11 这 30 天内被下载 10,603 次,日均约 353 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。
@dynatrace-sdk/shared-client-utils 还在维护吗?
最新版本 1.0.1 发布于 2025/07/15(1.3 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2025/07/15。作者已将其标记为弃用,新项目建议寻找替代方案。