Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dynatrace-sdk/client-app-settings

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dynatrace-sdk/client-app-settings - npm Package Compare versions

Comparing version 1.5.0 to 1.7.0

types/packages/client/app-settings/src/lib/utils/encoding.d.ts

16

CHANGELOG.md

@@ -5,2 +5,18 @@ # App Settings

## 1.7.0
### Minor Changes
- include "context" to the resolveEffectivePermissions response
### Patch Changes
- Add return types and improve usage examples inside JSDoc. APPDEV-7536
## 1.6.0
### Features
- Export errors from the package.
## 1.5.0

@@ -7,0 +23,0 @@

6

dynatrace-metadata.json
{
"dynagen": {
"version": "0.14.0",
"version": "0.15.2",
"generatedAt": "",
"template": {
"name": "@dynatrace-sdk/template-typescript-client",
"version": "0.22.1"
"version": "0.26.0"
}

@@ -12,5 +12,5 @@ },

"title": "App Settings",
"version": "1.1.0",
"version": "1.2.0",
"baseUrl": "/platform/app-settings/v1"
}
}
{
"name": "@dynatrace-sdk/client-app-settings",
"version": "1.5.0",
"version": "1.7.0",
"description": "Retrieve, update and manage app settings.",

@@ -9,3 +9,3 @@ "license": "Apache-2.0",

"@dynatrace-sdk/http-client": "^1.2.0",
"@dynatrace-sdk/shared-errors": "^0.0.2"
"@dynatrace-sdk/shared-errors": "^1.0.0"
},

@@ -12,0 +12,0 @@ "main": "./cjs/index.js",

