@dynatrace-sdk/client-app-engine-registry
Advanced tools
Comparing version 1.8.1 to 1.9.0
@@ -5,2 +5,8 @@ # AppEngine - Registry | ||
## 1.9.0 | ||
### Minor Changes | ||
- Introduced @dynatrace-sdk/shared-errors package and improved response errors handling. | ||
## 1.8.1 | ||
@@ -7,0 +13,0 @@ |
@@ -98,11 +98,22 @@ /** | ||
} | ||
isApiClientError = true; | ||
errorType = import_error_handlers.ErrorType.COMMON; | ||
}; | ||
function isApiClientError(e) { | ||
return e instanceof ApiClientError; | ||
return e?.isApiClientError === true && e instanceof Error; | ||
} | ||
// packages/client/app-engine-registry/src/lib/error-envelopes/api-gateway-errors-handler.ts | ||
var import_shared_errors = require("@dynatrace-sdk/shared-errors"); | ||
async function apiGatewayErrorsHandler(response) { | ||
if (response.headers?.["dynatrace-response-source"] === "API Gateway") { | ||
const responseBody = await response.body("json"); | ||
throw new import_shared_errors.ApiGatewayError(response, responseBody); | ||
} | ||
} | ||
// packages/client/app-engine-registry/src/lib/error-envelopes/client-request-error.ts | ||
var import_error_handlers2 = require("@dynatrace-sdk/error-handlers"); | ||
var ClientRequestError = class extends ApiClientError { | ||
isClientRequestError = true; | ||
body; | ||
@@ -118,3 +129,3 @@ response; | ||
function isClientRequestError(e) { | ||
return e instanceof ClientRequestError; | ||
return e?.isApiClientError === true && e?.isClientRequestError === true && e instanceof Error; | ||
} | ||
@@ -124,5 +135,6 @@ | ||
var ErrorEnvelopeError = class extends ClientRequestError { | ||
isErrorEnvelopeError = true; | ||
}; | ||
function isErrorEnvelopeError(e) { | ||
return e instanceof ErrorEnvelopeError; | ||
return e?.isApiClientError === true && e?.isClientRequestError === true && e?.isErrorEnvelopeError === true && e instanceof Error; | ||
} | ||
@@ -203,2 +215,3 @@ | ||
var InvalidResponseError = class extends ApiClientError { | ||
isInvalidResponseError = true; | ||
responseBody; | ||
@@ -218,3 +231,3 @@ expectedType; | ||
function isInvalidResponseError(e) { | ||
return e instanceof InvalidResponseError; | ||
return e?.isApiClientError === true && e?.isInvalidResponseError === true && e instanceof Error; | ||
} | ||
@@ -937,2 +950,6 @@ | ||
* const data = await appEngineRegistryAppsClient.getApps(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -981,2 +998,3 @@ async getApps(config = {}) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1007,2 +1025,7 @@ throw new ClientRequestError( | ||
* }); | ||
* | ||
* @throws {ErrorEnvelopeError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1045,2 +1068,3 @@ async installApp(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
switch (response.status) { | ||
@@ -1090,2 +1114,6 @@ case 400: { | ||
* await appEngineRegistryAppsClient.searchActions(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1129,2 +1157,3 @@ async searchActions(config = {}) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1153,2 +1182,6 @@ throw new ClientRequestError( | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1192,2 +1225,3 @@ async getApp(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1214,2 +1248,6 @@ throw new ClientRequestError( | ||
* ); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1235,2 +1273,3 @@ async uninstallApp(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1339,2 +1378,6 @@ throw new ClientRequestError( | ||
* await appEngineRegistrySchemaManifestClient.getAppManifestSchema(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1374,2 +1417,3 @@ async getAppManifestSchema(abortSignal) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1395,2 +1439,6 @@ throw new ClientRequestError( | ||
* await appEngineRegistrySchemaManifestClient.getDefaultCspProperties(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1430,2 +1478,3 @@ async getDefaultCspProperties(abortSignal) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1432,0 +1481,0 @@ throw new ClientRequestError( |
{ | ||
"dynagen": { | ||
"version": "0.13.3", | ||
"version": "0.14.0", | ||
"generatedAt": "", | ||
"template": { | ||
"name": "@dynatrace-sdk/template-typescript-client", | ||
"version": "0.20.1" | ||
"version": "0.22.1" | ||
} | ||
@@ -9,0 +9,0 @@ }, |
@@ -37,11 +37,22 @@ /** | ||
} | ||
isApiClientError = true; | ||
errorType = ErrorType.COMMON; | ||
}; | ||
function isApiClientError(e) { | ||
return e instanceof ApiClientError; | ||
return e?.isApiClientError === true && e instanceof Error; | ||
} | ||
// packages/client/app-engine-registry/src/lib/error-envelopes/api-gateway-errors-handler.ts | ||
import { ApiGatewayError } from "@dynatrace-sdk/shared-errors"; | ||
async function apiGatewayErrorsHandler(response) { | ||
if (response.headers?.["dynatrace-response-source"] === "API Gateway") { | ||
const responseBody = await response.body("json"); | ||
throw new ApiGatewayError(response, responseBody); | ||
} | ||
} | ||
// packages/client/app-engine-registry/src/lib/error-envelopes/client-request-error.ts | ||
import { ErrorType as ErrorType2 } from "@dynatrace-sdk/error-handlers"; | ||
var ClientRequestError = class extends ApiClientError { | ||
isClientRequestError = true; | ||
body; | ||
@@ -57,3 +68,3 @@ response; | ||
function isClientRequestError(e) { | ||
return e instanceof ClientRequestError; | ||
return e?.isApiClientError === true && e?.isClientRequestError === true && e instanceof Error; | ||
} | ||
@@ -63,5 +74,6 @@ | ||
var ErrorEnvelopeError = class extends ClientRequestError { | ||
isErrorEnvelopeError = true; | ||
}; | ||
function isErrorEnvelopeError(e) { | ||
return e instanceof ErrorEnvelopeError; | ||
return e?.isApiClientError === true && e?.isClientRequestError === true && e?.isErrorEnvelopeError === true && e instanceof Error; | ||
} | ||
@@ -146,2 +158,3 @@ | ||
var InvalidResponseError = class extends ApiClientError { | ||
isInvalidResponseError = true; | ||
responseBody; | ||
@@ -161,3 +174,3 @@ expectedType; | ||
function isInvalidResponseError(e) { | ||
return e instanceof InvalidResponseError; | ||
return e?.isApiClientError === true && e?.isInvalidResponseError === true && e instanceof Error; | ||
} | ||
@@ -880,2 +893,6 @@ | ||
* const data = await appEngineRegistryAppsClient.getApps(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -924,2 +941,3 @@ async getApps(config = {}) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -950,2 +968,7 @@ throw new ClientRequestError( | ||
* }); | ||
* | ||
* @throws {ErrorEnvelopeError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -988,2 +1011,3 @@ async installApp(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
switch (response.status) { | ||
@@ -1033,2 +1057,6 @@ case 400: { | ||
* await appEngineRegistryAppsClient.searchActions(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1072,2 +1100,3 @@ async searchActions(config = {}) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1096,2 +1125,6 @@ throw new ClientRequestError( | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1135,2 +1168,3 @@ async getApp(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1157,2 +1191,6 @@ throw new ClientRequestError( | ||
* ); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1178,2 +1216,3 @@ async uninstallApp(config) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1286,2 +1325,6 @@ throw new ClientRequestError( | ||
* await appEngineRegistrySchemaManifestClient.getAppManifestSchema(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1321,2 +1364,3 @@ async getAppManifestSchema(abortSignal) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1342,2 +1386,6 @@ throw new ClientRequestError( | ||
* await appEngineRegistrySchemaManifestClient.getDefaultCspProperties(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -1377,2 +1425,3 @@ async getDefaultCspProperties(abortSignal) { | ||
const response = e.response; | ||
apiGatewayErrorsHandler(response); | ||
const responseValue = await response.body("text").catch(() => ""); | ||
@@ -1379,0 +1428,0 @@ throw new ClientRequestError( |
{ | ||
"name": "@dynatrace-sdk/client-app-engine-registry", | ||
"version": "1.8.1", | ||
"version": "1.9.0", | ||
"description": "Manage Dynatrace AppEngine apps.", | ||
@@ -8,3 +8,4 @@ "license": "Apache-2.0", | ||
"@dynatrace-sdk/error-handlers": "^1.2.0", | ||
"@dynatrace-sdk/http-client": "^1.2.0" | ||
"@dynatrace-sdk/http-client": "^1.2.0", | ||
"@dynatrace-sdk/shared-errors": "^0.0.2" | ||
}, | ||
@@ -11,0 +12,0 @@ "main": "./cjs/index.js", |
# @dynatrace-sdk/client-app-engine-registry | ||
[![npm](https://img.shields.io/badge/npm-v1.8.1-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-app-engine-registry/v/1.8.1) | ||
[![npm](https://img.shields.io/badge/npm-v1.9.0-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-app-engine-registry/v/1.9.0) | ||
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) | ||
@@ -5,0 +5,0 @@ |
@@ -25,2 +25,6 @@ import { AbortSignal, HttpClient } from '@dynatrace-sdk/http-client'; | ||
* const data = await appEngineRegistryAppsClient.getApps(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -67,2 +71,7 @@ getApps(config?: { | ||
* }); | ||
* | ||
* @throws {ErrorEnvelopeError} Bad Request | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -85,2 +94,6 @@ installApp(config: { | ||
* await appEngineRegistryAppsClient.searchActions(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -111,2 +124,6 @@ searchActions(config?: { | ||
* }); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -148,2 +165,6 @@ getApp(config: { | ||
* ); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -150,0 +171,0 @@ uninstallApp(config: { |
@@ -21,2 +21,6 @@ import { AbortSignal, HttpClient } from '@dynatrace-sdk/http-client'; | ||
* await appEngineRegistrySchemaManifestClient.getAppManifestSchema(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -34,2 +38,6 @@ getAppManifestSchema(abortSignal?: AbortSignal): Promise<Record<string, any>>; | ||
* await appEngineRegistrySchemaManifestClient.getDefaultCspProperties(); | ||
* | ||
* @throws {InvalidResponseError} | ||
* @throws {ApiClientError} | ||
* @throws {ClientRequestError} | ||
*/ | ||
@@ -36,0 +44,0 @@ getDefaultCspProperties(abortSignal?: AbortSignal): Promise<AppDefaultCsp>; |
@@ -7,2 +7,3 @@ import { ErrorType } from '@dynatrace-sdk/error-handlers'; | ||
readonly cause?: any; | ||
readonly isApiClientError = true; | ||
errorType: ErrorType; | ||
@@ -9,0 +10,0 @@ constructor(name: string, message?: string, cause?: any); |
import { HttpClientResponse } from '@dynatrace-sdk/http-client'; | ||
import { ApiClientError } from './api-client-error'; | ||
export declare class ClientRequestError<DTO> extends ApiClientError { | ||
readonly isClientRequestError = true; | ||
body: DTO; | ||
@@ -5,0 +6,0 @@ response: HttpClientResponse; |
@@ -7,3 +7,4 @@ /** | ||
export declare class ErrorEnvelopeError extends ClientRequestError<ErrorEnvelope> { | ||
readonly isErrorEnvelopeError = true; | ||
} | ||
export declare function isErrorEnvelopeError(e: any): e is ErrorEnvelopeError; |
import { ApiClientError } from './api-client-error'; | ||
export declare class InvalidResponseError extends ApiClientError { | ||
readonly isInvalidResponseError = true; | ||
responseBody: any; | ||
@@ -4,0 +5,0 @@ expectedType?: string; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
213405
144
4815
3
+ Added@dynatrace-sdk/shared-errors@0.0.2(transitive)