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

@frontegg/rest-api

Package Overview
Dependencies
Maintainers
3
Versions
607
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontegg/rest-api - npm Package Compare versions

Comparing version 7.39.0 to 7.40.0-alpha.0

8

error.d.ts

@@ -0,7 +1,13 @@

export type FronteggErrorCode = string;
export type FronteggErrorContext = Record<string, unknown>;
export declare class FronteggApiError extends Error {
private readonly _statusCode;
private readonly _traceId;
constructor(message: string, statusCode: number, traceId: string | null);
private readonly _errorCode;
private readonly _errorContext;
constructor(message: string, statusCode: number, traceId: string | null, errorCode?: FronteggErrorCode, errorContext?: FronteggErrorContext);
get statusCode(): number;
get traceId(): string | null;
get errorCode(): FronteggErrorCode | undefined;
get errorContext(): FronteggErrorContext | undefined;
}
export class FronteggApiError extends Error {
constructor(message, statusCode, traceId) {
constructor(message, statusCode, traceId, errorCode, errorContext) {
super(message);
this._statusCode = void 0;
this._traceId = void 0;
this._errorCode = void 0;
this._errorContext = void 0;
this._statusCode = statusCode;
this._traceId = traceId;
this._errorCode = errorCode;
this._errorContext = errorContext;
}

@@ -15,2 +19,8 @@ get statusCode() {

}
get errorCode() {
return this._errorCode;
}
get errorContext() {
return this._errorContext;
}
}

14

FetchClient.js

@@ -121,7 +121,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";

if (!response.ok) {
var _context$logLevel, _context$logLevel2;
var _errorMessage, _errorMessage2, _context$logLevel, _context$logLevel2;
if (response.status === 413) {
throw new FronteggApiError('Error request is too large', response.status, this.getResponseTraceId(response));
throw new FronteggApiError('Error request is too large', response.status, this.getResponseTraceId(response), undefined);
}
let errorMessage;
let errorCode;
let errorContext;
let isJsonResponse = true;

@@ -134,2 +136,8 @@ try {

}
if ((_errorMessage = errorMessage) != null && _errorMessage.errorCode) {
errorCode = errorMessage.errorCode;
}
if ((_errorMessage2 = errorMessage) != null && _errorMessage2.errorContext && typeof errorMessage.errorContext === 'object') {
errorContext = errorMessage.errorContext;
}
if (errorMessage.errors) {

@@ -141,3 +149,3 @@ errorMessage = errorMessage.errors.join(', ');

if (response.status >= 400 && response.status < 500 && ['warn'].includes((_context$logLevel = context.logLevel) != null ? _context$logLevel : '')) console.warn(errorMessage);else if (response.status === 500 && ['warn', 'error'].includes((_context$logLevel2 = context.logLevel) != null ? _context$logLevel2 : '')) console.error(errorMessage);
throw new FronteggApiError(isJsonResponse ? errorMessage : GENERIC_ERROR_MESSAGE, response.status, this.getResponseTraceId(response));
throw new FronteggApiError(isJsonResponse ? errorMessage : GENERIC_ERROR_MESSAGE, response.status, this.getResponseTraceId(response), errorCode, errorContext);
}

@@ -144,0 +152,0 @@ if (opts.responseType === 'stream') {

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

/** @license Frontegg v7.39.0
/** @license Frontegg v7.40.0-alpha.0
*

@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the

@@ -8,8 +8,12 @@ "use strict";

class FronteggApiError extends Error {
constructor(message, statusCode, traceId) {
constructor(message, statusCode, traceId, errorCode, errorContext) {
super(message);
this._statusCode = void 0;
this._traceId = void 0;
this._errorCode = void 0;
this._errorContext = void 0;
this._statusCode = statusCode;
this._traceId = traceId;
this._errorCode = errorCode;
this._errorContext = errorContext;
}

@@ -22,3 +26,9 @@ get statusCode() {

}
get errorCode() {
return this._errorCode;
}
get errorContext() {
return this._errorContext;
}
}
exports.FronteggApiError = FronteggApiError;

@@ -127,7 +127,9 @@ "use strict";

if (!response.ok) {
var _context$logLevel, _context$logLevel2;
var _errorMessage, _errorMessage2, _context$logLevel, _context$logLevel2;
if (response.status === 413) {
throw new _error.FronteggApiError('Error request is too large', response.status, this.getResponseTraceId(response));
throw new _error.FronteggApiError('Error request is too large', response.status, this.getResponseTraceId(response), undefined);
}
let errorMessage;
let errorCode;
let errorContext;
let isJsonResponse = true;

@@ -140,2 +142,8 @@ try {

}
if ((_errorMessage = errorMessage) != null && _errorMessage.errorCode) {
errorCode = errorMessage.errorCode;
}
if ((_errorMessage2 = errorMessage) != null && _errorMessage2.errorContext && typeof errorMessage.errorContext === 'object') {
errorContext = errorMessage.errorContext;
}
if (errorMessage.errors) {

@@ -147,3 +155,3 @@ errorMessage = errorMessage.errors.join(', ');

if (response.status >= 400 && response.status < 500 && ['warn'].includes((_context$logLevel = context.logLevel) != null ? _context$logLevel : '')) console.warn(errorMessage);else if (response.status === 500 && ['warn', 'error'].includes((_context$logLevel2 = context.logLevel) != null ? _context$logLevel2 : '')) console.error(errorMessage);
throw new _error.FronteggApiError(isJsonResponse ? errorMessage : _constants.GENERIC_ERROR_MESSAGE, response.status, this.getResponseTraceId(response));
throw new _error.FronteggApiError(isJsonResponse ? errorMessage : _constants.GENERIC_ERROR_MESSAGE, response.status, this.getResponseTraceId(response), errorCode, errorContext);
}

@@ -150,0 +158,0 @@ if (opts.responseType === 'stream') {

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

/** @license Frontegg v7.39.0
/** @license Frontegg v7.40.0-alpha.0
*

@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the

{
"name": "@frontegg/rest-api",
"version": "7.39.0",
"version": "7.40.0-alpha.0",
"main": "./node/index.js",

@@ -5,0 +5,0 @@ "license": "MIT",

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

import { FronteggApiError } from '../error';
import { IFronteggRecord } from '../interfaces';

@@ -36,3 +37,3 @@ export interface ReportSchedule {

validation?: 'email' | 'url' | 'phone' | string;
validationError?: string;
validationError?: FronteggApiError;
}

@@ -39,0 +40,0 @@ export interface DataFilterNumber extends DataFilterBase {

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