@dynatrace-sdk/shared-client-utils

中文文档
1.0.1发布于 2025/07/15Apache-2.0TypeScriptESM + CJS近 30 天下载 1.1万

--- title: "@dynatrace-sdk/shared-client-utils" description: ---

此软件包已被标记为弃用

Deprecated

原始使用文档
文档目录17 节
  1. title: "@dynatrace-sdk/shared-client-utils" description:
  2. Functions
  3. apiGatewayErrorsHandler
  4. getErrorMessage
  5. mimeTypeToEncoding
  6. toQueryString
  7. transformFromFormData
  8. transformRequest
  9. transformResponse
  10. transformToFormData
  11. transformToFormDataField
  12. Interfaces
  13. ApiClientOptions
  14. FormDataRequestFieldDefinition
  15. FormDataResponseGenericFieldDefinition
  16. FormDataResponseJsonFieldDefinition
  17. ParametersFlags

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

NameTypeDescription
response*requiredHttpClientResponseThe 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

NameTypeDescription
errorBody*requiredunknownThe error object or response body to extract the message from.
defaultMessage*requiredstringThe default message to use if no error message is found.

Returns

Return typeDescription
stringThe extracted or default error message, possibly including details.

mimeTypeToEncoding

mimeTypeToEncoding(mimeType,defaultEncoding?): Encoding

Maps a MIME type string to an Encoding.

Parameters

NameTypeDescription
mimeType*requiredstringThe MIME type to convert (e.g., 'application/json').
defaultEncodingEncodingThe encoding to return if the MIME type isn't recognized.

Returns

Return typeDescription
EncodingThe 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

NameTypeDescription
rawQueryQueryParamsTypeThe object containing query parameters.
flagsParametersFlagsFlags to control parameter formatting (e.g., explode arrays).

Returns

Description
The resulting query string.

transformFromFormData

transformFromFormData(formData,fields): T

Converts form data and field definitions into a typed object, applying transformations for JSON fields.

Parameters

NameTypeDescription
formData*requiredFormDataResponseBodyThe form data to convert.
fields*requiredRecord<string | FormDataResponseFieldDefinition>The field definitions for the form data.

Returns

Return typeDescription
TThe resulting typed object.

transformRequest

transformRequest(object,rules): T

Transforms an object by applying transformation rules before sending it in a request.

Parameters

NameTypeDescription
object*requiredTThe object to transform.
rules*requiredTransformRulesParamThe transformation rules to apply.

Returns

Return typeDescription
TThe transformed object.

transformResponse

transformResponse(object,rules): T

Transforms an object by applying transformation rules after receiving it in a response.

Parameters

NameTypeDescription
object*requiredTThe object to transform.
rules*requiredTransformRulesParamThe transformation rules to apply.

Returns

Return typeDescription
TThe transformed object.

transformToFormData

transformToFormData(value,fields): FormDataRequestBody

Converts an object to a FormDataRequestBody using field definitions.

Parameters

NameTypeDescription
value*requiredTThe object to convert.
fields*requiredArray<FormDataRequestFieldDefinition>The field definitions for the form data.

Returns

Return typeDescription
FormDataRequestBodyThe resulting form data body.

transformToFormDataField

transformToFormDataField(value,field): FormDataRequestField | null

Converts a value to a FormDataRequestField based on the field definition.

Parameters

NameTypeDescription
value*requiredTThe value to convert.
field*requiredFormDataRequestFieldDefinitionThe field definition.

Returns

Return typeDescription
FormDataRequestField | nullThe resulting form data field or null if not required and undefined.

Interfaces

ApiClientOptions

Configuration for the API client.

Properties

NameType
transformDates*requiredboolean

FormDataRequestFieldDefinition

Properties

NameType
key*requiredstring
required*requiredboolean
type*required"text" | "json" | "binary"

FormDataResponseGenericFieldDefinition

Properties

NameType
type*required"text" | "binary"

FormDataResponseJsonFieldDefinition

Properties

NameType
transformations*requiredArray<string | >
type*required"json"

ParametersFlags

Properties

NameType
explodeRecord<string | boolean>

版本与发布记录

@dynatrace-sdk/shared-client-utils 共发布 2 个版本,首次发布于 2025/07/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.1latest2025/07/151.3 年前
1.0.02025/06/111.4 年前

关于 @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。作者已将其标记为弃用,新项目建议寻找替代方案。