# @dynatrace-sdk/client-app-settings
[![npm](https://img.shields.io/badge/npm-v1.5.0-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-app-settings/v/1.5.0)
[![npm](https://img.shields.io/badge/npm-v1.7.0-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-app-settings/v/1.7.0)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

@@ -66,3 +66,16 @@

#### Returns
| Return type | Status code | Description |
|---|---|---|
|void|204|Success. Response doesn't have a body.|
#### Throws
| Error Type | Error Message |
|---|---|
|AppSettingsErrorEnvelopeError|Failed. The input is invalid. \| Failed. Forbidden. \| Failed. The requested resource doesn't exist. \| Failed. Conflicting resource.|
<details>

@@ -120,5 +133,14 @@ <summary>

Success
| Return type | Status code | Description |
|---|---|---|
|[AppSettingsObject](#appsettingsobject)|200|Success|
#### Throws
| Error Type | Error Message |
|---|---|
|AppSettingsErrorEnvelopeError|Failed. The input is invalid. \| Failed. Forbidden. \| No object available for the given objectId|
<details>

@@ -185,5 +207,14 @@ <summary>

Success. Accessible objects returned.
| Return type | Status code | Description |
|---|---|---|
|[AppSettingsObjectsList](#appsettingsobjectslist)|200|Success. Accessible objects returned.|
#### Throws
| Error Type | Error Message |
|---|---|
|AppSettingsErrorEnvelopeError|Failed. The input is invalid. \| Failed. Forbidden. \| Failed. The specified schema was not found.|
<details>

@@ -245,5 +276,14 @@ <summary>

Success
| Return type | Status code | Description |
|---|---|---|
|[EffectiveAppSettingsValuesList](#effectiveappsettingsvalueslist)|200|Success|
#### Throws
| Error Type | Error Message |
|---|---|
|AppSettingsErrorEnvelopeError|Failed. The input is invalid. \| Failed. The specified schema is not found.|
<details>

@@ -300,5 +340,15 @@ <summary>

Created
| Return type | Status code | Description |
|---|---|---|
|void|200|Success. No validation errors.|
|[AppSettingsObjectResponse](#appsettingsobjectresponse)|201|Created|
#### Throws
| Error Type | Error Message |
|---|---|
|AppSettingsErrorEnvelopeError|Failed. The input is invalid. \| Failed. Forbidden. \| Failed. The requested resource doesn&apos;t exist. \| Failed. Conflicting resource.|
<details>

@@ -314,3 +364,3 @@ <summary>

await appSettingsObjectsClient.postAppSettingsObject({
body: { schemaId: "jira-connection" },
body: { schemaId: "jira-connection", value: {} },
});

@@ -359,3 +409,16 @@ ```

#### Returns
| Return type | Status code | Description |
|---|---|---|
|void|200|Success|
#### Throws
| Error Type | Error Message |
|---|---|
|AppSettingsErrorEnvelopeError|Failed. The input is invalid. \| Failed. Forbidden. \| Failed. The requested resource doesn&apos;t exist. \| Failed. Conflicting resource.|
<details>

@@ -374,3 +437,3 @@ <summary>

optimisticLockingVersion: "...",
body: {},
body: { value: {} },
},

@@ -414,7 +477,10 @@ );

#### Returns
Success
#### Throws
| Error Type | Error Message |
|---|---|
|AppSettingsErrorEnvelopeError|Failed. The input is invalid. \| Failed. Forbidden. No access to any schema. \| Failed.|
<details>

@@ -432,3 +498,9 @@ <summary>

body: {
permissions: [{ context: { schemaId: "..." } }],
permissions: [
{
permission:
SinglePermissionRequestPermission.AppSettingsObjectsRead,
context: { schemaId: "..." },
},
],
},

@@ -449,11 +521,6 @@ },

| Name | Type | Description |
| --- | --- | --- |
|code|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|The HTTP status code |
|details|<a href="#appsettingserrordetails">AppSettingsErrorDetails</a>| |
|details|<a href="#appsettingserrordetails">AppSettingsErrorDetails</a>|The error details |
|message<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The error message |

@@ -463,5 +530,2 @@

The error details

@@ -476,7 +540,2 @@

| Name | Type |

@@ -488,5 +547,2 @@ | --- | --- |

Modification information about the app setting.

@@ -503,5 +559,2 @@

A settings object.

@@ -511,5 +564,5 @@

| --- | --- | --- |
|modificationInfo|<a href="#appsettingsmodificationinfo" target="_blank" rel="noopener noreferrer">AppSettingsModificationInfo</a>| |
|modificationInfo|<a href="#appsettingsmodificationinfo" target="_blank" rel="noopener noreferrer">AppSettingsModificationInfo</a>|Modification information about the app setting. |
|objectId<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The ID of the settings object. |
|resourceContext|<a href="#resourcecontext">ResourceContext</a>| |
|resourceContext|<a href="#resourcecontext">ResourceContext</a>|The resource context, which contains additional permission information about the object. |
|schemaId|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The schema on which the object is based. |

@@ -519,3 +572,3 @@ |schemaVersion|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The version of the schema on which the object is based. |

|summary|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|A short summary of settings. This can contain Markdown and will be escaped accordingly. |
|value|AppSettingsValue| |
|value|AppSettingsValue|<p>The value of the setting.</p> <p>It defines the actual values of settings' parameters.</p> <p>The actual content depends on the object's schema.</p> |
|version<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|<p>The version of the object for optimistic locking. You can use it to detect simultaneous modifications by different users.</p> <p>It is generated upon retrieval (GET requests). If set on update (PUT request) or deletion, the update/deletion will be allowed only if there wasn't any change between the retrieval and the update.</p> |

@@ -525,5 +578,2 @@

Configuration of a new settings object.

@@ -535,9 +585,6 @@

|schemaId<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The schema on which the object is based. |
|value<sup>*required</sup>|AppSettingsValue| |
|value<sup>*required</sup>|AppSettingsValue|<p>The value of the setting.</p> <p>It defines the actual values of settings' parameters.</p> <p>The actual content depends on the object's schema.</p> |
### AppSettingsObjectResponse
The response to a creation request.

@@ -552,5 +599,2 @@

An update of a settings object.

@@ -562,9 +606,6 @@

|insertBefore|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|<p>The position of the updated object. The new object will be moved in front of the specified one.</p> <p><strong>insertAfter</strong> and <strong>insertBefore</strong> are evaluated together and only one of both can be set.</p> <p>If <code>null</code> and <strong>insertAfter</strong> 'null', the existing object keeps the current position.</p> <p>If set to empty string, the updated object will be placed in the last position.</p> <p>Only applicable for objects based on schemas with ordered objects (schema's <strong>ordered</strong> parameter is set to <code>true</code>).</p> |
|value<sup>*required</sup>|AppSettingsValue| |
|value<sup>*required</sup>|AppSettingsValue|<p>The value of the setting.</p> <p>It defines the actual values of settings' parameters.</p> <p>The actual content depends on the object's schema.</p> |
### AppSettingsObjectsList
A list of settings objects.

@@ -581,5 +622,2 @@

A list of constraint violations

@@ -596,5 +634,2 @@

An effective settings value.

@@ -604,3 +639,3 @@

| --- | --- | --- |
|modificationInfo|<a href="#appsettingsmodificationinfo">AppSettingsModificationInfo</a>| |
|modificationInfo|<a href="#appsettingsmodificationinfo">AppSettingsModificationInfo</a>|Modification information about the app setting. |
|schemaId|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The schema on which the object is based. |

@@ -610,9 +645,6 @@ |schemaVersion|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The version of the schema on which the object is based. |

|summary|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|A short summary of settings. This can contain Markdown and will be escaped accordingly. |
|value|AppSettingsValue| |
|value|AppSettingsValue|<p>The value of the setting.</p> <p>It defines the actual values of settings' parameters.</p> <p>The actual content depends on the object's schema.</p> |
### EffectiveAppSettingsValuesList
A list of effective settings values.

@@ -629,9 +661,5 @@

| Name | Type |
| --- | --- |
|context|<a href="#permissioncontext">PermissionContext</a>|
|granted<sup>*required</sup>|EffectivePermissionGranted|

@@ -642,17 +670,6 @@ |permission<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|

**type**: Array&lt;<a href="#effectivepermission" target="_blank" rel="noopener noreferrer">EffectivePermission</a>&gt;
extends `Array<EffectivePermission>`
| Name | Type | Description |
| --- | --- | --- |
|[unscopables]<sup>*required</sup>|Object|<p>Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.</p> |
|length<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|Gets or sets the length of the array. This is a number one higher than the highest index in the array. |
### Modifications
The additional modification details for this settings object.

@@ -669,7 +686,2 @@

| Name | Type |

@@ -681,7 +693,2 @@ | --- | --- |

| Name | Type |

@@ -693,5 +700,2 @@ | --- | --- |

The resource context, which contains additional permission information about the object.

@@ -701,3 +705,3 @@

| --- | --- | --- |
|modifications<sup>*required</sup>|<a href="#modifications" target="_blank" rel="noopener noreferrer">Modifications</a>| |
|modifications<sup>*required</sup>|<a href="#modifications" target="_blank" rel="noopener noreferrer">Modifications</a>|The additional modification details for this settings object. |
|operations<sup>*required</sup>|Array&lt;ResourceContextOperationsItem&gt;|The allowed operations on this settings object. |

@@ -707,5 +711,2 @@

optional generic set of context data

@@ -712,0 +713,0 @@

@@ -26,3 +26,3 @@ import { AbortSignal, HttpClient } from '@dynatrace-sdk/http-client';

*
* @returns Success
* @returns {Promise<AppSettingsObject>} Success
*

@@ -37,5 +37,3 @@ * @example <caption>Code example</caption>

*
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid.
* @throws {AppSettingsErrorEnvelopeError} Failed. Forbidden.
* @throws {AppSettingsErrorEnvelopeError} No object available for the given objectId
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid. | Failed. Forbidden. | No object available for the given objectId
* @throws {InvalidResponseError}

@@ -64,10 +62,7 @@ * @throws {ApiClientError}

* optimisticLockingVersion: "...",
* body: {},
* body: { value: {} },
* },
* );
*
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid.
* @throws {AppSettingsErrorEnvelopeError} Failed. Forbidden.
* @throws {AppSettingsErrorEnvelopeError} Failed. The requested resource doesn't exist.
* @throws {AppSettingsErrorEnvelopeError} Failed. Conflicting resource.
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid. | Failed. Forbidden. | Failed. The requested resource doesn't exist. | Failed. Conflicting resource.
* @throws {InvalidResponseError}

@@ -100,6 +95,3 @@ * @throws {ApiClientError}

*
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid.
* @throws {AppSettingsErrorEnvelopeError} Failed. Forbidden.
* @throws {AppSettingsErrorEnvelopeError} Failed. The requested resource doesn't exist.
* @throws {AppSettingsErrorEnvelopeError} Failed. Conflicting resource.
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid. | Failed. Forbidden. | Failed. The requested resource doesn't exist. | Failed. Conflicting resource.
* @throws {InvalidResponseError}

@@ -129,3 +121,3 @@ * @throws {ApiClientError}

*
* @returns Success. Accessible objects returned.
* @returns {Promise<AppSettingsObjectsList>} Success. Accessible objects returned.
*

@@ -138,5 +130,3 @@ * @example <caption>Code example</caption>

*
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid.
* @throws {AppSettingsErrorEnvelopeError} Failed. Forbidden.
* @throws {AppSettingsErrorEnvelopeError} Failed. The specified schema was not found.
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid. | Failed. Forbidden. | Failed. The specified schema was not found.
* @throws {InvalidResponseError}

@@ -182,3 +172,3 @@ * @throws {ApiClientError}

*
* @returns Created
* @returns {Promise<AppSettingsObjectResponse | void>} Created
*

@@ -190,9 +180,6 @@ * @example <caption>Code example</caption>

* await appSettingsObjectsClient.postAppSettingsObject({
* body: { schemaId: "jira-connection" },
* body: { schemaId: "jira-connection", value: {} },
* });
*
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid.
* @throws {AppSettingsErrorEnvelopeError} Failed. Forbidden.
* @throws {AppSettingsErrorEnvelopeError} Failed. The requested resource doesn't exist.
* @throws {AppSettingsErrorEnvelopeError} Failed. Conflicting resource.
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid. | Failed. Forbidden. | Failed. The requested resource doesn't exist. | Failed. Conflicting resource.
* @throws {InvalidResponseError}

@@ -215,3 +202,3 @@ * @throws {ApiClientError}

*
* @returns Success
* @returns {Promise<EffectiveAppSettingsValuesList>} Success
*

@@ -224,4 +211,3 @@ * @example <caption>Code example</caption>

*
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid.
* @throws {AppSettingsErrorEnvelopeError} Failed. The specified schema is not found.
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid. | Failed. The specified schema is not found.
* @throws {InvalidResponseError}

@@ -267,3 +253,3 @@ * @throws {ApiClientError}

*
* @returns Success
* @returns {Promise<EffectivePermissions>} Success
*

@@ -277,3 +263,9 @@ * @example <caption>Code example</caption>

* body: {
* permissions: [{ context: { schemaId: "..." } }],
* permissions: [
* {
* permission:
* SinglePermissionRequestPermission.AppSettingsObjectsRead,
* context: { schemaId: "..." },
* },
* ],
* },

@@ -283,5 +275,3 @@ * },

*
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid.
* @throws {AppSettingsErrorEnvelopeError} Failed. Forbidden. No access to any schema.
* @throws {AppSettingsErrorEnvelopeError} Failed.
* @throws {AppSettingsErrorEnvelopeError} Failed. The input is invalid. | Failed. Forbidden. No access to any schema. | Failed.
* @throws {InvalidResponseError}

@@ -288,0 +278,0 @@ * @throws {ApiClientError}

/**
* AppSettingsErrorEnvelope
*/
import { ClientRequestError } from './client-request-error';
import { ClientRequestError } from '@dynatrace-sdk/shared-errors';
import { AppSettingsErrorEnvelope } from '../models';

@@ -6,0 +6,0 @@ export declare class AppSettingsErrorEnvelopeError extends ClientRequestError<AppSettingsErrorEnvelope> {

@@ -1,4 +0,2 @@

export { isClientRequestError } from './client-request-error';
export { isApiClientError } from './api-client-error';
export { isInvalidResponseError } from './invalid-response-error';
export { isAppSettingsErrorEnvelopeError } from './app-settings-error-envelope-error';
export { ApiClientError, ApiGatewayError, ClientRequestError, InvalidResponseError, isApiClientError, isApiGatewayError, isClientRequestError, isInvalidResponseError, } from '@dynatrace-sdk/shared-errors';
export { AppSettingsErrorEnvelopeError, isAppSettingsErrorEnvelopeError } from './app-settings-error-envelope-error';

@@ -11,3 +11,6 @@ import { AppSettingsErrorDetails } from './app-settings-error-details';

message: string;
/**
* The error details
*/
details?: AppSettingsErrorDetails;
}

@@ -10,2 +10,9 @@ import { AppSettingsValue } from './app-settings-value';

schemaId: string;
/**
* The value of the setting.
*
* It defines the actual values of settings' parameters.
*
* The actual content depends on the object's schema.
*/
value: AppSettingsValue;

@@ -12,0 +19,0 @@ /**

@@ -6,2 +6,9 @@ import { AppSettingsValue } from './app-settings-value';

export interface AppSettingsObjectUpdate {
/**
* The value of the setting.
*
* It defines the actual values of settings' parameters.
*
* The actual content depends on the object's schema.
*/
value: AppSettingsValue;

@@ -8,0 +15,0 @@ /**

@@ -34,5 +34,18 @@ import { AppSettingsModificationInfo } from './app-settings-modification-info';

schemaVersion?: string;
/**
* Modification information about the app setting.
*/
modificationInfo?: AppSettingsModificationInfo;
/**
* The resource context, which contains additional permission information about the object.
*/
resourceContext?: ResourceContext;
/**
* The value of the setting.
*
* It defines the actual values of settings' parameters.
*
* The actual content depends on the object's schema.
*/
value?: AppSettingsValue;
}

@@ -23,4 +23,14 @@ import { AppSettingsModificationInfo } from './app-settings-modification-info';

schemaVersion?: string;
/**
* The value of the setting.
*
* It defines the actual values of settings' parameters.
*
* The actual content depends on the object's schema.
*/
value?: AppSettingsValue;
/**
* Modification information about the app setting.
*/
modificationInfo?: AppSettingsModificationInfo;
}
import { EffectivePermissionGranted } from './effective-permission-granted';
import { PermissionContext } from './permission-context';
export interface EffectivePermission {
permission: string;
granted: EffectivePermissionGranted;
context?: PermissionContext;
}
import { EffectivePermission } from './effective-permission';
import * as _EffectivePermissionGrantedTransformation from './effective-permission-granted.transformation';
import * as _PermissionContextTransformation from './permission-context.transformation';
export interface AsJson {
permission: string;
granted: _EffectivePermissionGrantedTransformation.AsJson;
context?: _PermissionContextTransformation.AsJson;
}
export declare function fromJson($model: AsJson): EffectivePermission;
export declare function toJson($model: EffectivePermission): AsJson;

@@ -11,3 +11,6 @@ import { Modifications } from './modifications';

operations: ResourceContextOperationsItem[];
/**
* The additional modification details for this settings object.
*/
modifications: Modifications;
}

@@ -11,6 +11,6 @@ import { DataTypes } from './data-types';

* Can be `text`, `json`, `array-buffer`, `blob`, `readable-stream`, `buffer` or `stream`.
* @throws DataTypeError when the data does not conform to the specified type.
* @throws UnsupportedOperationError when the type is not supported by the platform.
* @throws {DataTypeError} Data does not conform to the specified type.
* @throws {UnsupportedOperationError} Type is not supported by the platform.
*/
get<T extends keyof DataTypes>(type: T): DataTypes[T];
}

@@ -29,6 +29,6 @@ import { ResponseBodyTypes } from './response-body-types';

* The default response body type is `json`.
* @throws DataTypeError when the response body does not conform to the specified response body type.
* @throws UnsupportedOperationError when the response body type is not supported by the platform.
* @throws {DataTypeError} Response body does not conform to the specified response body type.
* @throws {UnsupportedOperationError} Response body type is not supported by the platform.
*/
body<T extends keyof ResponseBodyTypes = 'json'>(responseBodyType?: T): ResponseBodyTypes[T];
}
import { ErrorType } from './types';
/**
* Error base. All client errors should extend this class.
* Base error for all client SDKs. All other errors extend this class.
*/

@@ -11,2 +11,14 @@ export declare class ApiClientError extends Error {

}
/**
* ApiClientError type guard function.
* Does a structural check of the passed object.
* @example
* try {
* doSomething();
* } catch (e: unknown) {
* if(isApiClientError(e)) {
* handleTheError();
* }
* }
*/
export declare function isApiClientError(e: any): e is ApiClientError;

@@ -7,2 +7,5 @@ import { HttpClientResponse } from '@dynatrace-sdk/http-client';

}>;
/**
* Reference for *ApiGatewayError* details object. Contains information about received API Getaway error.
* */
export interface ApiGatewayErrorDetails extends CommonErrorDetails {

@@ -13,2 +16,6 @@ errorCodeProperties?: {

}
/**
* Dedicated error response class for errors thrown by API Gateway.
* Autogenerated SDK Clients have built-in handler for API Gateway errors that throws this error.
*/
export declare class ApiGatewayError extends ClientRequestError<ApiGatewayErrorResponseBody> {

@@ -20,2 +27,14 @@ readonly isApiGatewayError = true;

}
/**
* APIGatewayError type guard function.
* Does a structural check of the passed object.
* @example
* try {
* doSomething();
* } catch (e: unknown) {
* if(isApiClientError(e)) {
* handleTheError();
* }
* }
*/
export declare function isApiGatewayError(e: any): e is ApiGatewayError;
import { HttpClientResponse } from '@dynatrace-sdk/http-client';
import { ApiClientError } from './api-client-error';
import { ErrorResponseBody } from './types';
/**
* Generic error class for service errors, used to handle both expected and unexpected service-level errors.
* @example Handling unexpected error response, received by the SDK Client
* const responseValue = await response.body('json');
*
* throw new ClientRequestError(
* `${response.status}`,
* response,
* responseValue,
* getErrorMessage(
* responseValue,
* `Unexpected api response: code=${response.status} body="${responseValue}"`,
* ),
* e,
* );
*
*/
export declare class ClientRequestError<DTO = ErrorResponseBody> extends ApiClientError {

@@ -10,2 +27,14 @@ readonly isClientRequestError = true;

}
/**
* ClientRequestError type guard function.
* Does a structural check of the passed object.
* @example
* try {
* doSomething();
* } catch (e: unknown) {
* if(isClientRequestError(e)) {
* handleTheError();
* }
* }
*/
export declare function isClientRequestError(e: any): e is ClientRequestError;

@@ -5,3 +5,2 @@ export * from './api-client-error';

export * from './invalid-response-error';
export * from './sdk-error';
export * from './types';
import { ApiClientError } from './api-client-error';
/**
* Dedicated error class for errors related to response serialization.
* Thrown when received service response can't be deserialized.
**/
export declare class InvalidResponseError extends ApiClientError {

@@ -7,4 +11,17 @@ readonly isInvalidResponseError = true;

nestedError?: Error;
constructor(name: string, nestedError: Error | any | undefined, body: any, expectedType?: string, message?: string);
response: any;
constructor(name: string, nestedError: Error | any | undefined, body: any, expectedType?: string, message?: string, response?: any);
}
/**
* InvalidResponseError type guard function.
* Does a structural check of the passed object.
* @example
* try {
* doSomething();
* } catch (e: unknown) {
* if (isInvalidResponseError(e)) {
* throw e;
* }
* }
*/
export declare function isInvalidResponseError(e: any): e is InvalidResponseError;

@@ -1,6 +0,2 @@

/**
* Possible serialized error types
* `COMMON`: Common JS error
* `HTTP`: Error thrown by a http-client
*/
/** @ignore*/
export declare enum ErrorType {

@@ -10,23 +6,84 @@ COMMON = "JS Error",

}
/**
* Basic error envelope, that enforces all error to have mandatory "error" property.
* */
export interface ErrorResponseBody<T = CommonApiError> {
/**
* *error* object must have two mandatory fields (*code, message*) and may have two additional fields (*help, details*):
* refer to the *CommonApiError* for more details.
* */
error: T;
}
/**
* Common API error structure, established by Dynatrace API guidelines.
* */
export interface CommonApiError<T extends Record<string, any> = Record<string, any>> {
/** The error code should be set to the HTTP error code by default.<br>
* The error code may be set to an API-specific error code which must be properly documented.*/
code: number;
/** The error message should be short and precise, it should not contain details.*/
message: string;
/**
* An additional help field may be added which must be a URL to further information on how to deal with the error.<br>
* This may be some detailed error documentation page or a link to the Dynatrace support system, etc.
* */
help?: string;
/**
* Additional details about the error may be added in a details field.
* Refer to *CommonErrorDetails*
* */
details?: T;
}
/**
* *CommonApiError* details object reference. Contains common API error information.
* This object is used to convey additional information about the error like e.g., which query parameter exactly violated a precondition. <br>
* Details may contain any fields to further describe the error
* */
export interface CommonErrorDetails {
/**
* UUID string that represents a reference of the error into e.g., the log file of the service.
* */
errorRef?: string;
/**
* String containing a 32-character hex integer value that is used for tracing.
* */
traceId?: string;
/**
* String value representing a more detailed error information than the http response code alone.
* Must be a single word in CamelCase, and all possible values must be documented.
* */
errorCode?: string;
/**
* An array of *ConstraintViolation* object, refer to ConstraintViolation object reference for more details.
* */
constraintViolations?: ConstraintViolation[];
/**
* Must be an array of strings containing a complete list of missing IAM scopes necessary to successfully execute the request.
* Should be set if the API returns a 403 - Forbidden response in case of missing OAuth scopes.
* */
missingScopes?: string[];
/**
* Must be an array of strings containing a complete list of missing IAM permissions necessary to successfully execute the request.
* Should be set if the API returns a 403 - Forbidden response in case of missing OAuth user permissions.
* */
missingPermissions?: string[];
}
/**
* Contains information about an input parameter (path, query or request body)
* that violated some validation rule of the service API and caused the warning.<br>
* May contain additional fields further describing the warning.
* */
export interface ConstraintViolation extends Record<string, string | undefined> {
/**
* Mandatory field message describing the warning.
* */
message: string;
/**
* Describes the general location of the violating parameter (query parameter, request body, etc.)
*/
parameterLocation?: string;
/**
* Refers to the violating parameter within the parameterLocation.
*/
path?: string;
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc